Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
KV_TQ: refuse row widths >512 (consumer staging buffers); kv8_sanitize_row: refuse negative scale
recvikingc24049298bc9
diff --git a/c/colibri.c b/c/colibri.cindex 62545dd2..20ed3c77 100644--- a/c/colibri.c+++ b/c/colibri.c@@ -10736,6 +10736,15 @@ int main(int argc, char **argv){"constraint).\n", kl, kr);return 2;}+ /* The attention consumers stage dequantized/rotated rows in 512-wide+ * stack buffers (qtl/qtr, Lf/Rf); a wider power-of-two row would pass+ * the check above and overflow them. Same refuse-don't-corrupt rule. */+ if(kl>512||kr>512){+ fprintf(stderr,"[KV_TQ] this model's latent rows are kv_lora=%d qk_rope=%d, but the "+ "quantized-KV attention path stages rows in 512-wide buffers. Refusing to run "+ "quantized -- unset KV_TQ (or use KV8=1, which has no width constraint).\n", kl, kr);+ return 2;+ }}if(!g_direct_heat_explicit){ /* COLI_DISKCLASS_WINDOW default, needs m.c (topk/n_layers) *//* CURRENT-STATE CALIBRATION: the "8" multiplier (recency window ~= the last 8diff --git a/c/kv_persist.h b/c/kv_persist.hindex 65c25437..2ad5ffb7 100644--- a/c/kv_persist.h+++ b/c/kv_persist.h@@ -124,7 +124,9 @@ static void kv_disk_append(Model *m, const int *hist, int len){/* Bonifica una riga fp8 letta da disco: l'encoder non emette MAI i codici NaN e4m3* (0x7F/0xFF), ma un file corrotto potrebbe — la GPU (__nv_cvt) li decodifica NaN. */static inline void kv8_sanitize_row(uint8_t *b, int n, float *sc){- if(!(fabsf(*sc)<3.4e38f)){ memset(b,0,(size_t)n); *sc=1.f; return; }+ /* l'encoder emette solo scale > 0: una scala negativa (file corrotto)+ * invertirebbe il segno dell'intera riga -- riga inerte, come il gemello TQ */+ if(!(*sc>0.f && *sc<3.4e38f)){ memset(b,0,(size_t)n); *sc=1.f; return; }for(int i=0;i<n;i++) if((b[i]&0x7F)==0x7F) b[i]=0;}/* v3: raggio non finito o negativo -> riga inerte (coli_kvq_dequant_row rende zero). */