Repository navigation
server: the JSON writer stays in bounds on a UTF-8 sequence cut off at a string's end (DeepSeek-V4.1 stack 1/14) - #634
Merged
Conversation
… U+FFFD instead of slicing past it.
3 of 8 tasks
Contributor
|
Checked on Linux aarch64 (DGX Spark, Zig 0.17.0), CPU only:
Reading the change: |
Owner
|
Thank you, @jayleaton. This is in 1.0.6 as merge Parts 2 to 5 of the stack are in review. Each one is building blocks with no family using them yet, so we're reading them alongside the parts that put them to use. |
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…t a string's end as U+FFFD Thanks @jayleaton.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of 14 of the DeepSeek-V4.1 Zig engine stack.
The DeepSeek-V4.1 stack
This is the first of 14 pull requests that bring a DeepSeek-V4.1-Flash engine to the Zig runtime. It serves
DeepSeek-V4.1-Flash (EXL3 2.8 bpw) on two DGX Spark nodes with TP=2 over RoCE. The engine has run in production
against the Python serving path, and the recipe with its measurements is public in
jayleaton/deepseek-v41-tensorfold-spark#18.
Each layer builds on the one below and keeps every existing family's behaviour; new paths are off until a family
installs them. GitHub cannot stack pull requests across forks, so each one targets
mainand names the one itdepends on: please review only the commits new in that layer. Layers 1–7 are generic building blocks; 8–14 are the
family itself.
DeepSeek-V4.1 brings its own architecture to the runtime: compressed KV with a sparse indexer, Engram lookups,
mHC residual mixing, MTP drafting, and DSML tool calls.
Measured against the production Python path on the same two nodes, same pack and bench scripts, the same night
(tok/s; decode cells are the best of 3 warm repetitions, prompt cells 3 cold prefills; from the published recipe):
Replies were identical to the Python path's on the bench (16/16 short replies and the long reply hashes). One pair
of nodes, one night, no confidence intervals.
The stack is incremental; layers 8–14 follow as each passes its gates.
This layer
Review the commit new in this layer:
4284048dThe JSON writer escapes a UTF-8 sequence cut off at a string's end as U+FFFD instead of slicing past it.What it adds and why
The JSON writer escapes a UTF-8 sequence that is cut off at the end of a string as U+FFFD instead of slicing past the
string's end. A streamed reply can end mid-sequence (a token boundary inside a multi-byte character), and the writer
read past the slice in that case.
How
json_write.zig: the escape loop clamps a sequence's length to the bytes left; a short tail is written as\ufffdand consumes only the bytes that are there. With a test.Test evidence
Host only: Linux x86_64, Zig 0.17.0, one job at a time with
-j4, a fresh empty--cache-dirfor every run. Base ismainat38de96bf.mainlean_check.pymain: 0 new fingerprintszig fmt --checkzig buildzig build testNot run:
test-golden(not available on Linux, basemainincluded), any GPU or device step and any checkpoint gate. This code, before its rebase onto currentmainand the generic renames, serves DeepSeek-V4.1 in production on two DGX Spark nodes; this tree itself has had no GPU run.