Skip to content

fix: trim undecoded final token (on a stop-word/token-budget stop)#362

Merged
jhen0409 merged 1 commit into
mybigday:mainfrom
a-ghorbani:fix/completion-trim-undecoded-final-token
Jul 10, 2026
Merged

fix: trim undecoded final token (on a stop-word/token-budget stop)#362
jhen0409 merged 1 commit into
mybigday:mainfrom
a-ghorbani:fix/completion-trim-undecoded-final-token

Conversation

@a-ghorbani

Copy link
Copy Markdown
Collaborator

During generation, nextToken() pushes the last sampled token to embd but only decodes it on the next nextToken() call. When completion stops on a stop word or the token limit, that next call never runs, so the last token is left in embd without ever being decoded into the KV cache.

An EOS/EOG stop is unaffected as it returns before the push, so embd stays in sync.

@a-ghorbani
a-ghorbani force-pushed the fix/completion-trim-undecoded-final-token branch from 4188c5f to afedcda Compare July 9, 2026 12:26
@jhen0409
jhen0409 merged commit cd8e0e3 into mybigday:main Jul 10, 2026
1 of 6 checks passed
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.

2 participants