[论文解读] Learning to Compress Prompts with Gist Tokens
摘要:Gisting 通过修改注意力掩码将提示压缩成小型要点标记,实现零-shot 的要点预测,可以缓存并重用提示,达到高达 26 倍的压缩,且质量损失极小。
Prompting is the primary way to utilize the multitask capabilities of language models (LMs), but prompts occupy valuable space in the input context window, and repeatedly encoding the same prompt is computationally inefficient. Finetuning and distillation methods allow for specialization of LMs without prompting, but require retraining the model for each task. To avoid this trade-off entirely, we present gisting, which trains an LM to compress prompts into smaller sets of "gist" tokens which can be cached and reused for compute efficiency. Gist models can be trained with no additional cost over standard instruction finetuning by simply modifying Transformer attention masks to encourage prompt compression. On decoder (LLaMA-7B) and encoder-decoder (FLAN-T5-XXL) LMs, gisting enables up to 26x compression of prompts, resulting in up to 40% FLOPs reductions, 4.2% wall time speedups, and storage savings, all with minimal loss in output quality.
研究动机与目标
- Motivate reducing repeated prompt computation in Transformer LMs without retraining for each task.
- Introduce gist tokens and attention-mask edits to compress prompts during instruction finetuning.
- Show that a LM can predict gist prefixes zero-shot from the prompt and generalize to unseen tasks.
- Quantify efficiency gains in FLOPs, latency, and storage while maintaining output quality.
提出的方法
- Introduce a single gist token (or a few) inserted between prompt and input.
- Modify attention masks so that later tokens cannot attend to prompt tokens before the gist tokens.
- Train via standard instruction finetuning with the gist masking setup, enabling zero-cost gist learning.
- Use the LM itself as the gist predictor, leveraging meta-learning to generalize gist prefixes G(t) for new prompts.
- Evaluate with decoder-only (LLaMA-7B) and encoder-decoder (FLAN-T5-XXL) models across Seen, Unseen, and Human/OOD prompts.
- Compare against baselines: Positive control (standard finetuning), Negative control (no prompt), and TF-IDF-based discrete compression.]
实验结果
研究问题
- RQ1Can a language model compress prompts into a much shorter gist prefix without additional task-specific training?
- RQ2How does gist-based compression affect prompt accuracy and evaluation metrics on seen, unseen, and human-annotated tasks?
- RQ3What are the compute and storage savings when using gist caching versus full instruction caching or no caching?
- RQ4Does gist compression generalize to unseen or out-of-distribution prompts and across model architectures (decoder-only vs encoder-decoder)?
主要发现
- Gist models with 1 gist token achieve near-parity with positive controls on Seen prompts for both LLaMA-7B and FLAN-T5-XXL (ROUGE-L and ChatGPT win rates close to controls).
- On Unseen prompts, gist models still outperform TF-IDF baselines, with win rates around 49.7% (LLaMA) and 46.2% (FLAN-T5) versus controls.
- On the OOD Human prompts, gist models show competitive win rates (~45.8% for LLaMA and ~42.5% for FLAN-T5), indicating good generalization.
- Human evaluation aligns with ChatGPT judgments, with comparable win rates and moderate inter-annotator agreement (Cohen’s kappa ~0.24–0.33).
- Gist caching yields significant efficiency gains: up to 40% FLOPs reduction and 4–7% wall-clock speedups for some configurations, and up to 26x prompt compression.
- Storage benefits are substantial: gist caching enables caching many prompts within the same memory footprint as fewer full prompts.
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。