On a device with fixed memory, weights and KV cache must fit in one budget, and a smaller cache lowers quality. We tested many models at many context lengths, and the top-scoring model changed as context grew. Choosing a model first and trimming its cache afterward gave lower scores than choosing both together.
1Problem
Figure 1: A model on a device keeps its weights and a KV cache, the stored record of the context so far, in one memory budget. Weights have a fixed size. The cache grows as context lengthens, and at long context part of it has to be deleted.
2Method
Figure 2: In the usual approach, models are ranked by their full-cache score, the top model is picked, and cache is deleted until it fits. We moved the choice to the end: we worked out how much cache each model would lose under the budget, scored each model at that level, then picked.
3Findings
Figure 3: The top-scoring model changed many times across budgets and context lengths. Weight size and cache size per token were uncorrelated, so two models under one budget can lose different amounts of cache. Memory use, cache size per token and one score were enough to predict the right model in most settings.