Repository navigation
The embedder holds its need: a window-bounded context, a floor set by grants and lowered by releases - #5996
Merged
Conversation
… grants and lowered by releases The M5 (canary 958ea30, 2026-11-14 03:35Z): embed.vram.refused 12 times since boot, one embed lease asking 14,205,059,072 B (13,547 MiB) beside 13,915,160,576 B, embedding.neural.failed, recall lost the item. Two causes: - embedding_batch.rs planned each text against the model's trained context (n_ctx_train, 32,768 for Qwen3-Embedding-0.6B), so a 19,456-token text sized a 13,547 MiB context. The window is now EmbedWindow: min(trained context, the 2,048 tokens the cost rates were measured over); a longer text is embedded in windows, every token once. - embed_lane_memory.rs raised the standing floor to every REQUEST with fetch_max before leasing, so that one refused request reserved 13.5 GiB for the rest of the process. The floor is now the lane's working set: its weights plus the contexts it is granted, set at a grant and lowered at the release (EmbedLease's Drop); a refusal never touches it. A request past the window's context is a typed refusal (EmbedLeaseError::Oversized) before any reservation. Windows are framed by the model's special tokens on the side the model puts them (Frame): the Qwen3-Embedding GGUF has add_bos_token false and add_eos_token true, so tokenize("") is [EOS], which no text begins with. The old prefix-only window refused every Qwen3 text that needed windows. Pinned: an_embed_context_derives_from_the_window_never_the_trained_context (dyno: the receipt's 14,205,059,072 B before, a 2,048-token window after), a_tail_framed_text_is_windowed_with_its_tail, a_refused_request_leaves_the_floor_unchanged, a_release_lowers_the_floor. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…m is added (stringly_errors back to the base) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Nov 14, 2026
…er-outcome wait Keeps #5996's typed lease (EmbedLeaseError, floor raised on grant and lowered on release). The wait answers with the authority's own outcome: Published (the only retry), StillShort on its next board (typed Refused), AuthorityClosed (new typed terminal variant). No timeout. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Nov 14, 2026
…en embeds, cleared only when it unloads (#6006) The M5 (canary 7f875cc, engine -c 551865, booted ~07:52Z 2026-11-14): after #5996 the embed requests are small (186,908,672 and 373,817,344 B), but by 08:16Z embed.vram.refused = 13 and embedding.neural.failed = 11, all at available=0. #5996's floor fell to the weights between embeds, so the engine's pool and the other claims took the next context's room. EmbedResidency (embed_lane_memory.rs) is the embed lane's resident claim: weights plus one window context (~2.1 GB on the device at most), reserved per pool from the first embed and held by the backend (LlamaCppBackend::embed_residency). It is cleared only in its Drop, when the embedder unloads. Leases are granted inside it and never move it. #5993's room_beside_others counts the reservation, so a boot or a regrowth sizes beside it. The LaneFloors grant/release bookkeeping is deleted. Pinned: an_embed_after_an_idle_gap_is_granted_beside_an_engine_that_fills_the_room, a_refused_request_leaves_the_floor_unchanged, unloading_the_embedder_clears_its_floor. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Serves residents' recall (perception/RAG relevance) and the one memory budget (plan line 3/3b). When the embed lane is refused, embeddings drop to no-relevance and minds lose recall.
Receipts (the M5, 64 GB unified, canary 958ea30, 2026-11-14)
embed.vram.refusedfired 12 times since boot. At 03:35Z: requested 14,205,059,072 B (13,547 MiB) against 13,915,160,576 B available, followed byembedding.neural.failed.continuum-probes.jsonl: requested 186,908,672 B against available=0 (the device-room half, fixed by The boot counts the device room, the embed floor outside it #5993).Cause
backends/llamacpp/embedding_batch.rs,EmbeddingBatch::tokenize(canary L88-97) planned every text againstmodel.n_ctx_train(), which is 32,768 for Qwen3-Embedding-0.6B. The context is sized to the widest piece (L113-115,n_ctx = n_batch = n_ubatch = widest, L119-125). At the measured rates (KV 28 MiB and device compute 150.25 MiB per 256 tokens, L45-47), a 19,456-token text costs 2,128 + 11,419 = 13,547 MiB = 14,205,059,072 B, the receipt's exact request. Nothing upstream chunks: callers (memory/mod.rs:206,341,recall_faculty.rs:399,tool_embedding.rs) embed texts whole. The window plan insideEmbeddingBatchis the only chunker, and its span was the trained context. It was not a copy of the serving lane's window.inference/embed_lane_memory.rsL38:floor.fetch_max(part)and thendaemon.reserve(embed, pool, floor)ran beforelease_part. So a request, granted or refused, raised the standing floor permanently, and serving's boot sizing (room_beside_others, The boot counts the device room, the embed floor outside it #5993) kept 13.5 GiB out for the embedder for the rest of the process.Fix, at the owners
EmbedWindow(embedding_batch.rs): the window ismin(n_ctx_train, 2,048), where 2,048 is the top of the range the cost rates were measured over (256 to 2,048,~/.continuum/evidence/replicate-2026-11-10/). A longer text is embedded in windows of it, every text token once, combined by the existing token-weighted mean. The widest context is now at most 1,426 MiB on the device.Frame: windows carry the model's special tokens on the side the model puts them. The Qwen3-Embedding GGUF on the M5 readsadd_bos_token False,add_eos_token True, sotokenize("")is[EOS], which no text begins with. The old prefix-only window (tokens.starts_with(prefix)) refused every Qwen3 text that needed windows. That was a latent defect above 32,768 tokens; with a 2,048-token window it would have broken every long text.EmbedNeed(embed_lane_memory.rs, fromLlamaCppBackend::embed_need): weights (the model file's length, placed like a context) plus the window's context. A request larger than the window's context returnsEmbedLeaseError::Oversizedbefore anything is reserved.EmbedLease'sDrop). A refusal never touches it.EmbedLeaseError { Oversized, Refused, Ungoverned }replaces theResult<_, String>in this module.Dyno, from these receipts
fetch_max)Oversized, floor unchangedPinned tests (
what this catcheson each)embedding_batch::tests::an_embed_context_derives_from_the_window_never_the_trained_context: the receipt's 14,205,059,072 B before, the window after.embedding_batch::tests::a_tail_framed_text_is_windowed_with_its_tail: Qwen3's trailing EOS.embed_lane_memory::tests::a_refused_request_leaves_the_floor_unchanged: oversized and capacity refusals.embed_lane_memory::tests::a_release_lowers_the_floor: both ways, and the fit beside the engine.Not run locally: this machine serves live minds, so CI is the compiler.
Known tradeoffs
available_forof other consumers therefore withholds them once more beyondphysical_used: about 0.6 GB, on the conservative side. Follow-up: have the embedder declare measured residency (set_measured) so the floor is met by it.embed.vram.refusedafter deploy.Lines
+456 / -95 across 7 files (+~200 of that is tests). All touched files are under 1,000 lines (embedding_batch.rs 451, embed_lane_memory.rs 370). Removed: the
fetch_maxfloor statics, twoResult<_, String>signatures and onemap_err(format!)in embed_lane_memory. Added one.map_err(|e| e.to_string())at the adapter's String trait seam and onemap_err(format!)for the weights' file metadata inLlamaCppBackend::load(alreadyResult<_, String>). Net stringly sites: -1.Live check after deploy (owner: whoever deploys this; deadline: the first hour on the M5)
embed.vram.refused= 0 andembedding.neural.failed= 0 in~/.continuum/probes/continuum-probes.jsonl, plusembed.vram.leasedbytes ≤ 1,495,269,376 on the device.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo