From Retrieved Context to Runtime Control: Adaptive Compression for Edge-based RAG
在边缘设备上跑RAG时,检索到的文本压缩多少必须实时决定,否则白白浪费电
RAG通过检索外部文档来让语言模型的回答更准确,但检索到的文本越长,在边缘设备上花费的时间和电量就越多。这篇论文在NVIDIA Jetson AGX Thor边缘设备上实测了这种权衡,发现压缩存在一个合适区间:压缩太轻会浪费节能机会,压缩太狠又会损害回答质量。中等程度的压缩能让GPU能耗最多降低53.2%,整机能耗最多降低48.2%,而回答质量几乎不受影响。
他们做了什么
- 对于7B到8B参数规模的大模型,生成回答这一步(而非检索或压缩)占据了每次查询约90%的时间和91%的GPU能耗
- 用LLMLingua-2压缩工具把压缩率从1.0调到0.15发现,压缩率在1.0到0.3之间时回答质量(F1分数)基本保持不变,但降到0.15时质量骤降4到10分
- 压缩率0.9这种轻度压缩反而会增加总能耗,因为压缩本身有固定开销(每次查询130到310毫秒),抵消了压缩少量文本带来的节省;只有压缩率降到0.7以下才能真正省电
- 压缩率0.3被认为是'安全又激进'的最佳设定点,节能效果随模型规模和检索文档数量增大,从30%到53%不等
- 作者主张需要一个运行时控制器,根据延迟、能耗、温度等设备实时信号来决定是否压缩、压缩多少,而不是固定使用一个压缩比例

| Item | Configuration |
|---|---|
| Platform | Jetson AGX Thor: Blackwell GPU, 128 GB LPDDR5x, 273 GB/s, 130 W. |
| Corpus / index | English Wikipedia 2018, sentence-split via FlashRAG (∼9.4 M passages) (16); e5-base-v2 encoder (50); FAISS GPU IndexFlatL2 ( 28.2 GB). |
| QA Datasets | Natural Questions (20) and HotpotQA (54); 100 seed-paired queries per config. |
| Models | Llama-3.2 1B/3B, Llama-3.1 8B (9); Qwen-2.5 1.5B/3B/7B (53). All fp16. |
| Compression | None, or LLMLingua-2 (34) |
| Sweeps | Exp. 1 uses k∈{1,5,10} with compression off. Exp. 2 uses HotpotQA, k∈{5,10}, and LLMLingua-2 rates 1.0, 0.9, 0.7, 0.5, 0.3, and 0.15. |
| Controls | Single-query mode, reranker off, standard pipeline, randomized config order, first 3 queries dropped as warm-up. |
| Metrics/telemetry | EM, token-level F1, retrieval recall; end-to-end and per-stage latency; GPU/SoC energy, power, memory, and temperature from tegrastats at 100 ms cadence. |
| Model | k | Δlat. | ΔEGPU | ΔESoC | ΔEM | ΔF1 |
|---|---|---|---|---|---|---|
| Llama-3B | 5 | +8.5% | +30.2% | +28.2% | +0.000 | −0.005 |
| Llama-3B | 10 | +15.6% | +40.6% | +35.1% | +0.010 | +0.012 |
| Llama-8B | 5 | +25.2% | +44.9% | +38.5% | +0.052 | +0.016 |
| Llama-8B | 10 | +32.6% | +53.2% | +48.2% | +0.000 | −0.011 |
为什么重要
对于在手机、机器人、AR设备等电池和散热受限的场景中部署RAG的开发者来说,这项研究说明一味加大压缩力度可能适得其反,并给出了一个较安全的压缩参考点(压缩率0.3)。它把压缩从一次性的预处理步骤,重新定义为需要根据设备实时状态动态调整的资源管理问题。
本文术语
- RAG(检索增强生成) · 语言模型在回答前先检索外部文档,再依据检索内容生成答案的方法
- 上下文压缩 · 在把检索到的文档喂给模型之前,先削减或精简其内容以缩短输入长度
- 压缩率(rate) · 压缩后保留的原文比例,例如rate=0.3表示只保留原文的30%
- LLMLingua-2 · 一种通过剔除不重要词元来压缩文本的工具,同时保留原文其余部分
- 边缘SoC · 用于手机、机器人等设备、功耗和散热都受限的片上系统芯片,本文实测所用的Jetson AGX Thor即属此类
论文原文摘要(英文)
Retrieval-augmented generation (RAG) improves language-model responses by grounding generation in external passages, which comes with overhead: retrieved context lengthens the prompt, increasing prefill work, KV-cache footprint, memory traffic, latency, and energy. Context compression offers a natural remedy by pruning retrieved text before generation. However, state-of-the-art context-compression methods are typically used with a fixed compression budget, or with the rate selected offline and then applied at inference time. This static view ignores both workload variation and the live state of the edge device. On an edge SoC, compression is not free: the compressor itself runs on the same SoC and consumes latency and energy that can offset any generation savings. This paper proposes a vision for telemetry-informed adaptive compression in edge RAG, grounded in experimental evidence. We characterize the compression tradeoff on the NVIDIA Jetson AGX Thor using Llama and Qwen generators, Natural Questions and HotpotQA datasets, and LLMLingua-2 compression. Our measurements show that generation dominates the RAG budget for larger models, reaching roughly 90% of per-query latency and 91% of GPU energy for 7B-8B generators. Exploring the impact of the compression rate reveals an adaptive operating region: mild compression can miss energy opportunities, and overly aggressive compression can hurt inference quality. Intermediate compression can reduce GPU energy by up to 53.2%, and SoC energy by up to 48.2%, with negligible quality loss. We argue for runtime policies that dynamically manage compression, guided by workload features and edge telemetry.
在 arXiv 阅读最新论文
- LoRA-GA$^2$: Low Rank Adaptation with Multi-step Gradient Adaptive Alignment在正式微调前先偷看几步训练的梯度,让LoRA的初始化更聪明
- Remember, Verify, or Ask? Cross-Family Evaluation of Memory Commitment in LLM AgentsAI助手在该向你提问的时候,却更愿意自己去核实事实
- Robust Incomplete Multimodal Sentiment Analysis via Iterative Proxy Correction文本信息缺失或损坏时,这个AI不靠一次性猜测,而是反复修正猜测结果,从而更准确地判断情绪
- Generating Diverse Personas for User Simulators to Test Interview Dialogue Systems要测试访谈式对话系统需要大量不同性格的虚拟用户,这项研究用大语言模型自动生成这些虚拟用户人设
- Rethinking Patch Based Multivariate Time Series Forecasting with Semantic Structured Partitioning别再机械切分时间序列,按语义把它切成有意义的块
- Reliable Financial Named Entity Recognition under Domain ShiftAI在正式文件里学到的自信,一到推特上就变得不可信
- Bringing analytic rigor to agentic AI for science: The Brain Researcher platform for neuroimaging data analysis让AI分析脑影像数据时,把“为什么这个结论可信”也一并记录下来
- GenMatch: An End-to-End Generative Matching Framework for Micro-View Order-Dispatching in Ride-Hailing滴滴把打车派单从预测-计算-匹配三段式流程改成一次生成完成,线上效果提升明显
METAL LAB 最新报道
图片来源: Zlatan Feric et al., arXiv:2608.19535, arxiv-nonexclusive