Repository navigation
lfm3 CUDA: serve the block FP8 export weight-only and the MLX 4-bit export as stored (stacked on #1508) - #1634
Conversation
|
Thanks @jschmied, and thanks for splitting this out so cleanly. Reusing the affine-4 tiles for the MLX export as stored, and the float64 receipts listing every miss for both exports, are what we were hoping for. This one waits on #1508, which waits on #1492, #1503 and #1513, so we can't run it yet. When you rebase the stack onto main, note that main has since moved the shared attention helpers (texp, ldmatrix, the cp.async commit and wait) into common/qmm_frag.cuh and common/cp_async.cuh. prefill_attention.cu now conflicts with the move into prefill_attention.cuh, and the SASS receipt will need regenerating after that. One small thing in the new commits: in lfm3/cuda_weights.zig the load log Once it's on main, we'll serve both exports on a GB10: drafted against plain, concurrent against solo, prompts across the sliding window, and resumed against fresh. If you have time before then, those same checks for FP8 and MLX 4-bit (you listed them as not run) would speed things up. |
|
One commit added on top,
|
|
Thanks @ashhart, fixed in On the rebase: noted that main moved the shared attention helpers into |
|
Thanks @jschmied, the load log is right now: FP8, MLX 4-bit and NVFP4 each say what's served, and the MLX line says it's served as stored. The numpy path for This still waits on #1508, and that's on us: #1508 needs #1492 and #1503 first, and we owe their runs. When you rebase, please regenerate the SASS receipt after the move into |
|
/atc exchange 79fc1ac2936caca2ede559f5aa3603fb08bf85d2ae72e9b9534e31a700a86b66 |
|
(Optional: nothing new from the author since our last note.) Thanks @jschmied, a quick status note. Nothing is needed on this PR yet. #1492 is on main now, so the stack below this When you rebase this after #1508:
|
|
Thanks @jschmied, a status note. Nothing is needed on this PR yet: #1503 is queued to land, and #1508 follows it with the rebase you've taken on. We read this head against today's main so the rebase holds no surprises:
Then we serve both exports on a GB10: drafted against plain, concurrent against solo, prompts across the sliding window, and resumed against fresh.
|
|
Thanks @jschmied, and thanks again for the per-server rows and harness: they make the decode comparison easy to repeat. We've read the current head against today's main, and there's nothing left for you on the code:
When this is rebased, the overlaps with main are all simple list merges, and we'll take care of them. What remains:
|
|
@ashhart Receipts for Setup
Served, full replies
The FP8 decode cost at 8 streams (
I didn't change any code, and the list merges stay with you as you said. |
|
Thanks @jschmied. The current A/A comparison answers the old eight-stream decode question: that loss no longer reproduces as reported. The Windows guard and named FP8 refusals are also present, and the new full-reply comparisons are useful. The weight pin identifies LiquidAI's own FP8 release. The remaining exactness question is its activation recipe: the config requires dynamic FP8 inputs, while the runtime explicitly skips that operation. Comparing with the previous weight-only head does not establish equality with the published recipe. Please preserve the published activation behavior and compare with its exact serial reference, or provide an agreed interpretation and exact equivalence proof. The cache-on/off results do not isolate a base commit; the new cold-turn cost should stay clearly separated from the withdrawn decode loss. Integration and changelog placement remain ours.
|
|
@ashhart before I add an activation path here, one question on which rule applies, the same one I asked on #1508. When #1145 landed (your landing note), imported low-bit weights deliberately stayed on bf16 rows: no So which do you want for this export?
I'll follow whichever you choose. On the cache-on/off cold-turn cost: agreed, I'll keep it separate from the withdrawn decode loss and won't attribute it to a base commit. |
|
Thanks @jschmied. To answer your question: the contract is weight-only. TensorFold serves the stored FP8 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 dynamic FP8 input step stays out, and the serial reference is the same stored weights with BF16 inputs. On that contract, your completed serving checks and the withdrawn eight-stream decode loss 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), and keep the separate cache cold-turn result and its attribution clear. Integration with current main is on our side.
|
|
@ashhart Thanks. The head is now
|
|
Thanks @jschmied. The explicit weight-only agreement and updated description and recipe close the remaining contract question. The code is unchanged, so the completed serving comparisons remain credited. No activation-path change is needed. The withdrawn decode loss and separate cache cold-turn cost are now clearly distinguished. This is ready to land after the NVFP4 parent, with the remaining main integration handled on our side.
|
f3d0fd7 to
31c576c
Compare
…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.
31c576c to
316bf9e
Compare
…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.
|
Now that #1508 is on main, I trial-merged zig build test-lfm3-host test-lfm3-cuda-host test-liquid-cuda-host \
test-lfm3-xpu-refusal-host test-gradient-serving -Dfixed-cpu -j2 --summary all
zig build check-native-cuda-host -Dtarget=aarch64-linux-gnu -Dfixed-cpu -j2 --summary allI also tested the landing order with #1502 after #1634. It leaves the same four conflicts as #1502 on its own. Keep the existing NVFP4 and FP8 weight fixtures alongside the vision fixtures, preserve the native Metal refusal checks, and retain the shared Safetensors header parser in the CUDA test shim. That combined tree passed 145 host tests with five skipped and the ARM64 Linux CUDA compile. This verifies the integration path and the weight-only host contract. The prior author receipts cover CUDA serving. I did not rerun device serving or performance on the combined tree. Igor Lessio - AIFLOW LABS |
LiquidAI/LFM3-1.7B-FP8 (compressed-tensors, FP8_BLOCK): e4m3 weights with a bf16 scale per 128 x 128 block on the FFN and q/k/v/o, dynamic FP8 inputs in groups of 128; the convs, the attention gate, the embedding and the head stay bf16. The recipe, the ignore list and the 402 tensors are checked as published. Metal refuses it by name (Lfm3Fp8BlockNotOnMetal).
…as stored - FP8: the FFN and q/k/v/o on the block-FP8 lane, activations bf16 (the export's dynamic input quantization is not applied). The bf16 attention gate is a projection of its own, written into the merge's sums buffer after the attention. - MLX 4-bit g64: every projection and the tied head as affine-4 tiles, prompt chunks on the affine prompt GEMM, decode rows on the verify tiles over their 64-value sums; the embedding rows read the same codes. Wrapped names (language_model.model.*) come from the admission. 6- and 8-bit MLX and VL are refused by name.
The receipts are main's tools/lfm3/REF64.md (ref64.py dequantizes block FP8 exactly, from ashhart#1696). FP8 agrees on 824 of 829 prompt rows and 128 of 128 reply rows, MLX 4-bit on 825 and 128; every miss is listed with its float64 margin (0.004 to 0.085). Concurrent == solo at 4 and 8 streams.
…, the NVFP4 line prints for NVFP4 only
…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.
…d and not applied
316bf9e to
c1dad6e
Compare
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
Current head
f3d0fd7051: ashhart's rebase onto main22d77f7839(6d91aa5cb) plus one docs commit. That commit says the contract indocs/recipes/lfm3-cuda.md: weight-only, with the stored FP8 and NVFP4 weights served as loaded with bf16 inputs. The release's input scales are read and not applied, the dynamic FP8 input step is not applied, and activations stay bf16. The served receipts (FP8, MLX 4-bit, LFM2.5 against main) and the 8-stream cache timing ran on6d91aa5cb, whose code this head keeps unchanged; they are in #1634 (comment).6d91aa5cbagainst2b748e000it is +0.10 % (noise floor 0.56 %), WITHIN NOISE. The "Don't land yet" rows below are history.--prompt-cache-gib 0(5 of 5 rounds), and decode is about 5 % faster.The sections below describe earlier heads.
Stacked on #1508 (head
0fa0fa122); every commit after it is this PR's own. The head is82cb493d8. Rebased onto#1508 after its rebase onto main
e7e24243d: ourref64.pycommit4ab6a44e6dropped out (main has the same filebyte for byte, from #1696), and so did the tools part of the docs commit.
What
LFM3-1.7B's other two text exports on CUDA, beside #1508's NVFP4:
503883283):LiquidAI/LFM3-1.7B-FP8(revision243955da, compressed-tensors FP8_BLOCK). Therecipe, the ignore list and all 402 tensors are checked as published.
503883283,042028b62):servedOnrefusesfp8_blockwithLfm3Fp8BlockNotOnMetalorLfm3Fp8BlockNotOnXpu, beside lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's two NVFP4 refusals, andservedProblemwordsall four. Metal's and XPU's opens already ask
servedOn(lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508), before any weight is read and, on XPU, beforethe Level Zero driver. No new path: the FP8 case is one more arm of the same switch.
7c0fa775e,8faf23426):input quantization is not applied. The bf16 attention gate is a projection of its own.
LiquidAI/LFM3-1.7B-MLX-4bit(revisiond0ca73dc) as stored: every projection and the tied head asaffine-4 tiles, prompt chunks on the affine prompt GEMM, decode rows on the verify tiles.
d986410d1): the recipe's table of the three exports. The float64 receipts are main'stools/lfm3/REF64.md.82cb493d8):docs/receipts/lfm-cuda-sass-fad7e142/regenerated against maine7e24243d.No kernel changes, and no file outside
families/lfm3, the XPU refusal test and the docs. Liquid's shared backendand LFM2.5 are #1508's, unchanged.
Verification (GB10, sm_121, real weights, on this head)
test-lfm3-xpu-refusal-hostopens a folder holding only the FP8 export'sconfig.jsonthroughnative/xpu.zig'sopenand expectsLfm3Fp8BlockNotOnXpu. With the FP8 arm removed (.xpu => {}) it goes redwith "cannot open the Level Zero driver (LoaderUnavailable)", so nothing past the config is read or queued before
the refusal. The config test names all four refusals. The Metal open is lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's, unchanged; its FP8 refusal is
covered at the config level, not re-run on a Mac.
3551fd822(neither main nor lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508 serves them onCUDA), 8 chats x 4 turns, full replies (reasoning and content):
(
TENSORFOLD_LFM3_KV_PAGES=0);window) == solo; drafted == plain; a restart gives the same hashes;
0fa0fa122, and LFM2.5 against maine7e24243d: the same checks, everyreply equal.
docs/receipts/lfm-cuda-sass-fad7e142/, maine7e24243dagainst this code head042028b62,nvcc 13.0 and 13.2, sm_80/86/89/120/121:
prefill_attention70 of 70 identical (+5, lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508'spattn_kernel<128, 8, 4, 8>),contract_controls450 of 450 (+15, lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's three controls). A first nvcc 13.0 runsaw main's own
tf_ctl_moe_router_tiles_rowflap on sm_80, as lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's runs did; the rerun and 13.2 show itidentical. The README says so.
above is this PR's planted check.
82cb493d8):zig build -Dfixed-cpu test-host(19578 passed, 132 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 (run under umask 022: under the runner's umask 002,cli_config_testfails on main too). On the GB10:test-cuda-host,compile-cuda-tests, the Liquid, LFM3,LFM2.5 and XPU refusal host tests. No pinned file changes (
gradient-serving.tsv,dense_serving_test.zig).Speed (GB10)
A-B-B-A, 4 servers an arm, the same 6 cold chats (10.4k tokens) on every server, paired medians.
3551fd822)3551fd822)0fa0fa122)e7e24243d)Two rows are paired losses, said plainly. Don't land yet until both are explained:
head's (589-592). NVFP4 against lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508 is level, so this most likely comes from the base this PR now sits on
(lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's shared backend), not from the FP8 code, but it isn't isolated: lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508 can't serve FP8. Don't land yet
on this row's account if a served cell may not be slower.
code is byte-identical to this one's (this PR touches no Liquid or LFM2 file). Per-server medians overlap (head
1.323-1.354 s, main 1.318-1.353 s) and the arm medians are level (1.3305 against 1.3338 s), so we read it as noise
of this cell, but it showed in every run.
Proposed CHANGELOG line
- LFM3-1.7B FP8 (block, weight-only) and MLX 4-bit (as stored) served on CUDA; Metal and XPU refuse the FP8 export by name (#1634, after #1508)Licence
The weights are under Liquid AI's LFM Open License v1.0 (
license: other,lfm1.0), as the NVFP4 and MLX exportsare.