microsoft/LLMLingua
[EMNLP'23, ACL'24] To speed up LLMs' inference and enhance LLM's perceive of key information, compress the prompt and KV-Cache, which achieves up to 20x compression with minimal performance loss. observed · 2026-08-28
Health v2 · maintenance only
53/100
- Activity 76
- Release rhythm 8
- Longevity 82
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 1153
- days_rel: n/a
- days_push: 147
- n_releases_24m: 0
Adoption not part of the score
6609 stars · 418 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
LLMLingua is a Microsoft library for prompt compression that removes non-essential tokens from prompts and KV caches to speed up LLM inference, achieving up to 20x compression with minimal performance loss. It includes variants like LongLLMLingua for query-aware long-context compression and LLMLingua-2 for faster task-agnostic compression, and integrates with LangChain, LlamaIndex, and Prompt flow.
Use cases
- compress prompts before sending to an LLM to cut token costs
- speed up LLM inference by shrinking long context windows
- reduce RAG context size without losing answer quality
- compress long documents for query-aware question answering
- lower KV cache memory usage for long-context models
- make prompts fit within a smaller context limit
When to choose
- you pay per token and want to cut prompt costs
- your RAG pipeline stuffs too much retrieved context into prompts
- long-context inference latency is a bottleneck
- you use LangChain or LlamaIndex and want drop-in compression
When to avoid
- your prompts are already short and cheap
- your task is highly sensitive to dropped tokens, such as precise code generation
- you need compression without any small auxiliary model or extra compute
- you work outside the Python ecosystem
Facets
library · maturity active
llm-inference rag nlp machine-learning large-language-models artificial-intelligence python prompt-compression kv-cache inference-acceleration token-reduction cost-optimization natural-language-processing retrieval-augmented-generation
3 sources
- readme: https://github.com/microsoft/LLMLingua · fetched 2026-08-28 · 19f01f05192d
- homepage: https://llmlingua.com/ · fetched 2026-08-29 · 5ad6a049c9bf
- registry_pypi: https://pypi.org/pypi/llmlingua/json · fetched 2026-08-29 · f044ec05f3db
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| microsoft/LLMLingua | main | 53 |
For agents
markdown · JSON · MCP: product_card(name="microsoft/LLMLingua")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem