Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fe63890
feat(server): expose open connections gauge
plotarmordev Oct 26, 2026
f53884a
test(server): assert open connections metric contract, not help prose
plotarmordev Oct 26, 2026
53eb0e0
test(server): drive the open-connections gauge through the metrics ro…
plotarmordev Oct 26, 2026
743a8a0
refactor(server): render open_connections beside the server-level gauges
plotarmordev Nov 19, 2026
a37d9f1
changelog: #3925 under Unreleased
ashhart Nov 19, 2026
df44763
dsv41 metal: image prompts
gilby Nov 11, 2026
ad5d771
notices: DeepSeek-V4.1 Metal image preparation follows image_processo…
gilby Nov 11, 2026
6590e78
dsv41 metal: keep a thin image's short side at one pixel, refuse dege…
gilby Nov 11, 2026
c442ea8
changelog: #3926's line
gilby Nov 19, 2026
f9e86f4
changelog: #3926's line from lines/3926.txt in place of its own
ashhart Nov 19, 2026
478f130
feat(server): measure and render selected PDF pages per call
laudney Nov 13, 2026
5b7f392
feat(ocr): read PDF documents and pages on POST /v1/ocr
laudney Nov 13, 2026
2439493
docs(ocr): document PDF documents and pages on POST /v1/ocr
laudney Nov 13, 2026
dac89b1
changelog: #2571 under Unreleased
ashhart Nov 19, 2026
ba3c50a
flashnext hip: a verify window holds eight rows, so a copy lands up t…
gilby Nov 10, 2026
7e4f459
flashnext hip: shared rounds keep three-token copies; a lone stream's…
gilby Nov 10, 2026
936df1d
changelog: the HIP Flash Next eight-row window under Unreleased
gilby Nov 10, 2026
9c2a376
flashnext hip: a host test drives the facts' copy widths through the …
gilby Nov 10, 2026
d3ff4a8
changelog: the eight-row window's line ends with its number and the t…
gilby Nov 10, 2026
4b23df8
flashnext hip: the MTP head's three-draft cap is a named constant the…
gilby Nov 10, 2026
d920eb5
native hip: a host test refuses --mtp-drafts 4 by name, so the head's…
gilby Nov 12, 2026
68771d6
changelog: #2730's line once, under Unreleased (rebase onto main)
ashhart Nov 13, 2026
c93ae85
flashnext hip: the MTP draft cap lives in facts.zig, so lanes.zig sta…
ashhart Nov 13, 2026
51b309b
flashnext hip: one refusal test for --drafter and --mtp-drafts, so hi…
ashhart Nov 14, 2026
5790854
flashnext hip: preserve drafting facts and leave #2730 changelog to l…
ashhart Nov 19, 2026
9a3c7f3
changelog: #2730 under Unreleased
ashhart Nov 19, 2026
e2596c7
metal: a Metal 4 backend under the queue, command buffer and encoder …
ashhart Nov 14, 2026
538196f
dsv41 metal: TF_METAL4=1 runs the family on a Metal 4 queue, decode r…
ashhart Nov 14, 2026
00fa589
dsv41 metal: Metal 4 by default where the Mac has it, TF_METAL4=0 kee…
ashhart Nov 14, 2026
3febc84
changelog: #3374's line names its PR
ashhart Nov 14, 2026
df41f32
metal 4: a closing queue keeps its memory while a feedback is owed, a…
ashhart Nov 14, 2026
828eafd
metal: Metal 4 compiled in only for a binary whose engines use it, an…
ashhart Nov 15, 2026
c54ba9a
changelog: #3374 under Unreleased
ashhart Nov 19, 2026
1ef4acc
flashnext hip: the chunk fallback measures room after the window plan…
gilby Nov 15, 2026
92fde51
changelog: #3419 under Unreleased
ashhart Nov 19, 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
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

## Unreleased

