Repository navigation
tokenizer: support Flint and authoritative GGML EOG arrays - #678
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: Flint duplicates the existing stop-name override rule.
Must fix
1. Apply stop-name overrides in one loop
crates/tokenizer/src/vocab.rs:577 repeats crates/tokenizer/src/vocab.rs:570. Both loops resolve a name, add its ID to EOG, and mark it CONTROL. This is a kind-B duplication defect under R14.
Cost: combining them removes four lines and one loop without adding a helper or local name. Keeping both requires two edits when this rule changes.
Replace the two adjacent name loops with:
for name in EOG_NAMES.iter().chain(if self.pre == "flint" {
["<|user|>", "<|observation|>"].as_slice()
} else {
&[]
}) {
if let Some(id) = self.id_of(name) {
eog.insert(id);
self.attrs[id as usize] |= attr::CONTROL;
}
}Checked
Duplicates: 8 added function definitions inspected, including the extracted stop validator and ordered splitter. The repeated override rule is item 1. Dryer reported 0 pairs.
Complexity: diagnostics report Vocab::apply_overrides growing from 14 to 17 through the Flint branch and loop; item 1 reuses the existing loop.
Silent failure: invalid stop IDs return errors; absent stop keys and inferred names are optional.
Tests: static mutation checks cover dropping explicit stop replacement, weakening the ID bound, requiring NFC for strict decoding, dropping contractions, and selecting HF mode from GGML stops. The changed assertions reject these mutants. Rust tests and mutants were not executed during validation.
Gates: none removed or relaxed; no pin moved.
Escape catalog: C1–C4 do not match this diff.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
Addressed R14 in 5eae54a. The shared EOG_NAMES loop now chains Flint's two additional stop names; ID resolution, EOG insertion and CONTROL marking have one owner. The duplicate loop was deleted, with no helper, allocation, or alternate path added. Executed on the corrected head:
No tokenizer semantics or four-stop contract changed; prior oracle evidence remains in the PR body. This correction was revalidated with the checks above, not a new mainline/HF corpus run. |
There was a problem hiding this comment.
Since the last review: must-fix 1 is fixed in crates/tokenizer/src/vocab.rs:570. Both name sets now use one override loop.
Verdict: CLEAN: The incremental change resolves the earlier duplication and preserves stop IDs and token attributes.
Checked
Duplicates: 0 new items; the repeated loop is removed. Dryer reported 0 pairs.
Complexity: crapper flagged no functions. The change combines two loops without adding an owner.
Silent failure: 1 optional-name lookup followed into stop IDs and CONTROL attributes. Absent names remain optional; all resolved names retain both effects.
Tests: no tests changed. Existing flint_stops_preserve_gguf_encoding_and_special_parsing assertions reject dropping the Flint names or the CONTROL assignment in the changed loop (static mutation check; tests not executed).
Gates: none removed or relaxed; no pin moved.
Escape catalog: C1–C4 do not match. Flint, non-Flint, missing-name and explicit-array precedence scenarios preserve prior behavior. This is load-time code.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
@Burntgogi Thanks for the contribution. The review is done, so I'm merging this. |
Refs #632; second independent CPU-only slice after #677.
Change
Executed verification
Linux x86_64 i5-12600K/64GiB, no NVIDIA; nightly-2026-08-28, RUSTFLAGS=-C target-cpu=native. Base 40fec96.
Reference execution used only the verified real header in a sparse length container because mainline validates file bounds even in vocab_only mode; its loader explicitly skipped tensors. No payload validation, full model download, inference, CUDA, performance or serve-seat claim. No model files/weights committed.