7 views
-/https://github.com/berriai/litellm/issues/29320
GitHub · issue

#29320 feat: LLMLingua-2 in-place prompt compaction integration

  • State: open
  • Author: @solsen-lightci
  • Labels: llm translation

# PRD: LLMLingua-2 Prompt Compaction Integration

## Problem Statement

Teams running long-context LLM workloads through LiteLLM hit provider context limits and pay for input tokens on every request. LiteLLM's existing drop-and-retrieve compaction (BM25 message stubbing + server-side retrieval) solves a different problem and only covers Anthropic Messages. Operators need **in-place prompt compaction** via LLMLingua-2 on the request hot path — opt-in per tenant, observable, fail-open, and isolated from existing compression code — for both proxy and SDK callers.

## Solution

Add a self-contained **LLMLingua-2 compaction integration** that registers as a LiteLLM callback, compacts eligible messages in place before the LLM call, and exposes compaction status through metadata, spend logs, and response headers. Compaction is never on by default: a proxy master switch plus per-key/team/request **prompt compaction settings** gate every request. When compaction cannot run safely or within budget, the gateway **pass-through**s original messages and still completes the LLM request.

## User Stories

1. As a platform operator, I want to enable LLMLingua-2 compaction on my LiteLLM proxy via YA…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (18 events)
#0 of 0 · 31d19h7m12s ago — entered · #import:https:::github.com:berriai:litellm post #1848
#29320 has substantially greater scope and risk: it introduces a new hot-path ML integration spanning configuration, proxy and SDK behavior, failure handling, isolation, observability, and compatibility testing. #33893 is comparatively contained provider-specific routing and endpoint resolution work.
Issue #29320 is substantially harder: it requires a new opt-in compaction subsystem spanning proxy and SDK request paths, callback lifecycle integration, configuration precedence, provider/model execution, fail-open behavior, observability, persistence, headers, and broad testing. Issue #30118 is a narrowly scoped regression involving URL/forwarded-header handling and deployment-specific redirect behavior.
The right-hand task requires a new cross-cutting request-path integration with configuration, provider/model behavior, observability, failure handling, and compatibility coverage. The left-hand task is comparatively localized to deletion workflow and referential-integrity handling across existing API/UI paths.
The right item requires a cross-cutting integration with runtime configuration, model execution, proxy and SDK pathways, observability, and fail-open behavior. The left item is a localized schema-processing correction with focused regression tests.
The right issue is harder because it requires cross-cutting production changes in the request path, configuration, failure handling, and observability, while the left is primarily broad QA and CI validation of an existing implementation stack.
Issue #31263 is substantially harder because it is a broad, multi-phase systems migration involving a new implementation language, parity across gateway hot paths, performance and memory targets, compatibility, deployment, and long-term rollout risk. Issue #29320 is a bounded opt-in integration with localized callback, configuration, observability, and fallback behavior.
The right issue is harder because it spans request-path integration across SDK and proxy flows, configuration and authorization layers, third-party model/runtime behavior, failure isolation, and comprehensive observability. The left issue is primarily a CLI orchestration and per-tool configuration task, with integration breadth but less impact on core request processing.
Issue 21347 is harder because it requires broad schema-driven validation across providers, translations, streaming behavior, and ongoing compatibility maintenance; issue 29320 is a substantial but more self-contained integration with defined configuration, lifecycle, and observability changes.
29320 has substantially greater implementation risk and scope: it introduces a new model-backed request-path subsystem spanning SDK and proxy flows, lifecycle hooks, configuration, isolation, failure handling, performance controls, and observability. 31821 is primarily a quota and accounting feature with distributed consistency, calendar-boundary, API, and UI considerations, but fits more naturally into existing proxy budget infrastructure.
29320 is harder because it introduces a new cross-cutting feature with model/dependency management, multiple configuration scopes, callback integration, fail-open behavior, metadata and billing observability, and broad SDK/proxy test coverage. 30043 is risky protocol-compatibility work, but is comparatively narrower and centered on stabilizing existing routing, streaming, and token-counting paths.
29320 is harder because it spans new runtime processing, configuration layers, observability, dependency management, failure handling, and SDK/proxy compatibility. 28125 is primarily a routing and configuration-model change, with recursion, validation, and backward-compatibility risks but a narrower surface area.
29320 is harder due to cross-cutting SDK/proxy integration, model execution on the request path, configuration inheritance, observability, fail-open behavior, and performance/isolation risks. 31835 requires substantial billing, persistence, API, and idempotency work but is more contained in administrative and spend-accounting workflows.
29320 requires cross-cutting hot-path integration, optional model/runtime handling, configuration precedence, failure isolation, and SDK/proxy observability, creating greater performance and regression risk than a mostly administrative export workflow
The left task is harder because it spans model integration, request-path transformation, multi-surface configuration, observability, dependency/runtime concerns, and failure isolation. The right task is primarily an extensibility change around routing interfaces and proxy wiring, with less cross-cutting behavior.
29320 is harder due to cross-cutting request-path behavior, configuration inheritance, fail-open guarantees, dependency/runtime concerns, and coordinated SDK, proxy, observability, and testing work. 25255 mainly requires adapting an external guardrails framework to established integration and proxy extension points, though its lifecycle and compatibility risks remain significant.
29320 requires a broad new integration spanning request processing, configuration, proxy and SDK paths, fail-open behavior, and observability. 25447 may involve difficult distributed-state debugging, but its implementation scope is narrower and depends on reproducing and isolating an existing defect.
The left task is substantially harder because it spans a new opt-in integration, request-path behavior, configuration across multiple caller scopes, fail-open guarantees, and several observability surfaces. The right task is a focused safety fix across a small number of schema-expansion paths, though it carries meaningful performance and regression risk.
#0 of 0 · 31d17h26m4s ago — current · #import:https:::github.com:berriai:litellm post #3533
The left task spans new request-path functionality, multiple interfaces, configuration layers, observability, dependency and failure-mode handling, and broad testing. The right task is a focused proxy consistency correction with a smaller behavioral surface, despite requiring careful distributed-state validation.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search