Repository navigation
kolibri1: serve Kolibri 1.1 (kolibri1_1) on CUDA up to 2,048 tokens, exact - #4941
Conversation
|
I checked In my trial I kept main's copies, dropped the incoming duplicate test file and moved the existing ring-size fixture into zig build test-kolibri-host check-native-cuda-host -Dfixed-cpu -j2 --summary allOn M5 Max this passed 31 tests with one skip, and the native adapter cross-compiled for aarch64 Linux. The checkpoint-backed serving comparisons remain the author's device results. Igor Lessio - AIFLOW LABS |
|
Thanks, @jschmied. The 2,048-token cap, separate CUDA aliases and shared-cache ownership are clear. The posted checkpoint checks are useful; the supplied paged-results section is cut off. One bound needs fixing: the parser accepts wider dense MLPs, while activation scratch still uses the routed width. The pinned 3,584-wide shape fits, but an accepted 3,712-wide shape can overrun it. Please size for both paths or refuse the unsupported width before launch, with a boundary check.
|
|
Thanks @ashhart. Both points are addressed on
|
|
Thank you for the quick fix and the complete paged-results section. The activation scratch now covers both the routed/shared-expert width and any accepted dense width, with the 3,584 and 3,712 boundary cases in place. The pinned configuration keeps the same allocation size. The complete 29 paged comparisons also answer the earlier evidence request. One memory-planning case still needs a correction. During After that fix, the remaining gate is to rerun the checkpoint-backed reference, window, and paged-versus-linear comparisons on the final integrated tree. Those runs must retain byte-equal replies and logits, the expected cached counts, and the 2,048-token admission boundary; 2,049 must still refuse by name. We will preserve the newer staging split and keep one copy of each test during integration; no rebase is needed from you.
|
|
Thanks @ashhart. Fixed on
I didn't rebase; the PR body is updated. |
|
Thank you, @jschmied. The dense-slot fix is confirmed: planning now counts both dense layers once, so the two 8,192-row buffers total 65,536 bytes rather than 131,072. The activation scratch now covers the wider dense shape while preserving the pinned 3,584-wide allocation. Shared-KV ownership and the 2,048-token ceiling remain consistent. The supplied final-head results are also clear: all 29 paged-versus-linear replies and logits are byte-equal, and the reference, window, serving, resume, admission and Kolibri-1 regression checks passed. One current-main test assertion now needs updating in CHANGES REQUESTED for that host-test correction. The
|
|
Thanks @ashhart. Fixed on I verified it on a local merge of
The PR body has a new section, "On the integrated tree", with these results and the binaries' md5s. |
2d7c7ae to
a110196
Compare
|
Thanks, @jschmied. The configuration validation, shared-cache handling, dense scratch sizing, and reference coverage are carefully worked through. One integration gap remains: Kolibri 1.1 is accepted by the CUDA opener but is not exposed through the family registry used by capabilities, model information, and managed benchmarks, so those commands still report it as unsupported. Please expose every CUDA alias through that registry and add a regression check.
|
|
Done on
|
|
Thanks, @jschmied. The final registry update closes the remaining integration gap: every CUDA-only alias is now exported with its family's formats and decision formats, exact-first dispatch is preserved, and the new host regression observes the same family list used by capabilities, model information, and managed benchmarks. The earlier activation-scratch, dense-planning, Transcribe-assertion, staging-split, shared-KV, and integrated-tree checks also remain addressed. Static re-review of supplied head This looks ready to land. Landings are paused while we cut 1.3.6; it goes into the first trains after the release.
|
|
Thanks. One heads-up before it lands: a numerics difference to the publisher's reference that I found after the last push. The Transformers I have the codec and its wiring on a separate branch, with a device-vs-host bit-exact test and planted controls passing. The forced-answer and needle comparisons against the reference run tonight; I'll post the numbers here tomorrow. Then it's your call: fold the rounding into #4941 before it lands, or land #4941 as is and take NVFP4 as the next slice. |
…s cache, the 2,184-key cap
…s, layers on another's cache, a 2,184-token window
…se MLP) in float64
…es, after every exact model_type)
…ted whatever the scores
… test at 3,584 and 3,712-wide dense layers
… routed experts and shared expert
…an test for the two dense layers
… them (a planned address is 0, no sentinel)
…s exact model_type); the alias test expects it
…is listed for capabilities, model info and benchmarks
…mats, so capabilities, model info and benchmarks name it
96f84ad to
1e117f7
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. |
Refs #4846
Head:
96f84adb10: your rebasea110196a46plus every CUDA alias in the family registry (below). Capabilities,model information and managed benchmarks read
native.families; it listedkolibri1but notkolibri1_1, which theopener already took. Full CI set on
96f84adb10(x86): ci (27,791 of 27,969 tests pass, 178 skipped), cuda-host,pr-check, fmt, diff-check and lean all rc 0; lean 0 new.
Before that, head
2d7c7aebf6:6e2e027eb3plus the alias test's expectation for main'snemo_speechlmfamily (test only). The GPUevidence below (reference, window, engine paths, paged == linear, served, edge, refusals) ran on
6e2e027eb3's binaries,and again on a local merge of this head with main (see "On the integrated tree").
27f2af9a7d+6e2e027eb3make the dense layers' slot-id and weight buffers once(
Model.denseSlots, a host boolean; during planning every address is 0, so the old address sentinel counted them twiceon the pinned two-dense-layer shape: +65,536 bytes at 8,192 rows). Before that,
4ba7c6a133adds a config refusal (akolibri1 config with an
index_*key) and0c18466215+5b0358fde1size the activation scratch for dense layerswider than the routed experts (
Config.actWidth, the same bytes for the pinned 3,584 = (6 + 1) x 512).Kolibri 1.1 is Kolibri-1 continued with shared-KV sparse attention. This PR serves it through the existing
kolibri1family on CUDA up to the 2,048-token window where its sparse attention selects every key, so themodel is computed exactly without its indexer. Longer contexts (the indexer, the NVFP4 cache) are a later PR.
What changes
kolibri1_1configs: dense layers, layers on another layer's cache, the windowfamilies/kolibri1/config_v11.zig(new),config.zignames.zig,pack.zig,weights.zigqmmf.packBf16/modelopt.bf16Weightreused, unchanged)forward.zigforward.zig,kernels.zig(qOnlyover coreqk_rowswith no k heads),paging.zig,snap.zignative.zig(contextCeiling)index_*keys belong tokolibri1_1: refused by name on akolibri1configconfig.zigkolibri1_1opens thekolibri1familynative/cuda_alias.zig,native/cuda.zigcuda_also_model_typesalias is listed in the CUDA families (capabilities, model info, managed benchmarks), with its family's formats; host steptest-cuda-aliases-hostnative/cuda_families.zig,build/cuda_family_host.zigtests/cuda/kolibri_ref.zig,kolibri_layer_tests.zigNo kernel changes. No change to Kolibri-1's arithmetic (shown below).
Where each rule comes from
No other engine's code was read. Sources: the config at revision e9515166 (pinned in
config_v11.zig), themodel card at that revision, the checkpoint's
model.safetensors.index.json(tensor census), and our float64 reference.layer_types,sliding_window; card "Sliding window: 512 preceding tokens plus the current token"mlp_only_layers,mlp_only_intermediate_size; census (mlp.gate_proj/up_proj/down_projwithweight_scale_inv, no router); card "2 dense layers followed by 48 MoE layers"modules_to_not_convert; census (noweight_scale_invon them)kv_source_layers; census (exactly these six lackk_proj,v_proj,k_norm); card "several layers reuse the keys and values of an earlier layer"q_proj,q_normpresent on all 50 layers)norm_topk_prob: false)index_topk: 2048; card "each query attends to 2,048 selected keys". With at most 2,048 keys a query attends all of them, whatever the selection scores, so the dense computation is the model's. Past 2,048 the indexer decides (the config's 128 local + 8 sink keys may or may not count inside the 2,048); that is not settled, so the window stops at 2,048.tokenizer.json,tokenizer_config.jsonidenticalThe shared change:
native/cuda.zigdispatchCUDA opened a family only by its own
model_type.also_model_typesexists but is HIP's list, andnemotron.nativeputsnemotron_h_omniandnemo_speechlmin it. Honouring that list on CUDA would have sentBolt omni checkpoints to
nemotron_h(registry order) instead ofnemotron.omni, and openednemo_speechlmnewly. So the dispatch is now: every exact
model_typefirst, then a CUDA-onlycuda_also_model_types, whichonly
kolibri1declares (kolibri1_1).native/cuda_alias.zigtests:kolibri1_1openskolibri1;nemotron_h_omniopensnemotron.omni;nemo_speechlmopens its own family (main registers it as Transcribe's exactmodel_type; on this branch's old basethat line expects what main has, so it is checked on the merge); and for every registered family, its
model_typeand every HIP alias openexactly where the old exact-only dispatch opened them. No nemotron checkpoint is on this box, so nemotron is
covered by that host test and not by a served run.
On the integrated tree
A local merge of
2d7c7aebf6with main84d9b6ba13(not pushed;forward.zigkeeps main's staging split and testfiles, one copy of each test: the ring and dense-slot tests in
forward_test.zig). Binariestensorfold-nativef3a918df08fe70b460ff39ae7666e34f,tf-cuda-test8c3fa019c73fe85518bae47707ce1a05:TENSORFOLD_KOLIBRI_GRAPHS=0), the served run on each: every reply hash equal (16 greedy,16 seeded, 9 multi-turn resumed and 9 fresh, 3 + 3 shared-prefix), greedy hash
62c70a2000e190a6on both. The runincludes c=4 and c=8 decode rounds and copy-drafted windows (multi-row decode) over Kolibri 1.1's layers that read
another layer's cache; on each server c=4, c=8 and drafts equal the solo replies.
reaches key 0), engine paths, paged == linear 29 of 29
same, served and the window's edge (2,048 admitted, 2,049refused by name), all rc 0.
pr-check, fmt, diff-check and lean all rc 0; lean 0 new (152 on main, 152 on the merge). The two
cuda_alias.zigtests pass on the merge; with the old
noneexpectation put back, the first fails ("found nemo_speechlm"), so theassertion is the one main needs.
Evidence (GB10, sm_121, nvcc 13.0)
Binaries (
6e2e027eb3):tensorfold-native01800e368283541b47682a1c1b460c9b,tf-cuda-testb52023c6d75fa1b0afce5a1d7f365951.Float64 reference (
tf-cuda-test kolibri-reference, layer 0 + head from the checkpoint's tensors):Worst 0.14 % of the scale (the gate is 0.3 %: a dropped routing bias or swapped scale moves it past 0.7 %).
Window and reach (
kolibri-layers, this head's binary): the window holds exactly 513 keys (key 512 back moves the last row,513 back does not, prompt and decode rows); layer 4 (indexed, no RoPE) reaches key 0.
Engine paths (
kolibri-full, 128 tokens, this head's binary): steps, drafted, sampled, four streams in shared rounds, prompt cuts(1,000 / 1,536 / 2,048-row chunks) and kept states at 2,048 / 3,001 / 4,096 equal the plain rows. These test runs
pass the 2,048 window on purpose (they bypass the server): they show the engine's paths agree, not the model's
behaviour there.
Paged == linear (
kolibri-pages, this head's binary): full layers in shuffled pool pages against the linearcaches, 128 greedy tokens each, every comparison
same(29 of 29):PASS kolibri pages: the whole model ran, so the layers that read another layer's pages (kv_source_layers) are in it; endedstreams' pages reused.
Served (
tensorfold-native serve, prompts under 700 tokens, c=1/4/8):parity_controls:CONTROLS: PASS (4 prompts, seeds differ on 4). 16 prompts, 128 tokens:greedy twice equal, seeded twice equal, two seeds differ on 16 of 16 (control), copy drafts on == off (greedy
and seeded), c=4 and c=8 == solo (greedy; seeded at c=8), multi-turn resumed == fresh (6 cache hits, 0 on the
cache-off server), a second prompt sharing a 350-token prefix then the first again == fresh, 0 empty replies
(reasoning + content + token ids hashed). Greedy hash
62c70a2000e190a6.Served at the window's edge:
Four distinct prompts a cell, replies forced to their length (
ignore_eos). The one-token cell's reply is token127907 (the think opener, no text), checked by id. Resume at the edge: three two-turn chats whose second turn ends at
exactly 2,048 tokens, prompt cache on (844 / 1,038 / 1,034 tokens served from it) == a server with the cache off.
parity_controlson this server:CONTROLS: PASS (4 prompts, seeds differ on 4). Load line:serving Aleph-Alpha--Kolibri-1.1 ... context: 2048; loaded in 161.4s. 0 empty replies.Refusals:
--context 4096: the server stops before loading anything:tensorfold: --context 4096 exceeds this model's 2048-token window.kv pool idle: promised 0, free 40 + store 0 == total 40.Kolibri-1 unchanged against main (same prompts on this head and on its merge base with main,
42bbc8e35e):kolibri1serves Kolibri-1 the same: 16 prompts greedy and seeded, c=4, a 5,100-token prompt (no 2,048 capon Kolibri-1: both load with
context: 65536), multi-turn with the prompt cache (6 hits): every reply hash equal,0 empty. Greedy hash
4e23df96b30cf88d.Throughput (absolute, for information; no A/B and no noise-floor verdict, since main can't serve Kolibri 1.1 and this PR makes no speed claim): decode 39.4 tok/s at c=1 ending at 2,000 tokens, 38.9 tok/s ending at 2,048; a cold 1,804-token prompt's first
token in 0.84-0.85 s (3 prompts, never seen before).
Host:
zig build test-kolibri-host check-native-cuda-host compile-cuda-testsandzig fmt --checkon x86:pass on
2e5e940f89(kol11-a2-x86, 21/21 steps) and on4ba7c6a133(kol11-a3-x86, 21/21 steps, 30 tests and 1 skip).Full CI set on
6e2e027eb3(kol11-a6-x86b: ci, serving pins, cuda-host, pr-check, fmt, diff-check, lean all rc=0;zig build ci12,644 of 12,738 tests pass, 94 skipped). Lean check: 0 new problems (165 on the base, 165 here).Tests that fail before this PR
config_v11.zig: parsing the pinned 1.1 config (model_typekolibri1_1was refused) and its refusals, including akolibri1config carryingindex_layers(it parsed before4ba7c6a133).config_v11.zig"kolibri1_1 activation scratch: 3,584-wide dense layers fit, a 3,712-wide one is sized for": failson
0c18466215(scratch from the routed width alone), passes on5b0358fde1; its control line checks that the routedwidth alone is narrower than 3,712.
forward_test.zig"kolibri1_1 plan: the two dense layers count their slot ids and weights once (8,192 rows: 65,536bytes)": exact planned bytes; fails on
27f2af9a7d(the old sentinel:expected 65536, found 131072), passes on6e2e027eb3.names.zig"kolibri1_1: bf16 attention, a dense layer's MLP alone, no k, v or k_norm ...".native.zig"the window: Kolibri 1.1 up to its 2,048 selected keys ...".native/cuda_alias.zig(both tests; thenemo_speechlmline against main's registry).native/cuda_families.zig"CUDA aliases: each is listed for capabilities, model info and benchmarks ...": fails ond74e462d3e(error.AliasNotListed), passes on96f84adb10(test-cuda-aliases-host, withtest-kolibri-host).kolibri1_1("no backend") before.Not in this PR
indexed layers, sharing of selections. Next PR, built on a generic core indexer.
kolibri1incore/profile.zig(TF_KV_SHARE,TENSORFOLD_KOLIBRI_KV_PAGES) keeptheir scope; they are not claimed for
kolibri1_1.Proposed CHANGELOG line (Unreleased, Added):
- CUDA: Kolibri 1.1 (kolibri1_1) through the kolibri1 family, exact up to a 2,048-token window; longer contexts refused by name (#4941).