- Nemotron on HIP: a checkpoint whose token table (`backbone.embeddings`) is stored bf16 beside quantized matrices, marked `false` in config.json's quantization block or stored without scales, is admitted and loads; its rows are gathered as stored, the memory plan counts them at their stored bytes, and the startup label adds `+bf16-embed`; a bf16 `lm_head`, projection or other unquantized tensor is still refused by name (#3575, refs #3061). Thanks to @gilby.
- Flash Next on HIP: the prompt chunk fallback counts the window plan's slot bytes as used before deciding whether a smaller chunk admits more streams, where it counted them as free and could keep the larger chunk (#3419). Thanks to @gilby.

- GLM-5.3-Flash on Metal: prompt index scores read each row's queries once per tile and routed-expert gathers load the next step's codes ahead, so follow-up turns reach the first token sooner with unchanged outputs (#3458).
- DeepSeek-V4.1 on Metal: its GPU work goes through a Metal 4 command queue by default where the Mac has one (macOS 26 and later), with the same kernels in the same order and bit-identical outputs; `TF_METAL4=0` keeps Metal 3, `TF_METAL4_TIMELINE=n` logs per-stage GPU times for n rounds of each kind, and `TF_DSV41_ROUND_PROF=1` logs decode rounds' host and GPU milliseconds (#3374).

- Flash Next on HIP: the verify window holds eight rows instead of four, so a stream alone in a round can land copy drafts of up to seven tokens a round; rounds shared by several streams keep three-token copies, MTP still drafts at most three, and each stream's window snapshots take more device memory, which admission counts (#2730). Thanks to @gilby.

- OCR: the native HIP engine reads documents through `POST /v1/ocr` in Mistral's OCR contract (its Python and TypeScript SDKs), with dots.mocr's reader (a box for each layout block). Images and PDFs (`--vision-pdf`) share one page budget per request (`TENSORFOLD_MAX_PDF_PAGES`, default 16), each PDF measured before any inference and each page rendered just before it is read, and Mistral crops share one image budget (256 images, 4 times the page pixels, 16 MiB plus 2 MiB a page). An option that changes content and that TensorFold cannot apply, such as annotations, is refused. A page cut at the context limit or out of its model's format fails the whole request with HTTP 422; `docs/api.md` lists the contract's fields, statuses and limits (#2570, #2571, #2440). Thanks to @laudney.

- DeepSeek V4.1 on Metal: with `--vision`, the server loads the checkpoint's vision tower (a checkpoint without `vision.*` tensors stops at load), and chats with PNG, JPEG or WebP image parts put the tower's rows into the prompt, within `--vision-image-tokens` (4,096 by default) and `--vision-max-images` (4); an image's span is prefilled in one chunk, the prompt cache keys image rows by the image's hash, text that spells the image token stays text, and a vision config with zero heads, a zero `max_wh_ratio` or a `downsample_ratio` below 2 is refused by name (#3926, part of #1676). Thanks to @gilby.

- Server: `/v1/metrics` reports a `tensorfold:open_connections` gauge, the client connections admitted over TCP or the Unix socket and not yet closed, including idle keep-alive ones (#3925). Thanks to @plotarmordev.

- Nemotron on HIP: a checkpoint whose token table (`backbone.embeddings`) is stored bf16 beside quantized matrices, marked `false` in config.json's quantization block or stored without scales, is admitted and loads; its rows are gathered as stored, the memory plan counts them at their stored bytes, and the startup label adds `+bf16-embed`; a bf16 `lm_head`, projection or other unquantized tensor is still refused by name (#3575, refs #3061). Thanks to @gilby.

- GLM-5.3-Flash on Metal: prompt index scores read each row's queries once per tile and routed-expert gathers load the next step's codes ahead, so follow-up turns reach the first token sooner with unchanged outputs (#3458).

- Web: an explicit relative `--token-file` path for the service installer is anchored to the directory it is run from, so the file the installer prepares and the file the generated launcher opens are the same; the default path and symlink handling are unchanged (#3838, fixes #3835). Thanks to @AIFlowML.

Expand Down Expand Up @@ -38,8 +48,6 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

- Docs: the Qwen3.8-27B recipe says to serve with `--thinking-budget 4096` when thinking is on, and gives its GPQA Diamond result on TensorFold 1.2.7 and one GB10: replies cut at the limit from 78 of 198 to 0, and correct from 58.1% to 82.8% (#3373, fixes #3323).



- Idol on CUDA: `tf-idol` runs Idol's denoiser on GB10 (sm_121) and on RTX 50-series and RTX PRO Blackwell (sm_120) cards against a reference case, gated step by step against idol-sdk's float32 run as on Metal, and refuses other GPUs by name (#1767, for #1757). Thanks to @jayleaton, with device runs from @GustavBlack and @Nipale-ai.

- Docs: the drafter training recipe gains a section on adapting an already released drafter, budgeted from a few passes over the scarcest class at a low learning rate with early checkpoints, with the Qwen3.8-27B pilot behind it (#3369, refs #2667). Thanks to @Maxrio9.
Expand Down
8 changes: 8 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,14 @@ common EXL3 operators and their per-slot epilogues; tile decoding is shared.
The ExLlamaV3 MIT attribution, Copyright (c) 2025 Turboderp, applies as described above.
No external reference, captured cubin, model shard or CUDA compiler is bundled by this patch.

## DeepSeek-V4.1 Metal image preparation

The image preparation (`zig/src/families/deepseek_v41/metal/vision_prep.zig`,
`zig/src/families/deepseek_v41/metal/vision_prepare.zig`) follows the image budgets and geometry of
`image_processor.py` in DeepSeek AI's MIT licensed
[deepseek-ai/DeepSeek-V4.1-Flash-1017](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash-1017)
(revision 08c8657f02291e11b6f6b63e0e16014f8e748518), Copyright (c) 2023 DeepSeek.

## Shared EXL3 resolver setup

The shared EXL3 resolver split and CUDA lane option forwarding retain work from PR #728 by @ajensenwaud,
Expand Down
42 changes: 24 additions & 18 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ context-window check still applies. Cohere-style requests retain the reranker's

## OCR

The native HIP engine reads page images through Mistral's OCR contract when it serves a model with an OCR reader
The native HIP engine reads pages through Mistral's OCR contract when it serves a model with an OCR reader
and `--vision`.

| Route | Contract | Request | Reply | Written for |
Expand Down Expand Up @@ -296,41 +296,48 @@ The reader writes block text in one Markdown flavour, the one Mistral's page Mar
- Images are PNG, JPEG or WebP, one page each, up to the 32 MiB body limit and the reader's decoded-pixel limit:
16 megapixels and 8192 pixels a side for dots.mocr; a larger image is bad input. An image whose header and
decoded pixels disagree is refused as bad input.
- PDF documents and `pages` are not read: a PDF document is HTTP 400 "PDF documents are not read on POST /v1/ocr;
send each page as a PNG, JPEG or WebP image", and any non-null `pages` is HTTP 400 "pages selects pages of a PDF
document; POST /v1/ocr reads one page image".
- `https://` URLs (`document_url` and `image_url`) are fetched only with `--vision-urls`: images, at most 32 MiB.
`http://` URLs are refused.
- PDFs need `--vision-pdf`. PDFium renders each selected page at up to 144 DPI, at most 2048 pixels a side and
about 3.6 megapixels; boxes and sizes are in pixels of the rendered page. Mistral reports that DPI (72 for an
image). Every PDF of a request is measured before the first page is read (its page count and each selected
page's size, with no rendering), so a page index out of range, the page budget or a page that does not load fails
before any GPU work. Each page is then rendered just before it is read and freed when it is done, so one rendered
page is in memory at a time; a page that loads but does not render fails the request when it is reached.
- `https://` URLs (`document_url` and `image_url`) are fetched only with `--vision-urls`: images, and PDFs when
`--vision-pdf` is on, at most 32 MiB. `http://` URLs are refused.
- Page budget: images count one page each and PDFs their selected pages; a request reads at most
`TENSORFOLD_MAX_PDF_PAGES` pages (default 16, also the most it may be set to). `--vision-max-images` does not
apply. Over the budget, a request is refused before any inference.
- Image budget, for Mistral crops (`include_image_base64`): at most 256 encoded images, 4 times the request's page
pixels, and 16 MiB plus 2 MiB a page of encoded bytes. Crossing one fails the whole request as an unreadable
page, "too many image regions". The encode needs libjpeg-turbo 3.1.4.1 (`TENSORFOLD_LIBTURBOJPEG` names its
file); without it `include_image_base64` is HTTP 400.

The page is read as one user turn (the page image, then the reader's prompt), greedy, with thinking off and
`max_tokens` equal to all the context the prompt leaves. It succeeds only when the reply stops on its end token
and the reader can parse it.
Pages are read one at a time, each as one user turn (the page image, then the reader's prompt), greedy, with
thinking off and `max_tokens` equal to all the context the prompt leaves. A page succeeds only when the reply
stops on its end token and the reader can parse it.

### Failures

| Failure | Mistral |
| --- | --- |
| Bad input: an undecodable or unsupported file, a page or option the server cannot serve | 400 |
| Bad input: an undecodable or unsupported file, a page or option the server cannot serve, over the page budget | 400 |
| Unreadable page: the reply was cut at the context limit, repeated without end, broke the model's format or gave a box that is not finite; the image budget was crossed | 422 |
| The engine stopped the page (it closed or drained) | 503, `Retry-After: 1` |
| Engine fault or out of memory | 500 |
| Engine fault, out of memory, PDF renderer crash or deadline | 500 |
| Envelope | `{"detail": [{"loc", "msg", "type"}]}`, `type` `bad_input`, `unreadable_page`, `capacity` or `internal` |

An unreadable page's message names its index, and the model's raw text goes to the server log, never to the
client. 422 means the same request fails the same way again under greedy decoding; a 503 carries `Retry-After`.
A client that disconnects stops the request before its page is read.
A failed page fails the whole request: no reply returns some pages and drops others. An unreadable page's
message names its index, and the model's raw text goes to the server log, never to the client. 422 means the
same request fails the same way again under greedy decoding; a 503 carries `Retry-After`. A client that disconnects
stops the request before its next page or PDF render.

### Mistral: `POST /v1/ocr`

| Field | Meaning |
| --- | --- |
| `model` | Any string or null. The reply names the requested id when it is the served name or an `--alias`, else the served name, so `--alias mistral-ocr-latest` lets copied examples echo it |
| `document` | `{"type": "document_url", "document_url"}` or `{"type": "image_url", "image_url"}` (a string or `{"url"}`): a `data:` URL, or an `https://` URL as above. The bytes must be a PNG, JPEG or WebP image; a PDF is HTTP 400 (above). `{"type": "file"}` is HTTP 400 |
| `pages` | Any non-null value is HTTP 400 (above): an image has one page |
| `document` | `{"type": "document_url", "document_url"}` or `{"type": "image_url", "image_url"}` (a string or `{"url"}`): a `data:` URL, or an `https://` URL as above. The bytes decide PDF or image. `{"type": "file"}` is HTTP 400 |
| `pages` | 0-based page indices as a list or a string such as `"0,2-4"`; duplicates are merged. An image has only page `0`. At most 1024 entries (a range counts its length) before merging, and the page budget after |
| `table_format` | Null: tables stay in the page Markdown as pipe tables (a spanned HTML table becomes a pipe table with the spanned text in its first cell). `"markdown"` or `"html"`: each table becomes a `tables[]` entry (`tbl-N.md` or `tbl-N.html`) and the Markdown links it; under `"markdown"` a table with spanned cells stays HTML, the only form that keeps it |
| `extract_header`, `extract_footer` | Move page headers or footers out of `markdown` into `header` and `footer` |
| `include_blocks` | Default `true`: one block for each region with a box. `false` leaves `blocks` out |
Expand All @@ -344,8 +351,7 @@ A client that disconnects stops the request before its page is read.
`dimensions` (`dpi`, `height`, `width`) and `blocks`; `hyperlinks` is left out. A block has `type` (`text`,
`title`, `list`, `table`, `equation`, `code`, `caption`, `header`, `footer` or `image`), an integer box and
`content`, its own Markdown with its tables in the `table_format` form; image blocks add `image_id` and table
blocks `table_id`. `usage_info` gives `pages_processed` and `doc_size_bytes`, the decoded document's size. An
image's `dimensions.dpi` is 72.
blocks `table_id`. `usage_info` gives `pages_processed` and `doc_size_bytes`, the decoded document's size.

## System One on a Clef engine

Expand Down
3 changes: 3 additions & 0 deletions docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Diagnostics quote and escape the supplied text so it cannot create another termi
| `TF_MINIMAX_WORLD` | MiniMax-M3.1-Flash on CUDA: a whole rank count, 2 at CUDA, set with `TF_MINIMAX_RANK`; unset with it gives one rank |
| `TF_PROMPT_ROWS` | Native serving: a multiple of 16 from 128 through 2048; unset keeps the chip/family default |
| `TF_ANE_COLUMNS` | Whole u32 count; zero disables the experimental share; default zero |
| `TF_METAL4` | Metal: exactly `0` or `1`; `1` sends a family's GPU work through Metal 4 (macOS 26 and later) where the family supports it: the same kernels in the same order, with Metal 4's command queue, allocators, argument tables and barriers, and bit-identical outputs; `0` keeps Metal 3. DeepSeek-V4.1 defaults to `1` where the Mac has Metal 4 (its device test rigs to `0`); Macs without it stay on Metal 3 |
| `TF_DSV41_ROUND_PROF` | DeepSeek-V4.1 on Metal: exactly `0` or `1`; `1` logs decode rounds' host milliseconds (first encode to last wait) and GPU milliseconds by rows, every 1,024 rounds; default 0 |
| `TF_METAL4_TIMELINE` | Metal 4: a whole round count, default 0; `n` puts a GPU timestamp at every stage (between barriers) of `n` rounds of each kind a family names, after 8 warm ones, and logs their time by kernel and the longest stages. DeepSeek-V4.1 names its decode rounds by rows. Stamps cost GPU time, so stamped rounds read a little long |
| `TF_FLASHNEXT_SCALE_INDEX` | Flash Next on Metal before tensor units: exactly `0` or `1`; default 1, where the 4-bit expert kernels (decode, grouped and prompt gathers) read each group's scale and bias through a 16-bit index into its tensor's table of pairs, the same values from fewer weight bytes, and the routed experts' stored scales and biases are not kept in memory; `0` keeps and reads the stored arrays; ignored with `--ssd-experts` |
| `TF_FLASHNEXT_GROUPED_ROWS` | Flash Next on Metal without tensor units: `0`, or the rows (`1` through `32`) from which a decode window runs its 4-bit experts grouped by expert, with the same output bits; default 5; ignored with `--ssd-experts` and in speed-up mode |
| `TF_QWEN27_SLOT_RESUME` | Qwen3.8-27B on Metal: exactly `0` or `1`; `0` stops slot 0 resuming a later prompt; unset or blank keeps it on |
Expand Down
3 changes: 3 additions & 0 deletions docs/memory-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ device gauges retain their backend scope and reset behavior. Process and device
unified memory: do not add them. RSS, allocator peaks and physical footprint are different measurements.
The Darwin structure follows Apple's `sys/resource.h` `rusage_info_v4` layout; host tests check its size
and both footprint offsets, and exercise the kernel reader on macOS.
`tensorfold:open_connections` gauges admitted client connections — over TCP and the Unix socket alike — until
close, including the scrape itself and idle keep-alive connections; rejected-over-limit connections are
excluded.

Linux has no physical footprint count, so the footprint gauges stay macOS only. On Linux, `/metrics` reads
`/proc/self/status` at scrape time and reports the resident set: `tensorfold:process_resident_bytes` (`VmRSS`),
Expand Down
Loading
Loading