Sliding window 30+20 + GEN 0 cache pre-warm (pre-warm-on-change)
Window: MAIN_AREA 30 + BUFFER 20 (same 50 cap) halves rotation frequency. context: shared compose_prefix (byte-exact prefix of compose) + notepad_fingerprint (rendered header body, excludes updated_at). inkling: build_prefix_ids renders without finish_prompt. service: prewarm() sends GEN 0 directly (no PerfMeter/DB). sessions: schedule_prewarm at turn end on pending rotation OR notepad-dirty (ws=0 normalized); session_chat loads only the window subset. examples/prewarm_bench.rs: joint GEN 0 -> RESUME bench, PASS on HIP (cached==L==385). Verified live all-agent: notepad write -> pre-warm 1468 -> next turn cached_tokens==1468. Tests: prefix property, opener-skip, GEN 0 primitive, notepad fingerprint. Suite 162 passed + 3 ignored.
This commit is contained in:
1 parent
0ce84581a4
commit
a52bec97d4
12 files changed
+650
-59
No files matched your search
@@ -291,7 +291,7 @@ later adaptation round.
|
||||
|
||||
## Status
|
||||
|
||||
Working and tested (158 tests, plus 3 real-file tests run on demand). Text, images,
|
||||
Working and tested (162 tests, plus 3 real-file tests run on demand). Text, images,
|
||||
the full client-side tool loop, the Anthropic endpoint, the web GUI (session
|
||||
context, streaming, stats, **file/image upload**, assistant **Markdown/LaTeX
|
||||
rendering** with native MathML) and **agent mode** (the model using `shell_exec`
|
||||
@@ -302,7 +302,12 @@ verified against the real chat template. A per-session **notepad** (agent-curate
|
||||
`<NOTEPAD>` entries via the `notepad` tool) and a **sliding DIALOG window**
|
||||
(message-count main area + buffer headroom, stepped KV-cache-friendly eviction at
|
||||
turn boundaries, `window_start` persisted per session, full history never deleted)
|
||||
are implemented and dogfooded live.
|
||||
are implemented and dogfooded live. A best-effort **cache pre-warm** (`GEN 0` over
|
||||
the next turn's shared prefix during idle GPU time) hides the re-prefill on a
|
||||
pending window rotation **or a notepad change** (pre-warm-on-change: the model
|
||||
always sees a fresh notepad, no frozen header, no schema migration). The joint
|
||||
`GEN 0 → RESUME` measurement on HIP (`examples/prewarm_bench.rs`) **passed**:
|
||||
`cached_tokens == L == 385`, only the 35 new user tokens prefilled.
|
||||
|
||||
Not yet implemented (honest gaps): forced `tool_choice` (`required` / named function
|
||||
returns a clear 400), multi-slot batching, logprobs / structured output, automatic
|
||||
@@ -371,8 +376,8 @@ Both are **implemented and validated live**: the per-session notepad (store,
|
||||
`notepad` tool, `<NOTEPAD>` injection, read-only GUI panel) and the **sliding
|
||||
DIALOG window** (`src/window.rs`). The compositor no longer injects the full
|
||||
history: `window::select` retains the most recent messages **by count**, in two
|
||||
tiers — a **main area** (`MAIN_AREA = 40` recent messages always kept) plus a
|
||||
**buffer** (`BUFFER = 10` messages of headroom above it). The cut lands on
|
||||
tiers — a **main area** (`MAIN_AREA = 30` recent messages always kept) plus a
|
||||
**buffer** (`BUFFER = 20` messages of headroom above it). The cut lands on
|
||||
**user-turn boundaries**, so a `tool_call`/`tool_result` pair is never split, and
|
||||
the full history stays in SQLite (evicted turns remain recallable).
|
||||
|
||||
@@ -384,8 +389,10 @@ turn-to-turn and the engine reuses its cached KV. When occupancy crosses
|
||||
user-turn boundaries down to `MAIN_AREA`, amortizing one re-prefill over several
|
||||
append-only turns, and a new buffer starts filling. The chosen start id is persisted
|
||||
per session (`sessions.window_start`, idempotent migration) and respected on the
|
||||
next turn. The counts are a starting point (40 main + 10 buffer); both will shrink
|
||||
at regime. A **total-size (char/token) cut** is deliberately deferred — it interacts
|
||||
next turn. The counts are a starting point (30 main + 20 buffer, same 50 cap);
|
||||
the wider buffer halves the rotation frequency (fewer re-prefills) at the cost of
|
||||
a lower post-rotation floor, and both will shrink at regime. A **total-size
|
||||
(char/token) cut** is deliberately deferred — it interacts
|
||||
with the stepped anchor and is not as simple as a second cap; the notepad preserves
|
||||
what matters beyond the window.
|
||||
|
||||
@@ -394,6 +401,9 @@ suffix (SQL-filtered by `window_start`, so a months-long history — potentially
|
||||
of millions of tokens — is never loaded whole or shipped to the client), plus the
|
||||
total count so the GUI shows a banner noting older turns are preserved server-side.
|
||||
A full-chat export/download command is deferred; the live view is windowed by design.
|
||||
The inference path (`session_chat`) loads the same SQL-filtered subset
|
||||
(`message_window`), so a turn never reads the whole history either — both the
|
||||
browser and the model are bounded to the retained window.
|
||||
|
||||
To survive what slides out, each session has a **notepad**: a small,
|
||||
agent-curated set of **labelled entries** (`key → short text`, e.g. `goal`,
|
||||
|
||||
Reference in new issue
Block a user