Skip to content

Fix a bug in OutlinesCore backend about advancing when in final state#1727

Merged
RobinPicard merged 1 commit intomainfrom
fix_bug_outlines_core
Aug 14, 2025
Merged

Fix a bug in OutlinesCore backend about advancing when in final state#1727
RobinPicard merged 1 commit intomainfrom
fix_bug_outlines_core

Conversation

@RobinPicard
Copy link
Contributor

Deals with the consequences of an issue in outlines-core

As described in the linked issue, there is a bug in outlines-core in which, when in a final position, the eos_token_id is returned by the get_tokens method, but then causes an error if we try to advance through the guide with it! To avoid this problem, the outlines implementation used to simply check whether the current state is final, and stops advancing through the guide if that's the case. That causes another problem in case there are several different final states in the index, as we were not advancing through the guide even though a token leading to another final state was generated.

The fix proposed here is to check whether the token last generated is accepted by the accepts_tokens method to avoid advancing if the eos_token_id has been generated (as before), but do advance through the guide in all other cases, especially when the token generated leads to a different final state.

@RobinPicard RobinPicard merged commit 647223e into main Aug 14, 2025
5 of 6 checks passed
@RobinPicard RobinPicard deleted the fix_bug_outlines_core branch August 14, 2025 16:07
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