Skip to content

tokenizer: an ASCII class inside (?i:) folds to its case variants - #842

Merged
ashhart merged 1 commit into
ashhart:mainfrom
plotarmordev:feat/tokenizer-icase-class
Oct 16, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
plotarmordev:feat/tokenizer-icase-class

Conversation

@plotarmordev

@plotarmordev plotarmordev commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

The native tokenizer's regex reads an ASCII bracket class inside a case-insensitive group, (?i:[sdmt]), folded to each member's ASCII case variants, as Oniguruma folds a literal there (s also takes S and ſ). LFM2's pre-tokenizer pattern, '(?i:[sdmt]|ll|ve|re)|..., was refused with UnsupportedRegex, so its tokenizer.json could not load. A negated class, a property class or a non-ASCII member inside (?i:...) is still refused.

This is the first of three pull requests that bring d1-3B (Liquid AI's LFM2-VL decision model) to the native engine on CUDA; it stands on its own.

The d1 recipe these pull requests port (container build, checkpoint checksums, benchmarks) is github.com/plotarmordev/d1-tensorfold; that repository goes public within the next 24 hours, until then the link does not resolve. The whole series was tested end to end on a GB10 against Transformers' bf16 answers and the recipe's Python engine; #844 carries the receipts.

Receipt

  • Environment: TensorFold main (2962468f), Zig 0.17.0, aarch64 Linux (DGX Spark, GB10). Pattern from LiquidAI/d1-3B's tokenizer.json.
  • Exactness: a new regex test splits a string with 'S, 'LL, 'Ve, 'ſ, digits, accents, newlines and spaces exactly as the tokenizers library's Split(Regex(pattern), "isolated") splits it (reference computed with tokenizers in the d1 recipe's container), and checks that (?i:[^a]), (?i:[\p{L}]) and (?i:[é]) are still refused.
  • Decode speed before and after: n/a, tokenizer only.
  • Prompt speed before and after: n/a, no prompt pass changes.
  • Tests run: zig build test 46/46 steps, 744/749 passed (5 skipped); zig fmt --check; lean_check as on main.
  • Not run, and why: Metal (tokenizer code is shared and host-only; no Metal-specific path).

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Unchanged: tokenizer only.)
  • No precision traded for speed.
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran: host tests on aarch64 Linux.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

@ashhart
ashhart merged commit 7a80a2f into ashhart:main Oct 16, 2026
4 checks passed
ashhart added a commit that referenced this pull request Oct 16, 2026
ashhart added a commit that referenced this pull request Oct 16, 2026
ashhart added a commit that referenced this pull request Oct 16, 2026
#626's three loader commits are in both histories as the same patches. The tree keeps the HIP series' qwen3_5/weights files and zig/build/hip.zig (one coreModule), drops qwen3_5/weights/experts.zig (core/quant stacks the experts now), and puts #626's CHANGELOG line before #631's.
ashhart added a commit that referenced this pull request Oct 16, 2026
Qwen3.5, Qwen3.6 and Flash Next on AMD GPUs through the opt-in HIP build (#617, #621, #626, #631, #697, #655,
#811-#818), bracket classes in the tokenizer (#842), System One requests (#843), the shared norm's loads (#796) and
d1-3B on CUDA (#844). CHANGELOG keeps every Unreleased line from both sides, this side's first. The kernel contract's
tf_rms_rows_bf16 record takes #796's values on sm_86, sm_89, sm_120 and sm_121; its sm_80 slot (from #846) takes the 32
static bytes #796 leaves, with the 79 registers sm_80 had.
@ashhart

ashhart commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thank you, @plotarmordev. A small change with exactly the test it needed, and LFM2's tokenizer now loads.

It ships in TensorFold 1.0.12 under your name (2be636e55), with your CHANGELOG line placed among the release's and a thank-you added (d712f2131). Your head is merged after them with no change to the tree (7a80a2f27), so this pull request shows as merged.

The regex tests pass on macOS and Linux. Nothing that loaded before changes: a class inside (?i:...) was refused until now, so every tokenizer that loaded still splits as it did.

Posted by Ash's AI Assistant Synthena

BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
The contributor's commit landed above with the same code; this keeps the PR's head in the history with no change to the tree.
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
 with the HIP series

ashhart#626's three loader commits are in both histories as the same patches. The tree keeps the HIP series' qwen3_5/weights files and zig/build/hip.zig (one coreModule), drops qwen3_5/weights/experts.zig (core/quant stacks the experts now), and puts ashhart#626's CHANGELOG line before ashhart#631's.
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…rt#844 onto the candidate

Qwen3.5, Qwen3.6 and Flash Next on AMD GPUs through the opt-in HIP build (ashhart#617, ashhart#621, ashhart#626, ashhart#631, ashhart#697, ashhart#655,
ashhart#811-ashhart#818), bracket classes in the tokenizer (ashhart#842), System One requests (ashhart#843), the shared norm's loads (ashhart#796) and
d1-3B on CUDA (ashhart#844). CHANGELOG keeps every Unreleased line from both sides, this side's first. The kernel contract's
tf_rms_rows_bf16 record takes ashhart#796's values on sm_86, sm_89, sm_120 and sm_121; its sm_80 slot (from ashhart#846) takes the 32
static bytes ashhart#796 leaves, with the 79 registers sm_80 had.
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