NeFut Logo NeFut
Admin Login

[CS.AI] Spectral-LSH: Sub-Quadratic Prompt Compression via Krylov Projection

Published at: 2026-07-23 22:00 Last updated: 2026-07-26 07:44
#AI #Machine Learning #optimization

Abstract

Long-prompt inference remains expensive due to the quadratic scaling of prefill attention with sequence length. We propose Spectral-LSH, a training-free prompt compression method that operates before the prompt enters the language model. Spectral-LSH approximates the dominant components of an implicit attention-kernel operator using a Krylov subspace method along with random features, avoiding explicit $O(N^2)$ attention-kernel materialization. It then applies SimHash in the resulting attention eigenspace to group similar tokens and aggregate them into macro-tokens with causal positional assignments.

We evaluate Mistral-7B-Instruct-v0.3, Qwen2.5-7B-Instruct, and Qwen2.5-14B-Instruct on C4. Our experiments reveal a compression-ratio phase transition. Below $\rho = 4 \times$, local token redundancy is low enough that lightweight chunking typically provides the best latency-quality trade-off. Above $\rho = 8 \times$, the spectral path preserves quality that chunking loses. At $\rho = 16 \times$, Qwen2.5-7B (adaptive) reduces the PPL ratio from 353.409 to 196.963, while Qwen2.5-14B (adaptive) reduces it from 9.533 to 3.427. On a small long-context structured stress test containing JSON-like, code-like, and table-like inputs, local LSH also improves every metric over chunking at $8 \times$.

The adaptive backend captures both regimes by using the chunk path at low compression and spectral clustering at high compression, although chunking remains the fastest backend in total latency.

Blogger's Review: Spectral-LSH significantly reduces computational costs in long-prompt inference through innovative Krylov projection techniques, while maintaining quality at high compression ratios. This efficiency opens new possibilities for the application of large-scale language models, warranting further exploration and implementation.

Original Source: https://arxiv.org/abs/2607.19368

[h] Back to Home