╔══════════════════════════════════════════════════════════════════════════════╗ ║ FAST_SPLIT ATOM VALIDATION HARNESS - FINAL SUMMARY ║ ╚══════════════════════════════════════════════════════════════════════════════╝ GENERATED ARTIFACTS: 📁 tokenizers/fast_split/tests/ ├── atom_validation_harness.py # Full Python harness (fetches from HF) ├── harness_generated.py # Test vector generator ├── test_gen_atom_parity.rs # 30 Rust unit tests (auto-generated) └── ATOM_COVERAGE_REPORT.md # This report ═══════════════════════════════════════════════════════════════════════════════ UNIQUE PATTERNS TO SUPPORT: 8 TOTAL ═══════════════════════════════════════════════════════════════════════════════ Implemented (✓) vs TODO (○): ┌─────┬────────────────────────────────────────────────────────────────────────┐ │ A1 │ fsm_split ── Split delimiter variants │ │ │ ✓ WhitespaceSplit (Split) │ │ │ ✓ Punctuation (Split) │ │ │ ✓ Digits (Split) │ │ │ ✓ Metaspace (Split) │ │ │ ○ CharDelimiterSplit (byte compare, no tag) │ │ │ ✗ Split(Regex) ── ESCAPE HATCH (not in atoms) │ ├─────┼────────────────────────────────────────────────────────────────────────┤ │ A2 │ fsm_class_runs ── Class-change boundary │ │ │ ✓ Whitespace (drop WS, keep Word+Symbol) │ │ │ ✓ BertPreTokenizer (drop WS, isolate PUNCT) │ ├─────┼────────────────────────────────────────────────────────────────────────┤ │ A3 │ fsm_cl100k ── OpenAI cl100k/o200k 7-rule pretokenizer │ │ │ ✓ Rule 1: 's/'t/'re/'ve/'m/'ll/'d contractions │ │ │ ✓ Rule 2: [^\r\n\p{L}\p{N}]?\p{L}+ │ │ │ ✓ Rule 3: \p{N}{1,3} (digit cap) │ │ │ ✓ Rule 4: [^\s\p{L}\p{N}]+[\r\n]* │ │ │ ✓ Rules 5-7: whitespace handling │ ├─────┼────────────────────────────────────────────────────────────────────────┤ │ A4 │ fsm_deepseek ── DeepSeek-V3 Sequence pretokenizer │ │ │ ✓ Split-1: \p{N}{1,3} │ │ │ ✓ Split-2: [一-龥぀-ゟ゠-ヿ]+ (CJK isolation) │ │ │ ✓ Split-3: big regex (5 alts) │ │ │ ✓ ByteLevel final pass │ ├─────┼────────────────────────────────────────────────────────────────────────┤ │ A5 │ fsm_byte_level ── GPT-2 / Llama 3 / Mistral / Qwen style │ │ │ ✓ GPT-2 regex (use_regex=true) │ │ │ ✓ Simple ByteLevel (use_regex=false, for postprocessing) │ ├─────┼────────────────────────────────────────────────────────────────────────┤ │ A6 │ fsm_script_run ── UnicodeScripts (TODO stub in PR) │ │ │ ○ Script change boundary │ │ │ ○ Transparent set {Common, Inherited, Any} │ ├─────┼────────────────────────────────────────────────────────────────────────┤ │null │ SentencePiece ── External (T5, Llama 1/2, etc.) │ │ │ N/A ── handled by SPM, not in tokenizer.json pre_tokenizer │ └─────┴────────────────────────────────────────────────────────────────────────┘ ═══════════════════════════════════════════════════════════════════════════════ TEST VECTOR COVERAGE (30 canonical cases) ═══════════════════════════════════════════════════════════════════════════════ Generated test vectors cover: • Contractions ('t/'re/'s/'ve/'m/'ll/'d) ── 3 cases • CJK/Unicode boundary isolation ── 4 cases • Number caps ({1,3} vs unbounded) ── 2 cases • Whitespace edge cases ── 4 cases • Punctuation isolation ── 3 cases • Multiscript boundaries ── 3 cases • Symbol/word run boundaries ── 2 cases • Null pre_tokenizer (SPM) ── 1 case ► Total: 30 byte-exact parity tests ═══════════════════════════════════════════════════════════════════════════════ WHAT YOU NEED TO HAND-UNROLL: 0 (ZERO!) ═══════════════════════════════════════════════════════════════════════════════ All 8 canonical patterns already map to your atoms: A1 Split family → WhitespaceSplit, Punctuation, Digits, Metaspace A2 ClassRuns family → Whitespace, BertPreTokenizer A3 cl100k → GPT-4/Claude/OpenAI A4 deepseek → DeepSeek-V3/R1 A5 byte_level → Llama 3/Qwen/Mistral/GPT-2 A6 script_run → UnicodeScripts (stub exists) null → SentencePiece (external) The ONLY escape hatch needed: ✗ Split(Regex) with arbitrary patterns → Feature-gated fallback to onig ═══════════════════════════════════════════════════════════════════════════════ NEXT STEPS TO COMPLETE ═══════════════════════════════════════════════════════════════════════════════ 1. FINISH A6 (UnicodeScripts): → Implement SCRIPT_RANGES lookup tables (like ATOM_TABLES) → Hook up to fsm_script_run() 2. ADD escape_hatch Split(Regex): → Feature-gated, for DeBERTa/FairSeq edge cases only → Path: onig for rare cases, fast atoms for 99% 3. RUN THE HARNESS: $ cd tokenizers/fast_split/tests $ python atom_validation_harness.py --test-local 4. VERIFY span-exact parity: → Every test case must match HF reference byte-for-byte → This is the "byte-exactness gate" from your spec §8 ═══════════════════════════════════════════════════════════════════════════════ FILES LOCATION ═══════════════════════════════════════════════════════════════════════════════ /Users/arthurzucker/Work/tokenizers/tokenizers/fast_split/tests/ ├── atom_validation_harness.py ← Run this for full testing ├── harness_generated.py ← Test vector generator └── test_gen_atom_parity.rs ← 30 Rust tests (check into repo) To use: python3 tests/atom_validation_harness.py --report # Show registry python3 tests/harness_generated.py # Generate Rust tests