Skip to content

core: expose exact token-local tokenizer bytes - #532

Merged
ashhart merged 1 commit into
ashhart:zig-flashnextfrom
akol1:core/tokenizer-token-bytes
Oct 10, 2026
Merged

ashhart merged 1 commit into
ashhart:zig-flashnextfrom
akol1:core/tokenizer-token-bytes

Conversation

@akol1

@akol1 akol1 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What this changes

Adds allocator-owned exact bytes for token-local Hugging Face decoder chains. ByteLevel and ByteFallback preserve incomplete UTF-8; context-sensitive chains return null. Ordinary text decoding is unchanged. Public ownership/limitations and the changelog are documented.

Receipt

Base: zig-flashnext at f8fe17d (1.0.2). Zig 0.17.0, Linux x86_64, CPU-only; no checkpoint or GPU used.

  • zig test zig/src/core/tokenizer/tokenizer.zig -lc: 13 passed, 0 failed.
  • zig test zig/src/core/tokenizer/steps.zig -lc: 7 passed, 0 failed.
  • zig build test native -Dversion=1.0.2 -j2: completed successfully, without nvcc or kernel assets.
  • A compiled CPU consumer loaded a synthetic tokenizer from disk through loadTokenizer: tokenBytes retained C3/A9, and their concatenation equaled full UTF-8 decoding.
  • Native --version reported 1.0.2.
  • python3 tools/zig/lean_check.py: base and candidate each report 782 files, 512 inherited findings, exit 1. Normalized finding identities/multiplicities are identical: zero added findings.

Initial compiler attempts exhausted temporary-filesystem quota; redirected temporary/cache/output storage resolved that environmental failure. Machine-local paths are omitted.

Not run: Metal, GPU/model serving, draft/plain, cache-resume, concurrent-stream equality or performance measurements. This API-only change does not enable forced-tool serving or claim backend support, model qualification or speed.

Checklist

  • No model arithmetic or lane bypass.
  • Tests cover split bytes, specials/unknown IDs and unsafe decoder chains.
  • Added comments are single-line; changed source modules remain under 600 lines.
  • Approved noreply identity; only synthetic fixtures, no private receipts.

@ashhart
ashhart merged commit 0e6c919 into ashhart:zig-flashnext Oct 10, 2026
@ashhart

ashhart commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you, @akol1. Merged into main (0e6c919): the tokenizer gives a token's exact bytes when its decoder chain is token-local, and null when the bytes depend on context. It's the building block constrained decoding (#564) will use.

@ashhart ashhart mentioned this pull request Oct 10, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
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