Run 35B MoE models in ~2.5 GB of RAM. Weights stream from SSD; a trained router predicts loads a step ahead. Mac, iPhone, Android, Windows supported
Python
From 03c5ca68489cede393308a1cd12e89e68aa476f3 Mon Sep 17 00:00:00 2001
From: Alex Zhou <[email protected]>
Date: Tue, 29 Sep 2026 01:44:29 +0800
Subject: [PATCH 08/14] =?UTF-8?q?moe=5Fpool=20v4.4:=20=E6=B0=B4=E4=BD=8D?=
=?UTF-8?q?=E6=8E=A2=E6=B5=8B=202s=20=E8=8A=82=E6=B5=81=EF=BC=88=E6=AF=8F?=
=?UTF-8?q?=20ensure=20=E5=BC=80=20/proc=E2=89=8812ms/token=20=E6=B5=8B?=
=?UTF-8?q?=E9=87=8F=E7=A8=8E=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-Authored-By: Claude Code <[email protected]>
---
ggml/src/ggml-cpu/moe_pool.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ggml/src/ggml-cpu/moe_pool.c b/ggml/src/ggml-cpu/moe_pool.c
index 903f0f7..4d62904 100644
--- a/ggml/src/ggml-cpu/moe_pool.c
+++ b/ggml/src/ggml-cpu/moe_pool.c
@@ -466,6 +466,10 @@ static void water_trim_locked(void) {
if (!fe) return;
const long long floor_mb = atoll(fe);
if (floor_mb <= 0) return;
+ static uint64_t s_next = 0; // 2s throttle (third-audit case: opening /proc on every ensure cost a ~3% measurement tax)
+ const uint64_t now = now_ns();
+ if (now < s_next) return;
+ s_next = now + 2000000000ull;
const long long avail = mem_avail_mb();
if (avail < 0 || avail >= floor_mb) return;
const int target = (int) (g_nslots * 6 / 10);
--
2.52.0.windows.1