Skip to content

Run frontier MoE models on hardware you already own β€” pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

engine: keep the 107 KB GrDraft struct out of .data (binary -22%)

JustVugg388747aaa926
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index bdbc3a3a..59968985 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -37,6 +37,14 @@ jobs:
- name: make check
run: make -C c check
+ # The Windows engine as this branch builds it. Small, and it makes an
+ # antivirus false-positive report (#527) verifiable on a PR instead of
+ # only after a release is tagged and published.
+ - uses: actions/upload-artifact@v4
+ with:
+ name: colibri-windows-exe
+ path: c/colibri.exe
+
macos:
# clang; libomp for the threaded path (Makefile falls back to
# single-threaded automatically if it's ever missing).
diff --git a/c/colibri.c b/c/colibri.c
index 9b4e4445..bb24c831 100644
--- a/c/colibri.c
+++ b/c/colibri.c
@@ -645,7 +645,13 @@ typedef struct {
int on, armed, max;
uint64_t prop, acc;
} GrDraft;
-static GrDraft g_grd={.max=24}; /* process-level instance: PROMPT mode + run_serve keep using this */
+/* NO initializer: GrDraft is ~107 KB (Grammar's 1024 static rules + the walker), and any
+ * initializer β€” even `={.max=24}` β€” moves the whole struct from .bss into .data, writing
+ * 106,848 bytes of mostly zeros into every binary we ship (#527: the v1.1.0 Windows exe
+ * grew a 108 KB near-zero-entropy .data blob, which is also exactly the shape an antivirus
+ * ML heuristic reads as an unpacking buffer). Static storage is zero-initialized by the C
+ * standard; `max` is set in grammar_setup(), which runs before any read of it. */
+static GrDraft g_grd; /* process-level instance: PROMPT mode + run_serve keep using this */
static void couple_prefetch(Model *m, int layer, const int *idx, int Ke);
static int g_looka=0; /* LOOKA=1: misura (solo contatori, zero effetti) quanto il routing MoE
* e' predicibile IN ANTICIPO β€” la domanda che decide se un prefetch
@@ -4438,6 +4444,7 @@ static void grammar_teardown(GrDraft *g){
int max=g->max; memset(g,0,sizeof(*g)); g->max=max;
}
static void grammar_setup(GrDraft *g, Tok *T){
+ g->max=24; /* was a static initializer; see g_grd's declaration (#527) */
/* GRAMMAR=<file.gbnf> takes precedence; SCHEMA=<file.json> compiles a JSON-Schema
* to GBNF. Both fail soft: the engine runs without a grammar, output unchanged. */
const char *gf=getenv("GRAMMAR");