Skip to content

fix: preserve overlapping stop-sequence prefixes - #2320

Open
zjn20030811 wants to merge 2 commits into
Lightning-AI:mainfrom
zjn20030811:fix-stop-sequence-prefix-matching
Open

fix: preserve overlapping stop-sequence prefixes#2320
zjn20030811 wants to merge 2 commits into
Lightning-AI:mainfrom
zjn20030811:fix-stop-sequence-prefix-matching

Conversation

@zjn20030811

Copy link
Copy Markdown

Summary

  • retain the longest suffix that can begin a stop sequence after a mismatch
  • apply the same matcher independently to every stream in batched generation
  • add regression coverage for overlapping prefixes and competing stop lengths

Fixes #2302.

Tests

  • python -m pytest -q tests/test_chat.py -k "not endtoend and (generate or batched_generate_preserves)" --disable-warnings
  • python -m compileall -q litgpt/generate/base.py tests/test_chat.py
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop sequence matching mishandles overlapping prefixes and buffered tokens

1 participant