Repository navigation
Conversation
…ost, equal to its Python within fp32 rounding
…ine's final rows; the Qwen 27B CUDA family gives them
…ies in encoder order
… block, and its attention split by query rows across threads; bits unchanged
|
For the Qwen3.8-27B Clef: its runtime adapter (#1364) loads Clef as a LoRA on the base checkpoint. Cloudflare publishes Clef only as merged weights, so the extracted adapter (rank-256, layers 40–63; base + adapter vs the merged release: mean KL 3.9e-7, top choice 100%) plus Cloudflare's joint head files is published at unigilby/Qwen3.8-27B-clef-adapter (Apache-2.0). Clef-Flash itself (this PR) needs nothing extra: it loads Cloudflare/clef-flash as released. |
ashhart
left a comment
There was a problem hiding this comment.
Thanks @gilby. --clef is off by default and /v1/systemone is unchanged without it, which is right. Before device runs:
- The port of Cloudflare's code (
clef_encode.zig,clef_head.zig,clef_serve.zig, the verbatim system prompt) needs a THIRD_PARTY_NOTICES entry for its Apache-2.0 source. - With
--clefon,hiddenFnruns a decision's whole prompt (up to 16k rows) in one go on the engine thread, which stalls every chat stream for seconds (about 6 s on the 9B). Please step it onemax_rowspiece per round like other prompt work. E.Cache.initper decision allocates outside the memory budget; reserve it at startup.- The refusal text names Qwen3.8-27B, but the engine is the qwen3_5 CUDA family.
- Please add a CI-runnable test of the head (a tiny synthetic golden) and of the "bits unchanged across threads" claim (1 vs N threads).
…s the qwen3_5 CUDA family
…pass, on a cache reserved at startup
…vs 4 head threads bit-equal, in CI
|
Thanks for the review. All five points are addressed in three new commits on top of the old head (
Gates on this head (one DGX Spark, GB10, CUDA 13.0,
The 27B through #1364 (rebased on this head) also passes: see there. |
|
Review of the Clef set (#1361, #1364, #1366, #1372) against main e9b69ed. Thank you, @gilby: Clef on
|
|
Thanks @gilby for Clef on /v1/systemone. We're closing this for now, as our 26 Oct review hasn't had a reply. Please reopen it once the head reader uses the shared bounded safetensors reader and decision prompts join the shared rounds. |
Fixes #1360.
--clef DIRserves Cloudflare Clef decisions on/v1/systemone: the record encoded as Cloudflare'sencode_recorddoes, the engine's final rows for the prompt, and Clef's joint schema head on the host. DIR holds the release'sjoint_head.safetensorsandjoint_head_config.json, andlm_head_rows.safetensors(the backbone's output embedding, which the head reads for each option's lexical prior).Commits
--clef DIRanswers/v1/systemonethrough Clef's head: ahiddenengine call returns every prompt row's final normed hidden state; the lane host queues it like the decision calls; the Qwen3.5 CUDA family implements it. Chat is untouched when the flag is absent."raw": true: each question's unrounded option probabilities in encoder order, for gates.dotas before, so the bits are unchanged; 1.4–1.9× faster decisions.hidden(prompt, out, at)returns the next row; the score queue runs one piece of the oldest decision per pass and goes back to chat rounds. The decision cache (16,384 rows) is created in the family'sopen, inside the memory budget.tools/clef_tiny_golden.pywriteszig/src/server/fixtures/clef_tiny.jsonfrom Cloudflare's own code;clef_test.zigchecks logits within 1e-4 and 1 vs 4 threads bit-identical.Receipts (one DGX Spark, GB10 128 GB, driver 580, CUDA 13.0;
Cloudflare/clef-flashbf16)The checkpoint loads unchanged with
"quantization_config": {"quant_method": "compressed-tensors"}added to itsconfig.json(no packed or scaled weights, so every projection is bf16). Plain bf16 loading is #1137's.Fidelity vs Cloudflare's own bf16 pipeline (
load_release_model, transformers 5.10.2) on 60 records / 557 questions: mean KL 5.7e-5 (max 2.4e-3), top choice 99.64%. ≤1K 95.5% (1 of 22), 1–4K 100%, 4–10K 99.6%, >10K 100%.Exactness: 4 concurrent requests return exactly one-at-a-time probabilities for all 60 records;
bench_concurrent --tokens 128 --reps 3 --temperatures 0 --levels 1,4 --alone --serial: 0 unequal, 0 failed.Latency, one request at a time, prompt cache off, p50 / p95:
A cold 16K prompt pass alone takes 6.0 s (~2,660 tok/s); the rest of a 16K decision is the host head.
Chat during a decision (commit 6): a greedy chat stream's longest gap between tokens while one 16,384-token decision runs: 6.31 s before, 1.69 s now (one 4,096-row piece); median gap 69–71 ms either way, 70 ms with no decision. Decisions are unchanged (60/60 records equal, KL and top choice as above, re-run on the head).
zig build test --summary all(macOS): 500/500 steps, including the tiny-head golden and the 1 vs 4 threads test.zig fmtclean;lean_check.pyadds no problems overmain. ATC overlap: no textual conflicts added against open PRs (qwen27: a JointHead side-head scores options on post-norm hidden rows at their final-token positions #1191, lanes: a queued decision takes a free slot beside the live streams, as a new stream's prompt pass would #1192 and qwen27: TF_Q27_PROFILE logs the round's class GPU times, and replies carry gpu_seconds #1215 also touchsystemone.zigandcli.zig).The 27B
Cloudflare/clefneeds its adapter at runtime rather than merged into 4-bit weights (see #1360); not in this PR.