Table of Contents
Fetching ...

SelfCP: Compressing Over-Limit Prompt via the Frozen Large Language Model Itself

Jun Gao, Ziqiang Cao, Wenjie Li

TL;DR

A Self-Compressor (SelfCP), which employs the target LLM itself to compress over-limit prompts into dense vectors while keeping the allowed prompts unmodified, and brings an efficient solution for LLMs to tackle long prompts without training LLMs from scratch.

Abstract

Long prompt leads to huge hardware costs when using transformer-based Large Language Models (LLMs). Unfortunately, many tasks, such as summarization, inevitably introduce long documents, and the wide application of in-context learning easily makes the prompt length explode. This paper proposes a Self-Compressor (SelfCP), which employs the target LLM itself to compress over-limit prompts into dense vectors while keeping the allowed prompts unmodified. Dense vectors are then projected into dense tokens via a learnable connector to make the same LLM unburden to understand. The connector is supervised-tuned under the language modeling objective of the LLM on relatively long texts selected from publicly accessed datasets, involving an instruction dataset to make SelfCP respond to various prompts, while the target LLM keeps frozen during training. We build the lightweight SelfCP upon 2 different backbones with merely 17M learnable parameters originating from the connector and a learnable embedding. Evaluation on both English and Chinese benchmarks demonstrate that SelfCP effectively substitutes 12$\times$ over-limit prompts with dense tokens to reduce memory costs and booster inference throughputs, yet improving response quality. The outstanding performance brings an efficient solution for LLMs to tackle long prompts without training LLMs from scratch.

SelfCP: Compressing Over-Limit Prompt via the Frozen Large Language Model Itself

TL;DR

A Self-Compressor (SelfCP), which employs the target LLM itself to compress over-limit prompts into dense vectors while keeping the allowed prompts unmodified, and brings an efficient solution for LLMs to tackle long prompts without training LLMs from scratch.

Abstract

Long prompt leads to huge hardware costs when using transformer-based Large Language Models (LLMs). Unfortunately, many tasks, such as summarization, inevitably introduce long documents, and the wide application of in-context learning easily makes the prompt length explode. This paper proposes a Self-Compressor (SelfCP), which employs the target LLM itself to compress over-limit prompts into dense vectors while keeping the allowed prompts unmodified. Dense vectors are then projected into dense tokens via a learnable connector to make the same LLM unburden to understand. The connector is supervised-tuned under the language modeling objective of the LLM on relatively long texts selected from publicly accessed datasets, involving an instruction dataset to make SelfCP respond to various prompts, while the target LLM keeps frozen during training. We build the lightweight SelfCP upon 2 different backbones with merely 17M learnable parameters originating from the connector and a learnable embedding. Evaluation on both English and Chinese benchmarks demonstrate that SelfCP effectively substitutes 12 over-limit prompts with dense tokens to reduce memory costs and booster inference throughputs, yet improving response quality. The outstanding performance brings an efficient solution for LLMs to tackle long prompts without training LLMs from scratch.
Paper Structure (34 sections, 4 equations, 6 figures, 8 tables)

This paper contains 34 sections, 4 equations, 6 figures, 8 tables.

Figures (6)

  • Figure 1: SelfCP generates memory tokens for each segment to substitute the original in-context demonstrations, guiding the LLM to respond to the query correctly.
  • Figure 2: Differences of compression methods based on soft prompt in formulating soft prompts. SelfCP takes advantage of the unlimited input window in AutoCompressor and the constant compression time complexity in ICAE.
  • Figure 3: Kernel density estimation of training data. The horizontal axis is the number of tokens in each instance.
  • Figure 4: The visualization result between condensed prompt and their virtual tokens. To clarify, we sample 4 virtual tokens and select some representative actual tokens.
  • Figure 5: The sensitivity analysis of compression ratio.
  • ...and 1 more figures