Repository navigation
Baseline: bytes per token from offsets, not from vocabulary inspection - #81
Merged
Merged
Conversation
AmitMY
force-pushed
the
simplify/retire-step-time
branch
from
October 10, 2026 09:12
67defcd to
1cbb3ef
Compare
AmitMY
force-pushed
the
simplify/baseline-offsets
branch
from
October 10, 2026 09:12
1b0f8ab to
1732f47
Compare
AmitMY
force-pushed
the
simplify/retire-step-time
branch
from
October 11, 2026 09:39
1cbb3ef to
d0317db
Compare
…abulary entry A token's bytes are the text since the previous token's end: exact for any tokenizer with offsets, every byte counted once, without special-casing byte-level BPE, SentencePiece's ▁ and <0xNN> (and its dummy prefix space). A character split across tokens counts in its first one; its other tokens are still scored text (text_mask). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Xm62qoeaTunFSU5GYCQ1f
AmitMY
force-pushed
the
simplify/baseline-offsets
branch
from
October 11, 2026 09:40
1732f47 to
4ab190b
Compare
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.
Stacked on #80.
The causal-LM baseline needs the UTF-8 bytes of each label to report bits per byte comparable to WeLT's. Each token's bytes were inferred from its vocabulary entry (
token_byte_lengths), special-casing byte-level BPE, SentencePiece's▁and<0xNN>byte fallback, and off by one for SentencePiece's dummy prefix space.Now each token counts the text since the previous token's end, from the tokenizer's offsets (which
token_chunksalready requested). This is exact for any tokenizer with offsets, and counts every byte once.A character split across tokens counts in its first token; its other tokens have 0 bytes but are still scored as text. That's why a
text_mask(scored labels that are not EOS) now marks the bits-per-byte numerator, instead oflabel_bytes > 0.Tests
test_baseline_scores_the_bytes_welt_scores(the baseline scores exactly the bytes WeLT scores) passes.🤖 Generated with Claude Code
https://claude.ai/code/session_015Xm62qoeaTunFSU5GYCQ1f
Note
Medium Risk
Changes how baseline training metrics (bits per byte) are computed and could shift reported numbers slightly, but logic is better aligned with WeLT and covered by updated tests.
Overview
Replaces vocabulary-based per-token byte counting with offset-derived spans: each label’s
label_bytesis the UTF-8 length of text since the previous token’s end, so every byte is counted once for any tokenizer that exposes offsets.Bits-per-byte now uses a new
text_mask(scored labels that are not EOS) for the loss numerator instead oflabel_bytes > 0, so continuation tokens after a split character (0 bytes) still contribute to cross-entropy while byte totals stay correct.token_byte_lengthsis removed;token_chunks/token_examples/loss_funcand dataset wiring are updated accordingly.Tests swap the multi-model vocab check for a Pythia offset round-trip test and extend the loss test for split-character labels.
Reviewed by Cursor Bugbot for commit 4ab190b. Bugbot is set up for automated code reviews on this repo. Configure here.