Run frontier MoE models on hardware you already own β pure C, zero deps, experts streamed from disk. Tiny engine, immense model. π¦
C
Merge dev into feat/qwen38-flash-next
JustVuggeabd5696f27f
diff --cc .github/workflows/ci.ymlindex 54f4f57c,9742e195..2b02fb44--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@@ -190,7 -190,7 +190,7 @@@ jobsrun: |cd crc=0- ENGINES="colibri inkling kimi_k3 olmoe qwen36 qwen38"- ENGINES="colibri glm53 inkling kimi_k3 olmoe qwen36"++ ENGINES="colibri glm53 inkling kimi_k3 olmoe qwen36 qwen38"if [ "${{ matrix.v4 }}" = "1" ]; then ENGINES="$ENGINES deepseek-v4"; fifor t in $ENGINES; doecho "::group::$t"diff --cc .github/workflows/release.ymlindex 24d87136,a38a3cc1..23bab690--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@@ -60,10 -62,10 +60,10 @@@ jobs- name: Build enginesrun: |cd c- for t in colibri inkling kimi_k3 olmoe qwen36 qwen38; do- for t in colibri glm53 inkling kimi_k3 olmoe qwen36; do++ for t in colibri glm53 inkling kimi_k3 olmoe qwen36 qwen38; domake $t ${{ matrix.make_args }}done- ls -lh colibri${{ matrix.ext }} inkling${{ matrix.ext }} kimi_k3${{ matrix.ext }} olmoe${{ matrix.ext }} qwen36${{ matrix.ext }} qwen38${{ matrix.ext }}- ls -lh colibri${{ matrix.ext }} glm53${{ matrix.ext }} inkling${{ matrix.ext }} kimi_k3${{ matrix.ext }} olmoe${{ matrix.ext }} qwen36${{ matrix.ext }}++ ls -lh colibri${{ matrix.ext }} glm53${{ matrix.ext }} inkling${{ matrix.ext }} kimi_k3${{ matrix.ext }} olmoe${{ matrix.ext }} qwen36${{ matrix.ext }} qwen38${{ matrix.ext }}# DeepSeek V4 has its own Makefile and its own target name (`deepseek-v4`,# producing `deepseek_v4`), so it never joined the loop above -- and #858 isdiff --cc README.mdindex b5b6188b,61d70dde..a1dc96a4--- a/README.md+++ b/README.md@@@ -18,9 -18,9 +18,10 @@@ parameters** β on consumer and heteroengine dependencies, by treating storage, RAM, and VRAM as a single inferencehierarchy (AI memory multitiering).- Seven families run today: **GLM-5.2** (744B), **Inkling** (975B), **Kimi K3**- (2.8T), **DeepSeek V4 Flash** (284B), **Qwen3.8-Flash-Next**- (125B + 51B n-gram), **Qwen3.6** (35B-A3B) and **OLMoE** (7B) β-Seven families run today: **GLM-5.2** (744B), **GLM-5.3-Flash** (321B, with++Eight families run today: **GLM-5.2** (744B), **GLM-5.3-Flash** (321B, with+ vision), **Inkling** (975B), **Kimi K3** (2.8T), **DeepSeek V4 Flash** (284B),-**Qwen3.6** (35B-A3B) and **OLMoE** (7B) β++**Qwen3.8-Flash-Next** (125B + 51B n-gram), **Qwen3.6** (35B-A3B) and++**OLMoE** (7B) βone C file each, the same `coli chat` / `coli serve` / `coli web` front end.[Full roster β](#other-supported-models)@@@ -419,9 -419,9 +421,10 @@@ the model's `config.json`)|---|---|---|---|---|| **GLM-5.2** | 744B / 40B | [`mastouri/β¦-int4-g64-with-int8-mtp`](https://huggingface.co/mastouri/GLM-5.2-colibri-int4-g64-with-int8-mtp) (372 GB) | `make -C c glm` | this page || **Inkling** (Thinking Machines) | 975B / 41B | [`nbeerbower/Inkling-colibri-int4`](https://huggingface.co/nbeerbower/Inkling-colibri-int4) (469 GB) | `make -C c inkling` | [inkling.md](docs/inkling.md) |+ | **GLM-5.3-Flash** (Z.ai) | 321B / 40B | [`zai-org/GLM-5.3-Flash`](https://huggingface.co/zai-org/GLM-5.3-Flash) β converted to **int4-gs64** routed experts, dense stays BF16 and the precision is a load-time choice; vision included | `make -C c glm53` | [glm53-flash.md](docs/glm53-flash.md) || **Kimi K3** (Moonshot) | 2.8T / 104B | [`moonshotai/Kimi-K3`](https://huggingface.co/moonshotai/Kimi-K3) β original checkpoint, routed experts stay **native MXFP4** | `make -C c kimi_k3` | [kimi_k3.md](docs/kimi_k3.md) || **DeepSeek V4 Flash** | 284B / 13B | official sharded checkpoint β routed experts stay **native fp4**, dense stays fp8-e4m3 | `make -C c deepseek-v4` | [deepseek-v4.md](docs/deepseek-v4.md) |+| **Qwen3.8-Flash-Next** (Alibaba) | 125B + 51B n-gram / 6B | [`Qwen/Qwen3.8-Flash-Next-FP8`](https://huggingface.co/Qwen/Qwen3.8-Flash-Next-FP8) β original checkpoint; PLE stays pageable and experts stay **native block-FP8** | `make -C c qwen38` (CPU only) | [qwen38.md](docs/qwen38.md) || **Qwen3.6** (Alibaba) | 35B / 3B | [`Kreuzzelg/qwen36-35b-a3b-colibri-i4-gs64`](https://huggingface.co/Kreuzzelg/qwen36-35b-a3b-colibri-i4-gs64) (~20 GB, **recommended**) β hybrid Gated Attention + Gated DeltaNet | `make -C c qwen36` (`CUDA=1` for the VRAM expert tier) | [qwen36.md](docs/qwen36.md) || **OLMoE** (AI2) | 7B / 1B | converted with `c/tools/convert_olmoe_merged.py` β **int8** container, ~7 GB | `make -C c olmoe` | β |diff --cc c/Makefileindex 9d7c165b,337f9f08..762900f2--- a/c/Makefile+++ b/c/Makefile@@@ -1453,9 -1441,9 +1487,10 @@@ segment-adapters-real: tests/test_segme@test -n "$(KIMI_SEGMENT_MODEL)" || { echo "set KIMI_SEGMENT_MODEL" >&2; exit 2; }@test -n "$(OLMOE_SEGMENT_MODEL)" || { echo "set OLMOE_SEGMENT_MODEL" >&2; exit 2; }@test -n "$(QWEN_SEGMENT_MODEL)" || { echo "set QWEN_SEGMENT_MODEL" >&2; exit 2; }+ @test -n "$(QWEN38_SEGMENT_MODEL)" || { echo "set QWEN38_SEGMENT_MODEL" >&2; exit 2; }@test -n "$(DEEPSEEK_SEGMENT_MODEL)" || { echo "set DEEPSEEK_SEGMENT_MODEL" >&2; exit 2; }OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_segment_adapters_real$(EXE) glm "$(GLM_SEGMENT_MODEL)" 0 3 5 8+ GLM53_BITS=32 OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_segment_adapters_real$(EXE) glm53 "$(GLM53_SEGMENT_MODEL)" 0 2 4 16OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_segment_adapters_real$(EXE) inkling "$(INKLING_SEGMENT_MODEL)" 0 4 8 8COLI_RAM_OVERCOMMIT=1 OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_segment_adapters_real$(EXE) kimi "$(KIMI_SEGMENT_MODEL)" 0 3 6 8OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_segment_adapters_real$(EXE) olmoe "$(OLMOE_SEGMENT_MODEL)" 0 2 4 8@@@ -1474,9 -1461,9 +1510,10 @@@ edge-adapters-real: tests/test_edge_ada@test -n "$(KIMI_EDGE_MODEL)" && test -n "$(KIMI_EDGE_REF)" || { echo "set KIMI_EDGE_MODEL and KIMI_EDGE_REF" >&2; exit 2; }@test -n "$(OLMOE_EDGE_MODEL)" && test -n "$(OLMOE_EDGE_REF)" || { echo "set OLMOE_EDGE_MODEL and OLMOE_EDGE_REF" >&2; exit 2; }@test -n "$(QWEN_EDGE_MODEL)" && test -n "$(QWEN_EDGE_REF)" || { echo "set QWEN_EDGE_MODEL and QWEN_EDGE_REF" >&2; exit 2; }+ @test -n "$(QWEN38_EDGE_MODEL)" && test -n "$(QWEN38_EDGE_REF)" || { echo "set QWEN38_EDGE_MODEL and QWEN38_EDGE_REF" >&2; exit 2; }@test -n "$(DEEPSEEK_EDGE_MODEL)" && test -n "$(DEEPSEEK_EDGE_REF)" || { echo "set DEEPSEEK_EDGE_MODEL and DEEPSEEK_EDGE_REF" >&2; exit 2; }GLM_SEGMENT_EBITS=16 GLM_SEGMENT_DBITS=16 OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_edge_adapters_real$(EXE) glm "$(GLM_EDGE_MODEL)" "$(GLM_EDGE_REF)" 3+ GLM53_BITS=32 OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_edge_adapters_real$(EXE) glm53 "$(GLM53_EDGE_MODEL)" "$(GLM53_EDGE_REF)" 3INK_SEGMENT_BITS=0 OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_edge_adapters_real$(EXE) inkling "$(INKLING_EDGE_MODEL)" "$(INKLING_EDGE_REF)" 3COLI_RAM_OVERCOMMIT=1 K3_BITS=32 K3_MLA_BITS=32 K3_HEAD_BITS=32 K3_IDOT=0 OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_edge_adapters_real$(EXE) kimi "$(KIMI_EDGE_MODEL)" "$(KIMI_EDGE_REF)" 3OMP_NUM_THREADS=$${OMP_NUM_THREADS:-2} ./tests/test_edge_adapters_real$(EXE) olmoe "$(OLMOE_EDGE_MODEL)" "$(OLMOE_EDGE_REF)" 3@@@ -1723,7 -1711,7 +1762,7 @@@ check$(MAKE) portable$(MAKE) test- install: colibri$(EXE) inkling$(EXE) kimi_k3$(EXE) olmoe$(EXE) qwen36$(EXE) qwen38$(EXE) \-install: colibri$(EXE) glm53$(EXE) inkling$(EXE) kimi_k3$(EXE) olmoe$(EXE) qwen36$(EXE) \++install: colibri$(EXE) glm53$(EXE) inkling$(EXE) kimi_k3$(EXE) olmoe$(EXE) qwen36$(EXE) qwen38$(EXE) \$(if $(filter 1,$(COLI_V4_SUPPORTED)),deepseek-v4,)$(INSTALL) -d $(DESTDIR)$(BINDIR)$(INSTALL) -d $(DESTDIR)$(LIBEXECDIR)diff --cc c/family_registry.pyindex c24d1a43,d1000a67..f96ebed4--- a/c/family_registry.py+++ b/c/family_registry.py@@@ -73,7 -72,11 +73,12 @@@ class FamilyDescriptorconfig_section: strlimits: FamilyLimitscapabilities: FamilyCapabilities+ resident_inventory: object = None+ # Quanto pesano in RAM i pesi densi rispetto a come stanno su disco.+ # Vale 1.0 per chi li carica cosi' come sono; un motore che li riquantizza+ # a load time pesa meno, e senza questo il pianificatore direbbe che il+ # modello non ci sta quando invece ci sta.+ dense_load_ratio: object = None # callable(bytes_su_disco) -> bytes in RAMhas_gateway_adapter: bool = Falsehas_cli_adapter: bool = Falsetune_prompt_template: str = "{prompt}"diff --cc c/openai_server.pyindex 7f99ab7e,4603f130..5997022d--- a/c/openai_server.py+++ b/c/openai_server.py@@@ -1449,9 -1606,9 +1680,10 @@@ def render_chat_for_arch(messages, enabif ARCH == "inkling":return render_chat_inkling(messages, enable_thinking, reasoning_effort, tools,tool_choice, audio_out=audio_out)- renderer = (render_chat_kimi if ARCH == "kimi" else+ renderer = (render_chat_glm53 if ARCH == "glm53" else+ render_chat_kimi if ARCH == "kimi" elserender_chat_qwen if ARCH == "qwen36" else+ render_chat_qwen38 if ARCH == "qwen38" elserender_chat_v4 if ARCH == "deepseek_v4" elserender_chat_olmoe if ARCH == "olmoe" else render_chat)return renderer(messages, enable_thinking, reasoning_effort, tools, tool_choice)@@@ -2182,7 -2344,7 +2425,8 @@@ class Enginefamily = (resolve_model(model).descriptor if config.exists()else family_by_id(ARCH))arch = family.id+ self.family = family+ self.model_dir = str(model)child_env = dict(env or os.environ, SNAP=str(model), SERVE="1", SERVE_BATCH="1",NGEN=str(max_tokens), KV_SLOTS=str(kv_slots))tune_child_env(child_env, arch)diff --cc c/resource_plan.pyindex c80b1cbe,ac409b6a..3050d7ec--- a/c/resource_plan.py+++ b/c/resource_plan.py@@@ -25,9 -23,24 +25,24 @@@ EXPERT_RE = re.compile(r"(?:model\.)?la# sidecar and self-invalidate on any change. Best-effort: any read/write failure falls# straight back to a full recompute (see analyze_model). Sits alongside .coli_usage/.coli_ssd._ANALYSIS_CACHE_NAME = ".coli_analysis.json"-_ANALYSIS_CACHE_VERSION = 1+_ANALYSIS_CACHE_VERSION = 7+ def _dense_in_ram(descriptor, on_disk_bytes):+ """I byte che i pesi densi occuperanno, non quelli che occupano sul disco.++ Coincidono per chi li carica come stanno; una famiglia che li riquantizza+ al caricamento lo dichiara nel registro. Un errore qui non e' cosmetico:+ e' la differenza fra dire a qualcuno che il modello ci sta e dirgli di no."""+ ratio = getattr(descriptor, "dense_load_ratio", None)+ if ratio is None:+ return on_disk_bytes+ try:+ return max(0, int(ratio(on_disk_bytes)))+ except Exception:+ return on_disk_bytes++def _analysis_signature(shards, config_path):parts = [f"v{_ANALYSIS_CACHE_VERSION}"]st = config_path.stat()@@@ -170,8 -165,11 +185,12 @@@ def analyze_model(model)"path": str(model),"shards": len(shards),"model_bytes": model_bytes,- "dense_bytes": dense_bytes,+ # Come pesano DAVVERO in RAM: un motore che riquantizza al caricamento+ # ne occupa meno di quanto ne occupino sul disco, e il pianificatore+ # serve a rispondere "ci sta?", non "quanto pesa il file".+ "dense_bytes": _dense_in_ram(resolved.descriptor, dense_bytes),+ "dense_disk_bytes": dense_bytes,+ "expert_fixed_bytes": expert_fixed_bytes,"expert_bytes": sum(expert_groups.values()),"expert_count": len(expert_groups),"expert_layers": len(per_layer),@@@ -1004,8 -1033,9 +1072,11 @@@ def build_plan(model, ram_gb=0, context"bottleneck_class": bottleneck_class,"projected_hit_rate": round(projected_hit, 4),"tune": tune,+ "next_actions": actions,- "decisions": [- {"target": "VRAM", "reason": "profile-ranked hot experts"},++ # Un motore solo-CPU non ha un tier VRAM: annunciarlo comunque fa++ # scrivere al piano una riga che nessuno puo' eseguire.+ "decisions": ([{"target": "VRAM", "reason": "profile-ranked hot experts"}]+ if resolved.descriptor.supports_accelerator else []) + [{"target": "RAM", "reason": "warm experts execute on CPU without quality loss"},{"target": "Disk", "reason": "immutable recovery source for cold experts"},],diff --cc c/tests/segment_conformance_fixtures.cindex bc17c1cc,020841c3..d197a565--- a/c/tests/segment_conformance_fixtures.c+++ b/c/tests/segment_conformance_fixtures.c@@@ -346,11 -346,11 +358,12 @@@ static int fixture_restore(void *sessio}DECLARE_OPEN_WRAPPER(glm, 0)- DECLARE_OPEN_WRAPPER(inkling, 1)- DECLARE_OPEN_WRAPPER(kimi, 2)- DECLARE_OPEN_WRAPPER(olmoe, 3)- DECLARE_OPEN_WRAPPER(qwen36, 4)- DECLARE_OPEN_WRAPPER(qwen38, 5)+ DECLARE_OPEN_WRAPPER(glm53, 1)+ DECLARE_OPEN_WRAPPER(inkling, 2)+ DECLARE_OPEN_WRAPPER(kimi, 3)+ DECLARE_OPEN_WRAPPER(olmoe, 4)+ DECLARE_OPEN_WRAPPER(qwen36, 5)++DECLARE_OPEN_WRAPPER(qwen38, 6)DECLARE_OPEN_WRAPPER(deepseek_v4, 6)#define FIXTURE_ADAPTER(name) \diff --cc c/tests/segment_conformance_manifest.jsonindex d0b59261,88f0fff0..08f95df0--- a/c/tests/segment_conformance_manifest.json+++ b/c/tests/segment_conformance_manifest.json@@@ -33,17 -77,17 +77,24 @@@{"family_id": "qwen36","state_schema": "fixture/qwen36-kv-deltanet-conv-v1",- "state_components": ["attention_kv", "deltanet_recurrent", "convolution_ring"],- "oracle": {"kind": "generated_tiny", "path": "tools/make_qwen36_tiny.py"},+ "state_components": [+ "attention_kv",+ "deltanet_recurrent",+ "convolution_ring"+ ],+ "oracle": {+ "kind": "generated_tiny",+ "path": "tools/make_qwen36_tiny.py"+ },"real_adapter_required": true},+ {+ "family_id": "qwen38",+ "state_schema": "fixture/qwen38-hyper-qsa-ple-v1",+ "state_components": ["hyper_residual", "deltanet_recurrent", "convolution_ring", "attention_kv", "sparse_indexer", "ple_hash_history"],+ "oracle": {"kind": "generated_tiny", "path": "tools/make_qwen38_tiny.py"},+ "real_adapter_required": true+ },{"family_id": "deepseek_v4","state_schema": "fixture/dsv4-mhc-compressed-v1",diff --cc c/tests/test_edge_adapters_real.cindex 8a3fe6c1,be9254ab..65cec44f--- a/c/tests/test_edge_adapters_real.c+++ b/c/tests/test_edge_adapters_real.c@@@ -52,9 -53,9 +53,10 @@@ static int register_all(void)coli_kimi_segment_adapter_register() ||coli_olmoe_segment_adapter_register() ||coli_qwen36_segment_adapter_register() ||+ coli_qwen38_segment_adapter_register() ||coli_deepseek_v4_segment_adapter_register() ||coli_glm_edge_adapter_register() ||+ coli_glm53_edge_adapter_register() ||coli_inkling_edge_adapter_register() ||coli_kimi_edge_adapter_register() ||coli_olmoe_edge_adapter_register() ||@@@ -116,15 -116,13 +118,17 @@@ int main(int argc, char **argv)"real adapter does not expose tokenization");REQUIRE(edge_cap.flags & COLI_EDGE_CAP_GREEDY,"real adapter does not expose the model head");+ REQUIRE(edge_cap.flags & COLI_EDGE_CAP_LOGITS,+ "real adapter does not expose final-head logits");- static const char tokenizer_probe[] = "edge";+ /* The Qwen3.8 math fixture has a deliberately tiny 64-row vocabulary.+ * Its fixture tokenizer can still round-trip ASCII punctuation, while the+ * larger family fixtures retain the more diagnostic multi-byte probe. */+ const char *tokenizer_probe=!strcmp(family,"qwen38")?"!":"edge";+ size_t tokenizer_probe_bytes=strlen(tokenizer_probe);size_t probe_count = 0, probe_bytes = 0;REQUIRE(coli_edge_tokenize(edge, tokenizer_probe,- sizeof(tokenizer_probe) - 1u,+ tokenizer_probe_bytes,NULL, 0, &probe_count,error, sizeof(error)) == 0 && probe_count,"tokenizer sizing pass failed");diff --cc c/tests/test_edge_adapters_registration.cindex 846a7eac,c4cd6916..0253cb51--- a/c/tests/test_edge_adapters_registration.c+++ b/c/tests/test_edge_adapters_registration.c@@@ -10,13 -11,11 +11,13 @@@ int main(void)assert(coli_kimi_edge_adapter_register() == 0);assert(coli_olmoe_edge_adapter_register() == 0);assert(coli_qwen36_edge_adapter_register() == 0);+ assert(coli_qwen38_edge_adapter_register() == 0);assert(coli_deepseek_v4_edge_adapter_register() == 0);-- assert(coli_edge_adapter_count() == 7);++ assert(coli_edge_adapter_count() == 8);static const char *expected[] = {- "glm", "inkling", "kimi", "olmoe", "qwen36", "qwen38",- "glm", "glm53", "inkling", "kimi", "olmoe", "qwen36", "deepseek_v4"++ "glm", "glm53", "inkling", "kimi", "olmoe", "qwen36", "qwen38",+ "deepseek_v4"};for (size_t item = 0; item < sizeof(expected) / sizeof(expected[0]); item++)assert(coli_edge_adapter_lookup(expected[item]) != NULL);diff --cc c/tests/test_segment_adapters_registration.cindex 9e318b76,54ee4bc6..66a12cf5--- a/c/tests/test_segment_adapters_registration.c+++ b/c/tests/test_segment_adapters_registration.c@@@ -10,12 -11,11 +11,12 @@@ int main(void)assert(coli_kimi_segment_adapter_register() == 0);assert(coli_olmoe_segment_adapter_register() == 0);assert(coli_qwen36_segment_adapter_register() == 0);+ assert(coli_qwen38_segment_adapter_register() == 0);assert(coli_deepseek_v4_segment_adapter_register() == 0);-- assert(coli_segment_adapter_count() == 7);++ assert(coli_segment_adapter_count() == 8);static const char *expected[] = {- "glm", "inkling", "kimi", "olmoe", "qwen36", "qwen38", "deepseek_v4"- "glm", "glm53", "inkling", "kimi", "olmoe", "qwen36", "deepseek_v4"++ "glm", "glm53", "inkling", "kimi", "olmoe", "qwen36", "qwen38", "deepseek_v4"};for (size_t item = 0; item < sizeof(expected) / sizeof(expected[0]); item++)assert(coli_segment_adapter_lookup(expected[item]) != NULL);diff --cc c/tests/test_segment_conformance.cindex 99da81d7,33c0fee9..9ee6c616--- a/c/tests/test_segment_conformance.c+++ b/c/tests/test_segment_conformance.c@@@ -5,7 -5,7 +5,7 @@@static int expected_family(const char *family_id) {static const char *const expected[] = {- "glm", "inkling", "kimi", "olmoe", "qwen36", "qwen38", "deepseek_v4",- "glm", "glm53", "inkling", "kimi", "olmoe", "qwen36", "deepseek_v4",++ "glm", "glm53", "inkling", "kimi", "olmoe", "qwen36", "qwen38", "deepseek_v4",};for (size_t i = 0; i < sizeof(expected) / sizeof(expected[0]); i++)if (strcmp(expected[i], family_id) == 0) return 1;@@@ -13,7 -13,7 +13,7 @@@}int main(void) {-- const size_t required_families = 7;++ const size_t required_families = 8;size_t count = coli_segment_conformance_fixture_count();if (count != required_families) {fprintf(stderr, "segment conformance requires %zu families, found %zu\n",