Bedlamitybuilding in public

slii-sing: How I Tricked a 584 GB Model Into Remembering My Code

Or: 41 minutes of token-munching reduced to two seconds, give or take

2026-10-19

So I have this model, Kimi K2.6, quantized down to a svelte 584 GB. That's not a typo. Fourteen pounds of neural network, give or take, living on a dual-Xeon server with 751 GB of RAM and one lonely 16 GB Tesla P100 GPU. Mostly CPU-based, for reasons that will become obvious.

Inside the server: an old HP ML350p Gen8, twelve 64 GB sticks of RAM under the clear plastic air baffles, two CPUs and a row of fans
The patient: an old HP ML350p Gen8. Twelve 64 GB sticks are hiding under the plastic.

The prefill speed is 6 tokens per second. Decode plods along at 2.5. Reading a 15,000-token file takes about 41 minutes. Forty-one. Minutes. I could bake a pie. I could, and have, made a cup of coffee, forgotten about it, made another cup of coffee, and still come back to find it grinding through the imports section. (That's a bald-faced lie. I have never finished a cup of coffee in my life. The pie part is true. Pie is a way of life.)

The insides of an apple cranberry pie, before it goes in the oven
Apple, cranberry, walnut and orange zest, with a crumb topping still to come. Yes, this is a computer post. Yes, there is pie in it. Slii-sing is spelled weird, but it is all about slices, and so is pie.

The full context I need is roughly 20,000 tokens. Reading that from scratch? Call it an hour. An hour to ask one question about my own code. This is the slii-sing project, an architect agent for planning software changes, and the central problem is almost embarrassingly simple: the code barely changes between questions, yet I'm re-reading it every single time. Like photocopying a book before every search. Which function builds the payload for the landed message, and what are the retain and QoS values? Great question. See you in an hour for the next one.

Bar chart: reading 20,000 tokens from scratch takes about 55 minutes, assembling saved blocks about 2 seconds, on the same scale

The core idea hit me eventually, with all the subtlety of a dropped server rack: save and reuse the KV cache. The model's already done the work of understanding the code. Why make it do it again?

Here's how it works. There's a trunk, a shared module map, basically git main for your attention patterns. Then blocks, per-file caches built on that trunk, like git objects or blobs. Each block gets a content-addressed hash of its file text, the model, and the trunk it was built against. To answer a question, you assemble: load the trunk, append the relevant blocks, shift positions to make everything line up. Like git checkout, but for a model's short-term memory. The whole assembly takes about two seconds for a 20,000-token cache. Two seconds! Down from an hour! I may have actually said "Whohoo!" out loud. My family was concerned.

I patched llama.cpp to add an assemble call. The code change was small. The emotional impact was not.

trunk (module map)
  + block: bus.py        ← saved once, reused
  + block: kv_publish.py ← saved once, reused
  + block: landing.py    ← rebuilt only when this file changes
  = a cache ready to answer questions, assembled in about 2 seconds
Diagram: a trunk (the module map) plus per-file blocks are assembled into one ready cache in about 2 seconds

There is, naturally, a catch. (There is always a catch.) Stitched caches lack cross-file context awareness. The model doesn't quite "see" the whole codebase at once in that holistic, mystical way. It sees the trunk, then this file, then that file, shifted into place. For questions about the code, this turns out to be mostly fine. Ten out of ten correct answers on real codebase questions. But that's ten questions on one repo, which is a single data point, not a benchmark. I am not claiming victory. I am claiming cautious, provisional, heavily-footnoted non-disaster.

Then the trunk problem. Change the module map, and every single block invalidates. Full rebuild: five hours. Five! I went from "this is amazing" to "this is amazing and I am ruined" in about the time it took to add one import. The solution, when it came, felt like cheating: freeze the trunk. Use the old map for block keys, so existing caches still match. Use the current map for actual inference. A synthetic test with a changed, halved map got 12 out of 12 correct. Real-world impact: map changes now cost minutes instead of hours. My most recent update took about 30 minutes total, mostly rebuilding two changed files. I will take it. I will take it and I will not ask for more.

Two teasers, because I cannot help myself. First, I've been experimenting with small model pre-selection to figure out which blocks to assemble. Average answer time from roughly four minutes to under one. There were failed experiments too, including one that took 18 minutes with no benefit whatsoever. I sat there. It sat there. Nobody learned anything. Second, I'm working to integrate this whole contraption into an autonomous software building harness. The kind of thing that might actually plan and execute changes without me babysitting it through an hour of token-munching every time it needs to check a function signature.

The hardware is ridiculous. The speed is, by normal standards, pathetic. Six tokens per second, and I'm celebrating. But two seconds to assemble a context that used to take an hour? That's the kind of ridiculous I'll take. The model still doesn't know my code like I do. But at least now it doesn't have to re-read it like a student cramming before every exam. Small progress. Pesky, slow, weirdly specific progress. My favorite kind.