Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9042a5f
uocr: Unlimited-OCR-2 on native Metal
BobClawblaw Nov 6, 2026
9429bf1
changelog: Unlimited-OCR-2 on native Metal under Unreleased
BobClawblaw Nov 6, 2026
b99fce7
changelog: #2074's line from lines/2074.txt in place of its own
ashhart Nov 15, 2026
5c42ffd
kv pool: a named TF_KV_SHARE's slots come where an asked cache goes
Bizuayeu Nov 12, 2026
9bf1993
docs: the memory plan sets a named TF_KV_SHARE's slots where a named …
Bizuayeu Nov 13, 2026
b54f8a3
changelog: #3125 under Unreleased
Bizuayeu Nov 13, 2026
dfdaf05
feat(hip): a tuning row can bound the width of the codes it takes
AbrahamCete Nov 11, 2026
875748c
perf(hip): on gfx1151 a plain prompt of 1 or 2 rows takes the 2-row K…
AbrahamCete Nov 11, 2026
f69b5de
changelog: #3273 under Unreleased
ashhart Nov 15, 2026
5e4ed6f
Order Qwen Metal projection outputs at callers and omit unread group …
ashhart Nov 11, 2026
357fbd9
changelog: #2913 under Unreleased
ashhart Nov 15, 2026
433c101
dsv41 metal: a prompt's first chunk reads its Engram rows while the l…
ashhart Nov 14, 2026
882949a
dsv41 metal: a chunk's wait waits for every command buffer before it …
ashhart Nov 14, 2026
f324538
dsv41 metal: the target's buffers stay resident in their own set
ashhart Nov 14, 2026
ad26c32
dsv41 metal: the target's buffers join the weights' residency set ins…
ashhart Nov 14, 2026
addf6a5
dsv41 metal: the prompt cache keeps the state before the first user t…
ashhart Nov 14, 2026
7519e2b
changelog: #3345's line names its PR and the 256-token system part
ashhart Nov 14, 2026
d7533c7
dsv41 metal: draft depth priced from TF_DSV41_CALIB_FILE when set
ashhart Nov 14, 2026
5dd0488
changelog: #3365's line names its PR
ashhart Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

## Unreleased

