Repository navigation
Add doom-loop repetition stop to the evaluation skill #2841
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
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e161fa7
Add doom-loop repetition stop to the evaluation skill
cjluo-nv 75dd93d
Add quantized-model replay evidence to the doom-loop page
cjluo-nv cc63ab7
Recommend 256/32/3 for doom-loop stops, 1024/32/3 on AA-LCR
cjluo-nv 38f934d
Compress the doom-loop skill page
cjluo-nv ad025e1
Address doom-loop review feedback
cjluo-nv 728e436
Say a repetition stop keeps the text generated so far
cjluo-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
60 changes: 60 additions & 0 deletions
60
plugins/modelopt/skills/evaluation/references/doom_loops.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Doom Loops: Stop Repeating Reasoning Early | ||
|
|
||
| Damaged (often quantized) reasoning models can repeat one block verbatim until | ||
| `max_new_tokens`, burning the full budget on a sample that scores wrong anyway. | ||
| vLLM ≥ 0.17.0 ends such a request through the per-request `repetition_detection` field. | ||
|
|
||
| - **User asks** to avoid doom loops or looping reasoning: add it to every task. | ||
| - **Suspected** (under a long `max_new_tokens` a canary runs far longer than its | ||
| sample count implies, a few requests stay `Running` after the rest finish, or | ||
| `finish_reason: length` responses end in one block repeated verbatim): show the | ||
| evidence and ask first, since it changes the eval protocol. Long but varied | ||
| reasoning, e.g. from a high reasoning effort, is not a loop. | ||
|
|
||
| ## Config | ||
|
|
||
| Add beside the existing entries in | ||
| `evaluation.nemo_evaluator_config.target.api_endpoint.adapter_config.params_to_add` | ||
| (nel-next: `services.<service>.proxy.extra_body`): | ||
|
|
||
| ```yaml | ||
| repetition_detection: | ||
| max_pattern_size: 256 # longest chunk checked, in tokens; sets the CPU cost | ||
| min_pattern_size: 32 # shortest chunk; lower fires on text like 1,000,000,000 | ||
| min_count: 3 # back-to-back copies that end the request | ||
| ``` | ||
|
|
||
| AA-LCR loops restate paragraphs up to ~4K tokens long, so on `ns_aa_lcr` set only | ||
| `repetition_detection.max_pattern_size: 1024` at the same path in the task's | ||
| `nemo_evaluator_config`. NEL deep-merges task config over the top level, so the | ||
| other entries survive; check the dry-run's `config_ef.yaml` block. A hit ends the | ||
| request with `finish_reason: "repetition"`, keeping the text so far; a loop inside | ||
| the reasoning leaves no final answer. | ||
|
|
||
| **Keep these values**; larger sizes add scheduler CPU (~1 ms per request per decode | ||
| step at 4096) and cut more escaped-loop answers. | ||
|
|
||
| ## Guards | ||
|
|
||
| - **Backend.** vLLM < 0.17.0 silently ignores the field. Check the image's vLLM | ||
| version; for an external endpoint, run this probe. `logit_bias` forces one token | ||
| every step, so the output repeats at once: `repetition` means the field works, | ||
| `length` means it was ignored. | ||
|
|
||
| ```bash | ||
| curl -s "$BASE_URL/v1/completions" -H 'Content-Type: application/json' -d '{ | ||
| "model": "<served_model_name>", "prompt": "Hi", "max_tokens": 16, | ||
| "temperature": 0, "logit_bias": {"1000": 100}, "repetition_detection": | ||
| {"max_pattern_size": 4, "min_pattern_size": 1, "min_count": 2}}' \ | ||
|
kevalmorabia97 marked this conversation as resolved.
Resolved
|
||
| | jq -r '.choices[0].finish_reason' | ||
| ``` | ||
|
|
||
| SGLang and TRT-LLM don't support it: tell the user and don't add the field. | ||
| - **Matched and recorded.** Use identical values for baseline and candidate, and add | ||
| them to `export.mlflow.description` and the tags. | ||
| - **Report scores as detector-on.** Ending the request also cuts loops a damaged | ||
| model would have escaped: IQ1 lost up to 0.75 pt per benchmark at 512 (1.5 pt on | ||
| AA-LCR at 4096), IQ2 at most 0.13 pt, BF16 nothing. Published scores ran without it. | ||
|
|
||
| Ending only the reasoning (unmerged vLLM PR #52677) lets the model still answer but | ||
| can inflate damaged-model scores: use it only when the user asks, matched on both sides. | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.