Repository navigation
Conversation
|
Thanks @jschmied. A float64 reference that agrees with the official modelling code at every position is the evidence we want. Admitting only the export's exact ignore list keeps the scheme honest. Before this leaves draft:
To your questions:
Then we'll run the contract and its limits. We'll serve the NVFP4 export on a GB10: drafted against plain, concurrent against solo, prompts across the sliding window, and resumed against fresh. |
|
@jschmied Could you rebase the CUDA follow-up onto the updated LFM3 admission/Metal work, preserving both authorships, so the shared admission and build files have a common base? The Metal chain is now split into admission #1513, text #1514 and vision #1502. The admission branch is The Metal chain remains draft while numerical and performance qualification continues. This request is to reconcile the overlapping admission/build changes; it does not claim the chain is ready to land. |
08b338c to
2909751
Compare
|
Thanks @ashhart. All seven are done; the head is
Metal refusal: #1513 is still open, so this PR adds it. The served checks were rerun on this head, and every token hash is equal to the previous head's:
|
|
@BlivionIaG Done: #1508 now stacks on #1513's head
|
4a1e67e to
7be3e82
Compare
|
Thanks @jschmied, this is a thorough round. The shared Liquid backend and the committed float64 references with every miss listed are what we asked for. A few things before we run it:
After that we'll run the contract, its limits and the GB10 served checks. |
7be3e82 to
b60ae9e
Compare
|
Thanks @ashhart.
|
|
Thanks @jschmied. The FP8 split and the SASS receipt are what we asked for, and the NVFP4 head reads as reviewed. This stays on hold for the stack below it: #1513 lands first, and we still owe the contract and GB10 runs on #1492 and #1503. One thing to know for the rebase: since your base, main moved |
|
Hi @jschmied, a status note: this is still parked behind #1492 and #1503, and those are on us (the contract and GB10 |
|
Thanks @jschmied. To answer your question: the contract is weight-only. TensorFold serves the stored NVFP4 weights exactly as loaded and runs them with BF16 inputs, as main already does in its other weight-only modes; our code adds no activation quantization of its own. So the export's static FP4 input step stays out, and the serial reference is the same stored weights with BF16 inputs. On that contract, the final-head host, control, full-reply, request-start and timing receipts stay credited, and no activation-path change is needed. Please say weight-only in the description and docs (the input scales are read and not applied). Integration with current main is on our side.
|
|
@ashhart Thanks. The head is now |
|
Thanks @jschmied. The updated recipe states the agreed weight-only contract: stored NVFP4 weights with BF16 inputs, with the input scales validated but not applied. That closes the remaining question without changing the measured code. The final-head host, control, full-reply, request-start and timing results remain credited. This is ready to land through the normal integration checks; the current-main list and source-pin merges are ours.
|
…KV head prefill_attention.cu instantiates pattn_kernel<128, 8, 4, 8>: Nemotron's <128, 8, 8, 8> needs eight query heads a KV head, and LFM3's full-attention layers have four (16 over 4). Its launch record is measured on nvcc 13.0 and 13.2 from every SM's image (206 registers on sm_80/86/89, 231 on sm_120/121, no static shared memory). sassid on sm_80/86/89/120/121, both toolkits: 0 functions changed, 5 added.
LiquidAI/LFM3-1.7B-NVFP4 stores only the FFN as NVFP4: w1, w3 and w2 as e2m1 codes in groups of 16 with e4m3 block scales, an fp32 tensor scale and a static input scale. Every mixer projection, the embedding and the tied head are bf16, and the depthwise conv kernel is [channels, 1, taps]. - config.zig reads `quantization_config` with quant_method "modelopt" as Scheme.modelopt_nvfp4: quant_algo NVFP4, one Linear group of static FP4 g16 weights and inputs, and an ignore list that is exactly the head, the embedding and every layer's mixer. Anything else is UnsupportedLfm3Quantization. MLX configs parse as before (Scheme.mlx_affine), so a decoder that reads one scheme can refuse the other by name. - weights.zig's schema takes that layout for the bare namespace. tf-lfm3-check passes the published header (b30025bb): 502 text tensors, 1,829,689,408 bytes. The MLX-4bit header still passes (594 tensors, 973,008,384 bytes). Host tests 26/26.
…tract lfm3.cu instantiates liquid_conv<7,0> and liquid_commit<7,0>; contract_controls.cu adds their <7,1> controls. contract_lfm2_moe.zig's Conv and Commit take the tap count; contract_lfm3.zig checks the served 7-tap shapes. Records are identical on nvcc 13.0 and 13.2. contract_limits.zig now lists the lfm2_moe and lfm3 images.
Conv layers keep a 6-row state per slot; full attention runs on kv_pool pages with partial RoPE (32 of 64 pairs); sliding attention runs on a 1280-row per-slot ring through the shared window kernels at window 256. FFN w1|w3 is one FP4 lane weight (shared weight_scale_2), w2 FP4; q|k|v|gate, o, conv and the tied head are bf16. Adds --parallel lanes, drafted rows, and a copy-based prompt cache (conv states, rings, pages [0, at)).
…and LFM3 on CUDA zig/src/families/liquid/ holds what the two Liquid families shared as copies: the lane backend (cuda_lanes.zig), the kept states in the prompt cache's preallocated pages and the walk over a slot's state (cuda_snap.zig), and the native glue: open, admission, the pool and the prompt-cache hooks (cuda_native.zig). Each is generic over the family's model and forward, as liquid_conv.cuh is over the conv's taps. A model names its fixed regions (LFM2.5: the conv states; LFM3: the conv states and every sliding layer's rings) and its paged layers; each family keeps its config, weights, forward, refusals and model. lfm2_moe's backend, snap and native are now thin instances, and lfm3's no longer copy them.
…4, with a control LFM3's full-attention prompt rows (16 query heads over 4 of 128) join the head-64 paged attention's gates, held head by head to contract_attn's float64 bound over shuffled 512-key pages; tf_ctl_pattn_128 reads its values from the neighbouring 8 dims.
config.servedOn(config, backend) refuses modelopt_nvfp4 on Metal with Lfm3ModeloptNvfp4NotOnMetal; CUDA serves it, and both serve the MLX layouts. Metal's LFM3 open (ashhart#1514) calls it.
The export's static FP4 input scales are read, as the admission requires, and not applied: activations stay bf16. The load logs it and the loader's comment says so.
…gainst main, every function's hash
config.Backend gains .xpu; servedOn refuses modelopt_nvfp4 with Lfm3ModeloptNvfp4NotOnMetal or Lfm3ModeloptNvfp4NotOnXpu, and servedProblem words both for the problem line. Metal's open (native/lfm3.zig) calls it right after config.json, before any weight is read. XPU's openFamily asks the family's refuse() before the Level Zero driver opens, and the engine's init checks again before its stream. Tests through each real open: native/lfm3.zig (test-native, macOS) and draft_sources_xpu_test.zig (test-lfm3-xpu-refusal-host, any host).
contract_controls.cu is back at main's 600 lines: the 7-tap conv and commit controls (tf_ctl_liquid_conv_7, tf_ctl_liquid_commit_7) and the head-128 prompt rows' tf_ctl_pattn_128 move to contract_lfm3_controls.cuh, which contract_controls_set.cu includes beside the dense decoders' controls, as one image as before. tf_ctl_pattn_128 names main's P256, IDS and PN constants like tf_ctl_pattn_64.
…base docs/receipts/lfm-cuda-sass-fad7e142/ now compares today's main (shared CUDA headers, ashhart#1492 and ashhart#1503 on it) with the rebased head cde8257 on sm_80/86/89/120/121: prefill_attention 70 of 70 functions identical (+5, pattn_kernel<128, 8, 4, 8>), contract_controls 450 of 450 (+15, LFM3's three controls), nvcc 13.0 and 13.2. nemotron_attention is no longer reached. sass.tsv has every function's SASS sha256 on both sides.
docs/receipts/lfm-cuda-sass-fad7e142/ now compares main af9777b with the merge head 2fc30dd on sm_80/86/89/120/121, nvcc 13.0 and 13.2 (-j 1): prefill_attention 70 of 70 functions identical (+5, pattn_kernel<128, 8, 4, 8>), contract_controls 450 of 450 (+15, LFM3's three controls). Every digest equals the receipt before it; only the header names the new trees.
…ckend Carry main’s cutPoints planning, cut-point tap gating, and LFM2.5 request-start tests through the generic Liquid backend. LFM3 keeps its reviewed mark-only chunking because its sliding rings cannot tap within a chunk.
Keep one-line public comments, retain the detailed LFM3 note in gradient-serving.tsv, and keep the Metal registry at its existing 600-line cap. No execution behavior changes.
Replace the fixed eight-entry cache with the build allocator's list. The host build defines more than eight target/runtime combinations; reuse remains keyed by CUDA module and optimization mode.
The CUDA request-start device runner still named the pre-refactor Lfm declaration. Use the retained B.Liquid type exported by the new backend; its model, snapshots and test operations are unchanged.
…d and not applied
ashhart#1508's 7-tap conv commit adds controls to zig/kernels/cuda/contract_controls.cu and re-pins it; a later commit moves them into contract_lfm3_controls.cuh, which leaves the file byte for byte main's, but its gradient-serving row kept the interim hash. The row now has main's hash again; its note is main's.
43b6d46 to
209ec11
Compare
ashhart#1508's 7-tap conv commit adds controls to zig/kernels/cuda/contract_controls.cu and re-pins it; a later commit moves them into contract_lfm3_controls.cuh, which leaves the file byte for byte main's, but its gradient-serving row kept the interim hash. The row now has main's hash again; its note is main's.
…gh the open servedOn's .xpu case (from ashhart#1508) now names fp8_block too: Lfm3Fp8BlockNotOnXpu, beside Lfm3ModeloptNvfp4NotOnXpu. The XPU open asks before the Level Zero driver, as it does for NVFP4, and the engine's init asks again before its stream. The test writes only the export's config.json and opens it through xpu.zig; with the check removed it fails at the driver instead (LoaderUnavailable).
…1634 ashhart#1634 changes nothing under zig/kernels, so main against its code head 042028b reaches ashhart#1508's functions only: prefill_attention 70 of 70 identical (+5), contract_controls 450 of 450 (+15), nvcc 13.0 and 13.2, sm_80/86/89/120/121.
|
I tested I also tested landing #1502 ( With the official VL 4-bit checkpoint at The wider Igor Lessio - AIFLOW LABS |
Current head
43b6d46b78: ashhart's rebase onto mainedecac9567(409dc2b478) plus one docs commit. That commit says the contract indocs/recipes/lfm3-cuda.md: weight-only, the stored NVFP4 weights served as loaded with bf16 inputs, and the release's input scales read and not applied; activations stay bf16. The final-head receipts (host, x86, SASS, contract with controls, full-reply LFM3 and LFM2.5 comparisons, request-start runner, paired timing) were run on409dc2b478, whose code this head keeps unchanged; they are in #1508 (comment). The sections below describe earlier heads.Part of #1491 (CUDA side). Rebased onto main
b4f1bf263after #1503 landed (#2989), then merged with mainaf9777b49(
2fc30ddf1). #1492, #1503 and #1513 are on main, so every commit here is this PR's own; the head isa9205a9ee. TheFP8 and MLX 4-bit exports are #1634, stacked on this one. VL comes after that.
What
LFM3-1.7B text served natively on CUDA from
LiquidAI/LFM3-1.7B-NVFP4(ModelOpt NVFP4, revisionb30025bb). It isweight-only: the FFN's FP4 weights are used as stored, and every activation stays bf16. The export's static FP4
input scales are read, because the admission requires them, but not applied. The load says so in its log, and the
loader says so in a comment.
a4582a305): the ModelOpt NVFP4 scheme in the sharedlfm3/config.zigandweights.zig, with theexport's exact exclusion list. Only the FFN (w1, w3, w2) is FP4; conv, attention, gate, embedding and head are bf16.
The MLX layouts are unchanged.
bea9088af,2a079deb8):config.servedOn(config, backend)returnsLfm3ModeloptNvfp4NotOnMetalorLfm3ModeloptNvfp4NotOnXpu. Metal's open calls it right afterconfig.json.XPU's open asks before the Level Zero driver, and the engine's
initasks again before its stream. Both have a testthrough the real open. The XPU one is skipped on Windows (
zig/build/xpu.zig:343-348,f2fdfcab3), because thereal open reaches POSIX
openandstd.DynLib.02e245fcb: the 7-tap instances ofliquid_conv.cuh(tf_liquid_conv_7/tf_liquid_commit_7), under thecontract with controls;
450d080e6:prefill_attention's template at head dim 128 with 4 query heads a KV head.07637784e):act_rows.headGate) and the shared norms.5e87d102d):zig/src/families/liquid/holds the lane backend, the kept-state walk and thenative glue (open, admission, pool, prompt-cache hooks), generic over the family's model and forward.
fenced()on the five writes (with main's source test, now overcuda_lanes.zig), the pages switch through the environment table, and "reserved at load".TENSORFOLD_LFM3_KV_PAGEShas its.flagrow, a profile row and a refusal test, like LFM2's.rings) and its paged layers.
0bf1ba4a8,cde825799):pattn_kernel<128, 8, 4, 8>againstcontract_attn.zig's float64 bound overshuffled pages, with a control. LFM3's three controls are in
contract_lfm3_controls.cuh;contract_controls.custays at main's 600 lines.
d694eb2e5):docs/recipes/lfm3-cuda.md, with the command, the revision, the weight-only section, thereceipt and the licence. The float64 reference is main's
tools/lfm3/ref64.py(c2e557a96), so our copy wasdropped.
Licence
The weights are under Liquid AI's LFM Open License v1.0 (
license: other,lfm1.0; the text is the checkpoint'sLICENSE), as the MLX exports are.Verification (GB10, sm_121, real weights, on this head)
native/lfm3.zig,zig build test-native) passes on an M3 Pro and goes red with thecheck commented out ("cannot load this checkpoint (NoSafetensors)"). It ran at an earlier local commit; the Metal
open and
lfm3/config.zighaven't changed since. XPU's (draft_sources_xpu_test.zig,test-lfm3-xpu-refusal-host) goes red without it ("cannot open the Level Zero driver (LoaderUnavailable)"). Bothfolders hold only
config.json, so nothing past the config is read or queued before the refusal.hostTests' host set tox86_64-windows-gnu(a scratch patch, cross-compiled on the GB10), theguarded step is absent and the rest of that test module compiles. With the guard replaced by
if (true), the testhas 36 compile errors from
xpu/qwen27.zig:200:24, the same as thezig-windowsjob on0fa0fa122.2fc30ddf1: the gate hashes each full reply (reasoning_content,content, token ids andtoken_sha256) and fails on an empty reply. It ran 50 gates a model, over 784 replies (all non-empty, 43,520 tokenswith ids), with
--parallel 8. Every gate was equal.0fa0fa122. Main has no LFM3 on CUDA. The hash is575f234045c711a3, thesame as the corrected rows on this thread against
b60ae9ee0.af9777b49. The hash isef6ea8ecf5f099c0.the cache off, a 0.1 GiB cache, under memory pressure, and on fixed pages (
TENSORFOLD_*_KV_PAGES=0). 24 of 32turns hit the cache.
long prompts at once under pressure equal solo.
docs/receipts/lfm-cuda-sass-fad7e142/, mainaf9777b49against the merge2fc30ddf1, nvcc13.0 and 13.2, sm_80/86/89/120/121. Every digest equals the receipt at the rebase.
prefill_attention: 70 of 70functions identical (+5,
pattn_kernel<128, 8, 4, 8>).contract_controls: 450 of 450 (+15, the three controls).cde825799; our kernels are unchanged since):tf-cuda-test kernel-contract paged liquid lfm3: 15 kernels pass gates 1-4, and all 25 controls gored as planted, among them the 7-tap conv (
contract_lfm3_controls.cuh:6), the 7-tap commit (:12) andpattn<128>(:20); the servedpattn<128>gates arecontract_paged_attn.zig:42. Limit records onsm_80/86/89/120/121: LFM3's three launches are current on nvcc 13.0 and 13.2. The only nvcc 13.0 problems are
main's 18 stale records (
exl3_experts,flashnext_mtp,qwen35).a9205a9ee):zig build -Dfixed-cpu test-host(20535 passed, 138 skipped),test-gradient-serving test-qwen-serving-host,test test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths,check-native-cuda-host compile-cuda-tests,zig fmt --check,git diff --checkandpr_check.pyall pass. On the GB10 (2fc30ddf1):test-cuda-host,compile-cuda-tests, the Liquid, LFM3 and XPU host tests andzig fmt --checkall pass, andgit diff --checkis clean.
Speed (GB10)
On the merge
2fc30ddf1: A-B-B-A, 4 servers an arm, the same 6 cold chats (about 9.4k tokens, two kept states each)on every server, paired medians. LFM3 is against the pre-merge head
0fa0fa122(main has no LFM3 on CUDA), and LFM2.5against main
af9777b49.Both paired medians are +2 ms, under half the spread of the pairs. 13 and 15 of 24 slower is near even. Decode is level.
LFM3's code is the same on both sides of its row; the merge only brought main in. These chats are shorter than the
rows posted at the rebase (10.4k tokens), and the decode prompts differ from them, so compare within this table only.
At the rebase, against
b60ae9ee0, the default-cache LFM3 row was +4.1 ms (19 of 24). It followed main's 50 GiBprompt cache, not this code: at 16 GiB on both it was +0.8 ms, and with the cache off -0.8 ms.
Proposed CHANGELOG line
- LFM3-1.7B NVFP4 (ModelOpt) served on CUDA, weight-only; Metal and XPU refuse that export by name (#1508)Settled in review