Quantized small language models (SLMs) running as on-device agents must balance accuracy loss against latency as their context grows. Mixed precision assigns different precisions to weight tensors according to their size and sensitivity, but a configuration chosen for a short context may not give the best tradeoff at a longer one. We therefore change weight precision as context grows. To decide when and which tensors to change, we calibrate a timing model from measurements at different precisions and context lengths, and combine it with tensor sensitivities to choose a configuration for each context range under a latency or accuracy budget. Under a latency budget, reading the growing key-value (KV) cache leaves less time for weight operations, so the allocator lowers precision as context grows. Under an accuracy budget, the measured error of a quantized KV cache sets the budget left for the weights, so the allocator can raise or lower weight precision. The result is a schedule of tensor changes prepared before execution, which our runtime follows without extra weight copies in memory. We compare three ways to do this: streaming each tensor version from storage, quantizing in place, and storing a low-precision base plus a residual. On a laptop GPU, we evaluate executed schedules through 16K tokens and on a tool-use benchmark that measures response time and correctness.
翻译:暂无翻译