From e982d2930e28fbc0b2b7f6b7bd0719b289a64404 Mon Sep 17 00:00:00 2001 From: JustVugg Date: Mon, 6 Jul 2026 17:26:08 +0200 Subject: [PATCH] autopin: pin share scales with usage-history confidence Co-Authored-By: Claude Fable 5 --- c/glm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/c/glm.c b/c/glm.c index 173b8d9..58e2fd7 100644 --- a/c/glm.c +++ b/c/glm.c @@ -1350,7 +1350,11 @@ int main(int argc, char **argv){ if(hist>0) fprintf(stderr,"[USAGE] storia expert: %lld selezioni (%s)\n",(long long)hist,g_usage_path); int autopin = getenv("AUTOPIN")?atoi(getenv("AUTOPIN")):1; if(!getenv("PIN") && autopin && hist>=5000){ - double pin_gb = expert_avail(&m,ram_env,ebits,est_ctx)*0.5/1e9; + /* quota pin proporzionale alla FIDUCIA nella storia: con pochi dati il pin + * sbaglia expert e ruba slot alla LRU adattiva; a regime (>=200k selezioni, + * qualche ora di chat) arriva a meta' del budget expert. */ + double conf = (double)hist/200000.0; if(conf>1) conf=1; + double pin_gb = expert_avail(&m,ram_env,ebits,est_ctx)*0.5*conf/1e9; if(pin_gb>=0.5) pin_load(&m, g_usage_path, pin_gb); } /* SEMPRE: senza clamp la LRU cresce fino a cap*76 layer = decine di GB -> OOM-kill.