Fix IOIDataset BOS handling - #1773
Merged
jlarson4 merged 2 commits intoSep 12, 2026
Merged
Conversation
koriyoshi2041
approved these changes
Sep 12, 2026
koriyoshi2041
left a comment
Contributor
There was a problem hiding this comment.
The fix matches the tokenizer contract: prompt and label encodings now exclude automatic special tokens, so is the only prompt BOS path and compares the first answer token. I reran the focused unit file at this exact head (7 passed) and ; both passed.
Contributor
|
Correction to my approval wording: |
Collaborator
|
Looks good and covers the reported issues, thanks @emerardd |
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
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.
Description
IOIDatasetpreviously calledtokenizer.encode()with automatic special-token insertion enabled and then manually prepended a BOS. TransformerLens tokenizers configured to add BOS therefore produced two leading BOS tokens by default, whileprepend_bos=Falsestill left one BOS in place. Automatic BOS tokens in the IO/S label encodings also shifted the first differing-token index used byioi_eval(), causing the default evaluation path to read logits one position too late.This change encodes prompts and labels with
add_special_tokens=False, leaving the existingprepend_bosbranch as the sole source of a prompt BOS. The parameter documentation now states that contract.Regression tests model a tokenizer that automatically inserts BOS, cover both values of
prepend_bos, verify that IO/S contain only content tokens, and use position-sensitive logits to confirm thatioi_eval()reads the prediction immediately before the first answer token.No new dependencies are required.
Fixes #1772
Type of change
Screenshots
Not applicable.
Validation
uv run --no-cache --no-sync pytest tests/unit/test_evals_ioi.py -q— 7 passeduv run --no-cache --no-sync mypy .— success across 398 source filesgit diff --check— passed for the affected surfaceThe complete unit-test suite was not run locally.
Checklist: