-
Notifications
You must be signed in to change notification settings - Fork 77
fix(mellea decomp): Solve ConstraintExtractor parsing fails and improve robustness #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+19
−12
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
jakelorocco
reviewed
Feb 10, 2026
cli/decompose/prompt_modules/constraint_extractor/_constraint_extractor.py
Outdated
Show resolved
Hide resolved
jakelorocco
approved these changes
Feb 10, 2026
auto-merge was automatically disabled
February 12, 2026 16:34
Head branch was pushed to by a user without write access
jakelorocco
approved these changes
Feb 12, 2026
Merged
via the queue into
generative-computing:main
with commit Feb 12, 2026
ca3a7f2
4 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[mellea decomp] Improve ConstraintExtractor parsing fails and improve robustness
Type of PR
Description
This PR improves the parsing logic in ConstraintExtractor (mellea decomp) to make constraint extraction more robust, less brittle to formatting variance, and safer under partial / malformed model outputs.
ConstraintExtractor currently relies on naive patterns (e.g., line formatting). In practice, LLM outputs vary across:
• bullet styles (-, *, 1.)
• inline constraints mixed with prose
• missing sections or merged sections
• multi-line constraints with continuation indentation
This leads to:
• false negatives (constraints missed)
• false positives (non-constraints treated as constraints)
• unstable behavior across models / temperatures
Key Changes:
1. Stricter N/A handling
• The extractor now returns an empty list only when the input, after trimming and uppercasing, exactly matches known N/A variants ("N/A", "N / A", "N/ A", "N /A").
• This avoids false positives where N/A appears as a substring within a longer, meaningful constraint description.
2. Line-based parsing with empty-line filtering
• Constraints are processed line by line with leading/trailing whitespace removed.
• Empty lines are skipped to prevent generating empty constraints.
3. Bullet and numbering removal
• Common bullet and numbering prefixes (e.g. -, *, •, 1., 1)) are stripped from each line to normalize constraint text.
4. Inline multi-constraint splitting
• Single lines containing multiple constraints are split using common separators such as ;, -, –, and —.
• Each extracted constraint is individually trimmed and validated before being added to the results.
Testing