Skip to content

TensorFold 1.3.6

Choose a tag to compare

@ashhart ashhart released this 26 Nov 20:21
· 1315 commits to main since this release

TensorFold 1.3.6

1.3.6 brings exact CUDA TFQ3 serving and speculative drafting to Qwen3.8-27B, GLM-5.3-Flash and Flash Next. It also adds LFM3-VL images on Metal, full GLM-5.3 on CUDA, more LFM3 formats and SenseNova-Loop MLX-affine checkpoints, alongside substantial Inkling 2 speedups and broader prompt-cache controls. A stable release now publishes checked Linux amd64 and arm64 container images (#4986, #1502, #4900, #1634, #1508, #4415, #3857).

CUDA TFQ3

  • Qwen3.8-27B, GLM-5.3-Flash and Flash Next: CUDA serves 3/4/5-bit 2D-AffineCoset TFQ3 checkpoints with randomized 2D FWHT-128. Qwen3.8-27B supports DFlash2 and DSpine drafting from BF16 or MLX bases, GLM-5.3-Flash supports MTP and DFlash2, and Flash Next supports its routed TFQ3 layers and MTP drafter alongside MLX PLE checkpoints. Shared dense and Tensor Core kernels provide bit-exact speculative verification; non-TFQ3 checkpoints keep their existing paths (#4986).
  • Flash Next top-5 checkpoints: a checkpoint with a 1280-wide shared expert loads those projections at their real width rather than 640; top-10/640 checkpoints are unchanged. The optional Inkling 2 EXL3 pack-test path, TF_INKLING2_EXL3_DIR, is registered and documented (#5228).

Speed

  • Inkling 2 Mini on Metal: tensor-unit expert and loop-gate projections make 2K-token prompts about 1.95x faster on M5, with tokens unchanged (#5144). Multi-row logits use coalesced 32-wide vocabulary tiles, making four-stream decode about 3.5% faster on M3 Ultra and 4.5% on M5 with byte-equal results (#5135). Coalesced NVFP4 and MXFP8 expert loads and stable SIMD combining preserve every output bit (#5150). Cached inverse RMS and fused partial updates make single-stream decode about 4% faster on M3 and M5 (#5001).
  • More Inkling 2 Metal gains: grouped routed-expert reads give about 1.9x prompt fill and 15-19% faster four-stream decode on M5 Ultra (#4995). Dense power-of-two matvec kernels gain about 3.6% on M3 Ultra (#4998), fused relative-bias attention makes decode about 3-7% faster on M3 Ultra (#5000), and 16-byte decode reads with parallel router selection move one-stream M4 Pro decode from 9.3 to 20.9 tok/s (#4919).
  • Inkling 2 drafting and prefill: the reworked DSpark drafter batches streams, removes attention score scratch and uses a two-pass GPU top-k while preserving plain and drafted output bits (#4699). On M1 to M4, simdgroup prompt kernels cut a cold 2,048-token prompt from 146 s to 9.7 s on M4 Pro with identical greedy output (#4756). Tree-shaped verification windows now run with output bits equal to the linear path (#5011).
  • Inkling 2 Mini on CUDA: the staged QKV decode projection reaches 5.6 to 6.4 tok/s on GB10 with identical bits (#4718). Sharing one forward pass across concurrent streams makes four-stream decode about 2.7-3.4x faster, with each stream's tokens equal to its solo run (#4786).
  • CUDA sampling: grouped radix probes replace bit-by-bit top-p cutoff searches. At top_p=0.95, a row takes 279-286 us instead of 427-515 us on GB10; every draw, probability and token is unchanged (#4691).
  • Vision on Metal: BF16 attention scores and probabilities halve Inkling 2 image-tower score traffic with byte-identical answers (#5120). Its two FP32 attention dots also use 64 x 64 tiles with byte-identical answers (#5119).
  • Other exact work: Ling-3.0-tiny attention on ARM CPUs is about 10% faster at one and four threads with unchanged tokens and logits (#5071). GLM's Metal DFlash2 draft decode fuses projections and reads packed rows without changing verified tokens (#4258). Metal EXL3 adds exact multi-row projections and a fused gate/up epilogue (#5054), and MiniMax-H3-Image reads ahead only the tensors it uses with mapped BF16 bytes and decoder conversion unchanged (#4909).

New models, formats and guides

  • LFM3-VL-2B images on Metal: the official MLX 4-, 6- and 8-bit checkpoints serve with their own image tower when --vision is enabled; without it the server is text-only. OpenAI image_url parts accept up to four images and 256 image tokens a request by default (#1502, part of #1491).
  • Full GLM-5.3 on CUDA: glm_moe_dsa serves at TP=3, or TP=1 with three in-process shares, with a BF16 latent cache, MTP drafts, slots and prompt steps. GLM-5.3-Flash's paths, kernels and launch arguments are unchanged (#4900, part of #3063).
  • LFM3-1.7B formats on CUDA: the ModelOpt NVFP4 and block-FP8 exports run weight-only with BF16 activations, and the MLX 4-bit checkpoint runs as stored. TENSORFOLD_LFM3_KV_PAGES=0 gives each stream fixed pages, and LFM2.5-24B-A2B moves to the shared Liquid CUDA backend (#1634, #1508, part of #1491).
  • SenseNova-Loop on Metal: MLX-affine g64 checkpoints load and serve (#4415).
  • Tokenizer patterns: \A, \z, $, \G and atomic groups follow Oniguruma, so ERNIE 5.5's digit-grouping tokenizer loads; previously accepted patterns split as before (#4984).
  • Guides: a Claude Code guide covers starting a server, selecting a model or alias, setting the client context window and measuring the attribution block's cache effect (#4931, refs #3225). A Drama 3 guide and checker cover pruned checkpoints, audio waveform (PCM) comparisons and successful retry logs (#4992).

Prompt caches, memory and optional controls

  • Qwen3.8-27B prompt caches: TF_QWEN27_MESSAGE_STARTS=1 keeps states at up to four recent message starts, allowing edits and replacements to resume from that message with unchanged replies (#4932). Repeated prompts retain their rewind state when the cache is full without letting clients evict one another; one-off conversations keep the old plan (#5136). Dropping reasoning from history also resumes correctly with a full cache while preserving the existing state protections (#5154, fixes #5141).
  • Idle weights on Metal: TF_Q27_IDLE_RELEASE=N releases prepared target weights after N quiet seconds and restores only the buffers macOS emptied on the next request, checking each against a SHA-256 snapshot. Replies are unchanged (#5040).
  • DeepSeek-V4.1 on Metal: TF_DSV41_POOL_TOKENS shares latent and index-key positions across slots while preserving per-request context limits and tokens. A request waits when too few positions are free; unset memory and startup behavior are unchanged (#3278, refs #2984).
  • Folded memory and living weights v6: opt-in living weights store folded-memory weights exactly as computed and add in-flight conversational learning, belief revision and a crash-safe delta journal for Llama, Nemotron, Qwen3.5 and Qwen3.8-27B; with learning off, replies are unchanged (#4937). Folded-memory saves and journals use exclusive files without following links, transactional recovery and size, offset and count checks before allocation (#5127).
  • CUDA execution controls: TF_FLASHNEXT_PREFILL_MTP_LEAN=1 skips unread MTP proposal and query work during prefill (#4529). TF_FLASHNEXT_GRAPH_TAIL=1 includes a lone verification row's final copies and greedy selection in its captured graph with the same operations and order (#4544). TF_GLM_KEEP_SEQS=1 reuses a released stream's sequence on its next request, avoiding allocation, fill and free (#4809). Each is off by default with unset behavior unchanged.
  • Kolibri graphs: TENSORFOLD_KOLIBRI_GRAPHS leaves decode graphs enabled when unset, blank or 1, selects eager execution with 0, and refuses other text by name. Tokens are the same either way (#5002).
  • Diagnostics: serve --execution-witness on Qwen3.5-2B Metal binds weight bytes and Metal library hashes with the OS compile options, OS build and chip, without changing replies (#4908). Ling-3.0-tiny's decoder can hash every step's full logits for bit-for-bit comparisons without changing selection (#5072, part of #1247).

Server and request logs

Setting TENSORFOLD_REQUEST_LOG_REPLIES=1 writes each finished reply beside its request, including status, finish reason, text, reasoning, token usage and timings. Streamed replies are written once complete, and rotated archives end on whole records (#4918, part of #3666).

With the switch off, logs remain request-only and background work writes nothing. Typed request records pair with replies under owner-only access rules. Records are capped at 8 MiB and refusal messages at 4 KiB; a larger request record is refused while its reply is still recorded. Writes use an adjacent lock file, rotation to .1 at 64 MiB keeps at most twice the limit across two files, and Windows leaves reply logging off (#3666).

Fixes and changes you may notice

  • Prompt and draft state: Inkling 2 Mini prompt-cache snapshots retain the DSpark drafter's drafting state on warm hits (#4542). Nemotron on HIP keys the token after an MTP prompt-cache state, preventing a shared drafted row from being overwritten and resuming such prompts from an earlier state without changing tokens (#5003, fixes #4999).
  • Inkling 2 on Metal: DSpark pipeline checks allow a valid drafter to load (#5041), prompt-attention shaders build on pre-M5 GPUs under MSL 4.0 (#4980, part of #4961), and six shaders declare their reserved threadgroup sizes and guard partial rows (#4981). Arithmetic is unchanged in all three.
  • LFM3-VL logging and planning: request logs redact image URLs in image and input_image parts as they already did for image_url, and per-stream image rows count toward the memory plan with --vision (#5121).
  • Desktop and Windows: Room turns use an idle watchdog re-armed by streamed chunks or CLI activity instead of a fixed three-minute limit (#4977, fixes #3415). The attachment diagnostic label meets WCAG AA contrast in both themes (#5086, refs #4717). The download check accepts GLM-5.3-Flash and Flash Next TFQ3 checkpoints, and Metal TFQ3 capabilities and records are reported correctly (#5038, reported in #5033). Windows on ARM64 compiles again, with x86_64 unchanged (#4991, fixes #4967).
  • DeepSeek-V4.1 on Metal: the already-created F32 pipeline is released if BF16 mv_mma pipeline loading fails instead of leaking (#5015).
  • Inkling 2 input checks: unsupported attention dimensions and residual-block layouts are refused by name at load. Out-of-range served token ids are refused before launch, and expired Metal token handles are refused instead of returning a newer token in a reused slot (#4990, refs #4387).
  • LFM3 format admission: CUDA refuses MLX 6- and 8-bit exports, MLX affine exports and LFM3-VL by name; Metal and the Intel GPU engine refuse block-FP8 and NVFP4 exports before reading weights (#1634, #1508, part of #1491). Metal EXL3 also refuses overlapping output and scratch buffers (#5054).
  • ZONOS3 voices: OpenAI stock voice names use the configured default voice with case-insensitive matching; a real catalog voice of the same name still wins and other unknown names remain refused (#3872, refs #3615).
  • Settings registry: twenty-nine more settings, mostly DeepSeek-V4.1 CUDA and DSpark settings, and twelve more settings read through the shared environment registry with the same accepted values (#5152, #5131).

Groundwork and shared code

  • CUDA grouped-expert MXFP4: stored E2M1 codes and E8M0 scales decode to BF16 registers and reuse the BF16 experts' accumulation chain with matching output bytes. The up projection is not built, no served checkpoint selects the format yet, and existing expert formats are unchanged (#5042, refs #4926).
  • Sparse and MLA kernels: CUDA adds exact sparse-index selection and summary kernels that no family uses yet (#5051), plus 256-wide MLA value heads and learned-sink merging written for ERNIE 5.5 DSA layers; GLM does not use these paths (#5084, refs #4926). A sparse gather-attention kernel for Kolibri 1.1 handles duplicate, empty and masked indices but is not wired into serving (#5166).
  • Hy4-flash building blocks: serial-exact iHC and HC CUDA kernels, host-side vision layout, one-rank NVFP4 routed experts and W8A16 weight packing landed without a serving path (#5100, #5022, part of #4795; #4934, slice 2 of #3801; #4895, slice 2a of #4795).
  • Other not-yet-served pieces: Metal EXL3 adds an exact one-row projection as the first DeepSeek-V4.1 Metal lane piece (#5050). DeepSeek-V4.1 on HIP adds a top-512 indexer kernel under the Metal selection rule (#4914, part of #2065). ERNIE 5.5's host-only package adds configuration, weight-map, layer-plan and chat-encoding support but does not serve the model (#4985, part of #4926).
  • Shared CUDA code: GLM's mHC kernels use shared bodies while preserving GLM's entries, widths, factors and SASS on every release SM (#5164, refs #4926). Inverse-RMS warp reductions share tf_common::warp_sum while preserving arithmetic, instruction encodings and barriers (#5068).
  • Shared core and Metal code: log-probability ownership and tensor-parallel settings move into shared code without changing behavior (#4950, #4878). Flash Next rotary scalar and hyper-connection RMS sources, and shared vision sums and bias handling, remove per-family copies while preserving assembled sources or arithmetic (#5061, #5060, #5047, refs #2251).
  • Inkling 2 Small EXL3 validation: host-side pack admission checks the EXL3 config and shard byte sizes and refuses mixed widths and unsupported options before loading. This is validation, not serving; existing Inkling 2 Mini paths are unchanged (#5098).

Packaging, tooling and tests

  • Stable container images: publishing a stable GitHub release builds and checks ghcr.io/ashhart/tensorfold:vX.Y.Z for Linux amd64 and arm64 from signed archives. The images pin CUDA, cuBLAS and NCCL 2.30.7 runtime packages, use a non-root user and have no rolling latest; pull requests never publish (#3857).
  • CUDA build tooling and qualification: SASS identity checks run nvcc under setarch -R with equal-length build paths so unchanged rebuilds produce identical images (#5170). Qualification records describe router-tiles PTX differences between nvcc 13.0.88 and 13.3.73 with address randomization on (#5157, refs #5123).
  • Tests and maintainability: host, environment-setting and kernel-contract tests were repaired or expanded for Qwen3.8-27B, GLM, Inkling 2, DeepSeek-V4.1 and weight-residency bookkeeping (#5129, #5122, #5116, #5111, #5058, #5039, #4987). Environment valid-setting cases move into their own table (#5089), pr_check.py refuses new Zig import cycles while inherited cycles remain warnings (#4890, refs #4804), and changelog housekeeping removes a duplicate #4908 entry (#5101).
  • Input checks: GLM on CUDA refuses token ids outside its embedding on every path (ordinary, MTP, paired prompts, DFlash) and refuses startup when the tokenizer has more tokens than the model's vocabulary. ERNIE 5.5 refuses configs whose attention dimensions do not add up. Living memory replays only regular journal files and checks a saved prefix length before allocating. Request records redact inline document payloads and file containers. Valid inputs produce the same output.

Known issue

  • Nemotron-3.5-Lightning on Metal with MTP drafts: a user reports that sampled output with the default drafts differs from --no-drafts (duplicated or cut words, broken tool calls; #5223, also in 1.3.5). Use --no-drafts with this model on Metal until the fix ships.

Thanks

@atakann, @BadAd84, @Bizuayeu, @bjornmonnens, @BlivionIaG, @BobClawblaw, @cwschroeder, @dcolley, @devopsfortunato, @francip, @garvrao80, @gilby, @GrgaPalcic, @javierbits, @jschmied, @kotevcode, @mrv777, @niterider804, @plotarmordev, @Shoestring-dev, @tacosta, @ThinkOffApp, @trozzelle.