- Qwen3.8-27B on Metal (M1-M4): projections no longer barrier internally, and XS sums compile out before tensor units, with the same tokens (#2913, #2900).
- DeepSeek-V4.1 on Metal: `TF_DSV41_CALIB_FILE` now prices draft depth from a cost table measured on the serving machine (before, Metal always used the built-in table, which on an M5 Ultra prices a one-row round at 42 ms against 19.6 measured and a drafter pass at 5.6 ms against 3.1). Tokens are unchanged. On an M5 Ultra with a measured table, prose decode rose about 1% greedy and 2.4% sampled.
- DeepSeek-V4.1 on Metal: `TF_DSV41_CALIB_FILE` now prices draft depth from a cost table measured on the serving machine (before, Metal always used the built-in table, which on an M5 Ultra prices a one-row round at 42 ms against 19.6 measured and a drafter pass at 5.6 ms against 3.1). Tokens are unchanged. On an M5 Ultra with a measured table, prose decode rose about 1% greedy and 2.4% sampled (#3365).

- Flash Next on CUDA: sampled draws take one launch and one wait a step, with the same tokens (#2927, #2753).

- HIP on gfx1151: a plain prompt of 1 or 2 rows takes the 2-row K-parallel tile, with byte-identical output (#3273). Thanks to @AbrahamCete.

- Metal: Baidu's Unlimited-OCR-2 is served natively from its BF16 release on M5-class Macs: page images through `serve --vision`, the family's chat template built in, its SAM and CLIP image encoders and decoder under the kernel contract; on five reference pages every departure from the release's own reply is a one-step tie (#2074). Thanks to @BobClawblaw.

## 1.2.9

- Flash Next on CUDA: a lone stream draws on its own path again; the batched draws #2927 added now run only when two or more streams share a step, so one sampled stream no longer pays the group's whole-buffer download each step. Tokens are unchanged (#3391, after #2927).
Expand Down Expand Up @@ -34,10 +44,24 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

- Server: an Ollama-compatible API serves `/api/chat`, `/api/generate`, `/api/embed`, `/api/tags`, `/api/show`, `/api/ps` and `/api/version` through the same chat, completions and embeddings paths as the OpenAI routes, with NDJSON streaming and named refusals for unsupported options (#3342, fixes #3117).
- Server: each `/v1/models` entry now ends with `input_types`, the content parts the model takes: `["text"]`, plus `"image"` with `--vision`, plus `"video"` when the checkpoint reads video and the server loads `libtfvideo`. A `video_url` part sent to a model without video now gets HTTP 400 (`invalid_request_error`) instead of a 500, decided by the same startup check, so the listing and the refusal agree; a server whose model reads video loads `libtfvideo` at startup and says once in its log when it is missing. The other keys are unchanged (#3019, fixes #3004). Thanks to @WebReflection for the design.
- Unlimited-OCR-2 on native Metal (M5 GPUs): Baidu's BF16 release as published serves page images through
`tensorfold-native serve --vision`; one stream, greedy, up to 131,072 tokens. On the recipe's single pages its text
is identical to the release's own `infer` in torch bf16, or departs from it only where two candidate tokens lie
within one bf16 step of each other, the same two torch's float32 run weighs. The five-page document is served the
same way; its departures are listed in the recipe beside float32's (#2074). Thanks to @BobClawblaw.
- GLM-5.3-Flash on CUDA with `TF_KV_SHARE` and no `--prompt-cache-gib`: the kept states' slots, `TF_KV_SHARE` at most, now come where an asked cache goes, before the windows past the engine's own, so a room that holds one more whole window no longer keeps fewer states; Jammed XSFP4 at TP=3 on three GB10s keeps all 32 at `TF_KV_SHARE=32` instead of 8, with the same tokens (#3125). Thanks to @Bizuayeu.
- DeepSeek-V4.1 on Metal: the prompt cache now also keeps a prompt's state before its first user turn and, for a thinking prompt, before its closing `<think>`. A new conversation with the same system prompt and tools resumes after them, and the next turn of a thinking conversation resumes from the last one (its template renders that `<think>` as `</think>`, so before this the cache found nothing and every turn read the whole conversation again). Replies are unchanged.
- DeepSeek-V4.1 on Metal: the prompt cache now also keeps a prompt's state before its first user turn (once the system part before it is 256 tokens or more) and, for a thinking prompt, before its closing `<think>`. A new conversation with the same system prompt and tools resumes after them, and the next turn of a thinking conversation resumes from the last one (its template renders that `<think>` as `</think>`, so before this the cache found nothing and every turn read the whole conversation again). Replies are unchanged (#3345).

- Server: each `/v1/models` entry now ends with `input_types`, the content parts the model takes: `["text"]`, plus `"image"` with `--vision`, plus `"video"` when the checkpoint reads video and the server loads `libtfvideo`. A `video_url` part sent to a model without video now gets HTTP 400 (`invalid_request_error`) instead of a 500, decided by the same startup check, so the listing and the refusal agree; a server whose model reads video loads `libtfvideo` at startup and says once in its log when it is missing. The other keys are unchanged (#3019, for #3004). Thanks to @WebReflection for the design.

- Server: with thinking off, the reasoning effort a request names reaches the chat template (GLM's head follows it), and the reply reports it; a server's own `--reasoning-effort` no longer changes a thinking-off prompt (#3017, fixes #1911). Thanks to @ss-cong for the report.

- Tests: host tests drive 200 refused, cancelled or failed requests down each lane-host path they reach (refusal at admission, cancels while queued and mid-request, backend errors, no lane memory, and a mix) and check none strands a lane, page or slot (#3015, for #2135).
- DeepSeek-V4.1 on Metal: a cold prompt's first chunk now reads its Engram rows while the GPU runs the layers before each Engram layer, instead of reading them all before the chunk starts. Replies are unchanged. On an M5 Ultra, cold prompts start about 0.3 s sooner at 2K tokens, 0.55 s at 8K and 0.8 s at 32K.
- DeepSeek-V4.1 on Metal: a cold prompt's first chunk now reads its Engram rows while the GPU runs the layers before each Engram layer, instead of reading them all before the chunk starts. Replies are unchanged. On an M5 Ultra, cold prompts start about 0.3 s sooner at 2K tokens, 0.55 s at 8K and 0.8 s at 30K (#3318).
- DeepSeek-V4.1 on Metal: the target's own buffers (prompt scratch, each slot's KV, tails, forward and layer scratch, RoPE tables) are now held in a residency set on its queue, as the weights and the DSpark drafter already were. Before, a prompt chunk or decoder pass could wait 50-830 ms between commit and its first GPU instruction while macOS mapped them again, and a server's first request waited about 1.9 s. Replies are unchanged. On an M5 Ultra, cold prompts run about 5-7% faster (2K tokens 600 -> 631 tok/s, 8K 855 -> 917, 32K about 1,000 -> 1,063).
- DeepSeek-V4.1 on Metal: the target's own buffers (prompt scratch, each slot's KV, tails, forward and layer scratch, RoPE tables) now join the weights' residency set, inside its load limit (the set refuses and logs what would take it past 70% of RAM). Before, a prompt chunk or decoder pass could wait 20-830 ms between commit and its first GPU instruction while macOS mapped them again, and a server's first request waited about 1.9 s. Replies are unchanged. On an M5 Ultra, cold prompts run about 5-7% faster (2K tokens 600 -> 631 tok/s, 8K 855 -> 917, 30K about 1,000 -> 1,063) (#3321).

- Tests: the cluster bring-up test of a stopped peer checks the membership's real promise instead of a two-second wall bound that failed on busy CI runners (#3310).

Expand Down
26 changes: 26 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,29 @@ The fixtures in `zig/src/server/fixtures/thinking/` are unmodified release files
`70ae7fac63274ff2eac54152031433374cb80f2f` (an MLX conversion of
[Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B), whose template it carries), under the Apache License 2.0.
See [`LICENSES/Apache-2.0.txt`](LICENSES/Apache-2.0.txt).

## Unlimited-OCR-2

The `unlimited-ocr` family (`zig/src/families/uocr/` and its kernels) follows these parts of the Python code that ships
with [baidu/Unlimited-OCR-2](https://huggingface.co/baidu/Unlimited-OCR-2) at revision
`0480966938291445591f69f08a13b041c073a96a`, the release's own files:

- `modeling_unlimitedocr.py`: the page guard (`_uocr_page_count_guard`), gundam's tiles (`dynamic_preprocess`,
`find_closest_aspect_ratio`), the views' token layout and the prompt (`_uocr_build_inputs`, `infer`), which
`generate.zig`, `preprocess.zig`, `prompt.zig` and `chat_template.jinja` repeat;
- `deepencoder.py`, its CLIP section only (`CLIPVisionEmbeddings`, `NoTPTransformer`, `VitModel`, `quick_gelu`,
`get_abs_pos`; the release's own code, citing no library there): the class row, the position table resized to a
tile, the pre-norm, `quick_gelu`'s 1.702 and the layer order, which `vision.zig`'s CLIP steps repeat;
- `dash_attention.py` and `modeling_deepseekv2.py`: the DASH router (block keys, page-aware candidates, top 16,
entmax-1.5).

The release ships no LICENSE file; its model card states `license: mit`, and these notices carry that licence's text
("MIT License text" above). The SAM encoder, the decoder's attention, its page2d rotary and its MoE gate follow none of
the release's code: they are written from the papers and from the release's modules measured through their inputs and
outputs. `resize.zig` follows no code either: it is the antialiased bicubic the release asks of torch
(`F.interpolate(mode="bicubic", antialias=True, align_corners=False)`, Keys' cubic with a = -0.5, taps spread by the
scale and normalised) for the position tables, written to that operator's definition, with its fp32 rounding order fixed
by measuring torch's output on the release's tables bit for bit.

TensorFold ships none of these files and no Unlimited-OCR-2 weights; `tools/zig/uocr_reference.py` runs the release's
own code as the reference.
8 changes: 5 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,11 @@ one from 0.5 GiB up.

With pages, the plan takes the engine's own window first, then each other stream's fixed part, then the prompt cache:
a named `--prompt-cache-gib` comes before every window but the engine's own, and an unnamed one after the whole
windows the budget holds, half of what they leave but at least 16 GiB and at most all of it (#2987 shows what that
does to `TF_KV_SHARE`'s states). The cache then holds the kept states (on GLM with `TF_KV_SHARE`, a slot a state, the
rest of it made pages), and the rest of the budget becomes pages, up to the streams' windows plus the cache's pages.
windows the budget holds, half of what they leave but at least 16 GiB and at most all of it. On GLM with
`TF_KV_SHARE` named and the cache unnamed, the kept states' slots, `TF_KV_SHARE` at most, come where a named cache
goes, and the rest of the cache after the windows. The cache then holds the kept states (on GLM with `TF_KV_SHARE`,
a slot a state, the rest of it made pages), and the rest of the budget becomes pages, up to the streams' windows plus
the cache's pages.
The settings that decide each part:

| Setting | Kind | Scope | Unset | What it decides | Read in |
Expand Down
1 change: 1 addition & 0 deletions docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Diagnostics quote and escape the supplied text so it cannot create another termi
| `TF_DSV41_SMALL` | DeepSeek-V4.1 on Metal: exactly `0` or `1`; `1` reads the checkpoint's config at its own small shapes (the served smoke test's tiny model); default 0 |
| `TF_DSV41_ASSETS` | DeepSeek-V4.1 on Metal: a directory path without control characters that holds the Engram token map; unset or blank reads it beside the checkpoint |
| `TF_DSV41_ENGRAM_DIR` | DeepSeek-V4.1 on Metal: a directory path without control characters that holds the packed Engram tables; unset or blank takes the checkpoint's `engram_table_dir` |
| `TF_DSV41_CALIB_FILE` | DeepSeek-V4.1 on Metal: a cost table file (JSON: `verify`, each window's ms by its rows from 1, and `draft`, the drafter pass's ms) that prices draft depth instead of the built-in table. Measure it on the machine that serves; pricing never changes a token. Unset: the built-in table. |
| `TF_DSV41_ENGRAM_VERIFY` | DeepSeek-V4.1 on Metal: exactly `sample` or `full`; `full` also checks every byte of the Engram tables against their manifest at boot; default `sample` |
| `TF_DSV41_ENGRAM_CACHE` | DeepSeek-V4.1 on Metal: whole u32 count of Engram records a layer kept cached; default 65536 |
| `XPU_A8_BITS` | Exactly `4` or `8`, for the XPU quantization study; unset keeps the study's existing setting |
Expand Down
1 change: 1 addition & 0 deletions docs/recipes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ For agent-assisted contributions, read the [TensorFold contributor skill](SKILL.
| Spark-X2.6-4B | [Native CUDA](spark-x2.6-4b-cuda.md), [native Metal, the bf16 release, contexts to 1M](spark-x2.6-4b-metal.md) |
| Nanbeige4.3-33B | [Native Metal, the bf16 and INT4 releases, the Llama family](nanbeige-4.3-33b-metal.md) |
| Recursive Flint | [Native Metal, the publisher's affine 4-bit export, reasoning and tool calls](flint.md) |
| Unlimited-OCR-2 | [Native Metal, the bf16 release: page images to structured text, 131k context](unlimited-ocr-metal.md) |

[Persisted serving-state identities](persisted-serving-keys.md) lists the disk owners, their compatibility keys and stale-state host checks.

Expand Down
11 changes: 7 additions & 4 deletions docs/recipes/glm-5.3-flash-cuda.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ left after a 12.2 GiB reserve` and a 5.8 GiB prompt cache
prompt's rows as the pool's pages instead of copying them into the cache, and that log line names it.
- With KV pages (the default at two or more ranks), the pool sets the windows the room holds aside before the prompt
cache, which gets what they leave of its 16 GiB. `--prompt-cache-gib N` sets N GiB aside first, after the engine's
own window and a fixed part and page for each other stream, and the pool takes the rest.
own window and a fixed part and page for each other stream, and the pool takes the rest. `TF_KV_SHARE=n` sets its n
kept states' slots aside in the same place.
- `TF_GLM_PROMPT_TAIL=1` keeps a prompt that names no history, as a `/v1/completions` request's, at its last prompt
chunk start, as a chat keeps its history's, so the same prompt or a longer one resumes there. Those states share the
prompt cache's budget with chat states, least recently used out first, so long raw prompts between two chat turns can
Expand All @@ -78,9 +79,11 @@ left after a 12.2 GiB reserve` and a 5.8 GiB prompt cache
`TF_GLM_KV_HOST_GIB` sizes the host pages (one full window unasked); `TF_GLM_KV_HOST_SHARED=1` gives the ranks of
one host a single copy in `/dev/shm`. Checked on two RTX PRO 6000 Blackwell cards at TP=2.
- `TF_KV_SHARE=n` (with KV pages, 64 at most) keeps prompts' rows as the pool's pages, and the startup plan sets aside
a slot for each of the n kept states' other parts in the prompt cache, as many as the cache holds; the rest of the
cache goes to the pool's pages. `--prompt-cache-gib N` bounds them: the startup line names the slots, and when the
cache holds fewer than n, how many it holds and the `--prompt-cache-gib` that holds all n.
a slot for each of the n kept states' other parts first, where an asked cache goes, as many as fit there; the rest of
the prompt cache goes to the pool's pages after the windows. Where the room would hold one more whole window, the
slots come out of it, so the pool holds fewer pages than it would without them. A named `--prompt-cache-gib N`
bounds the slots too: the startup line names them, and when fewer than n fit, how many, and the
`--prompt-cache-gib` that holds all n where one does.
- `TF_GLM_CHUNK_SOLO=4096` on every rank (opt-in) lets a prompt pass take 4,096 rows while no other stream is decoding.
Unset or `2048`, every pass takes 2,048 rows and nothing extra is held. See [Prompt chunk size](#prompt-chunk-size).
- `TF_GLM_REQUEST_STARTS=1` on rank 0 (opt-in, off by default) cuts each prompt pass at the request's message starts
Expand Down
Loading
Loading