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

vk_tier: an engine's own cap on the experts it keeps (VktConfig.max_experts)

JustVuggc53218e8fd1e
diff --git a/c/vk_tier.c b/c/vk_tier.c
index c72fe6e6..ac158509 100644
--- a/c/vk_tier.c
+++ b/c/vk_tier.c
@@ -703,6 +703,7 @@ int vkt_init(const VktConfig *cfg, uint32_t *const *heat) {
eng, human(want, hb, sizeof hb), human((double)T.exp_bytes, he, sizeof he));
return 0;
}
+ if (T.c.max_experts > 0 && fit > T.c.max_experts) fit = T.c.max_experts; /* the engine's count cap */
T.max_resident = (int)fit;
T.budget = (size_t)want;
/* Every expert fits in one block's worth: the pool's limit (and so its one block)
diff --git a/c/vk_tier.h b/c/vk_tier.h
index ccd8d611..9e615733 100644
--- a/c/vk_tier.h
+++ b/c/vk_tier.h
@@ -140,6 +140,9 @@ typedef struct {
* and return to the device when it finishes early. Called on the engine thread. */
int (*in_ram)(void *ctx, int layer, int eid);
void *ram_ctx;
+ /* Optional: at most this many experts resident whatever the budget holds (0 = no
+ * cap); for an engine whose users already size its device tier in experts. */
+ int max_experts;
} VktConfig;
/* One expert as it sits in RAM: codes and scales of gate, up, down (float scales,