Skip to main content
QUICK REVIEW

[Paper Review] Learning to Compress Prompts with Gist Tokens

Jesse Mu, Xiang Lisa Li|arXiv (Cornell University)|Apr 17, 2023
Topic ModelingComputer Science17 citations
TL;DR

Gisting learns to compress prompts into small gist tokens by modifying attention masks, enabling zero-shot gist predictions that cache and reuse prompts, achieving up to 26x compression with minimal quality loss.

ABSTRACT

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.

Motivation & Objective

  • 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.

Proposed method

  • 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.

Experimental results

Research questions

  • 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)?

Key findings

  • 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.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.