Limit per-session prompt-end retention in the shared prefix cache

Offen
#24,914 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@brave30 arbeitet bereits daran.

Seit 13.11.2026.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
ai-infra-agents

Rechercherichtung

Start by reading the implementation and tests for --prefix-checkpoint-prompt-end and the shared prefix cache, then trace how captures, deduplicated entries, and session close/reset are handled. Design and validate an optional per-session retention policy while preserving shared reuse and the single global capacity. Done means the retry, multi-session pressure, deduplication, and close/reset cases are covered, and the tradeoff for older turns is documented.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Follow-up to #24624.

With --prefix-checkpoint-prompt-end every, each turn can add another snapshot to the shared prefix cache. One long conversation can therefore fill the cache and evict other sessions' prompt ends, reducing their retry reuse. For example, eight distinct prompt ends from one session can occupy an eight-entry cache.

Explore a retention mode that keeps only each session's newest prompt end, or its initial and newest prompt ends (at most two entries per session). Captures would record the originating session so older entries from that session can be replaced.

Entries should remain shared and reusable across sessions. --prefix-cache-entries must remain the single total capacity; a per-session cap should not reserve space or introduce private caches.

Validate that the policy:

  • Preserves reuse for cancellation, stop-string, and failure retries when the relevant prompt-end snapshot was captured.
  • Limits how much one session can occupy under multi-session cache pressure, while respecting global eviction and capacity.
  • Handles deduplicated snapshots and session close/reset consistently.

Document the tradeoff: retaining fewer historical prompt ends reduces reuse when returning to older turns. This is a follow-up policy option, not a prerequisite for #24624.

Vorherrschende Sprache
Python
Sterne
5.2k
Forks
1.3k
Ø Merge
1 T. 7 Std.
Gemergte PRs (30 T.)
644

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus pytorch/executorch

Alle Issues in pytorch/executorch

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.