[Paper] RidgeFill: Training-Free Late-Layer Cache Fill for Faster Prefill

Wait 5 sec.

We introduce RidgeFill, a training-free way to shorten prefill by not computing most of a model's upper layers for the prompt. The lower layers run exactly up to a split; from the split layer's state, a ridge regression fitted once in closed form predicts every later layer's input, and each late layer writes its cache from that prediction with its own projections unchanged. A chosen set of rows, the last few thousand tokens and every decoding step run the full model, so nothing is trained and no token is dropped. On Qwen3.8-Flash-Next in vLLM, time to first token is 1.50 to 1.60x faster than exact at 9K to 32K tokens, and a whole 64K request drops from 82.6 s to 47.5 s, with RULER's needle tasks at 99.8 against 100.0. On Qwen3.8-27B in a llama.cpp fork on one A100, it is 1.25 to 1.31x faster at 16K to 120K tokens; RULER changes by -1.2 and -1.4 points and LongBench v2 by -1.4, and the 95% intervals include zero but do not rule out losses of a few points. On three 8 to 9B reference models, the fitted map retrieves 49.1 and 49.6 more filled-region RULER points than the identity (ie, full layer bypass) fill on the two dense models. - OpenReview (Archived Copy) - PDF - DOI - Project page - GitHub (llama.cpp fork for Qwen3.8 27B, quick start) - GitHub (data) - HuggingFace (maps for five models) This idea was borne originally from DeepSeek's V4.1 architecture. Originally we found the method to be a portable idea applicable to other models, but noticed a significant decline in context recall tasks and general usability. This isn't an issue in DSV4.1 because the model is trained as a whole with the prefill approximation in place, so the model absorbs the error, generally speaking. The question then shifted to be more about how this can be adopted for other models, while improving usability. From that point, the work shifted primarily to finding where exactly the error lives in the "filled" portions, and how to measure that error and reduce it. Based upon those findings, we recognized that we could train this component more intensely to remove error. This was counter-intuitive to our goal of making this easier for community adoption. It could also have the downstream effect of making the trained component more task-dependent and less generalized. We decided against this. Instead, we simply chose to simply bypass projections of the most sensitive portions of prefill. By embracing this, it allows everyone to produce their own versions of this method on different models with standard local-inference grade hardware. If you choose to adapt this method, I strongly recommend adjusting the mechanisms on a per-model basis. Across different architectures, this method should be tuned. The paper details fairly exhaustive ablations and measurements in pursuit of this. The Qwen3.8 27B version of this is available to use now via our fork of llama.cpp and the files for RidgeFill on HF. This method is also implemented in tcclaviger's fork of VLLM and Deadcode's engine, Radiance (on v1.3.0 only) for Qwen3.8 Flash Next. Big thanks to all the testers and support from the Launch80 community!   submitted by   /u/Public_Umpire_1099 [link]   [comments]