Skip to content

One mind decodes at a time: the serving plan holds one engine slot - #6129

Closed
joelteply wants to merge 1 commit into
canaryfrom
fable/one-mind-one-slot
Closed

joelteply wants to merge 1 commit into
canaryfrom
fable/one-mind-one-slot

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves the minds' speed: one mind at a time at the full single-stream rate, never several contending (MEMORY: one mind decodes at a time).

The live M5 runs --parallel 5 -c 745985 because demand.rs planned residents + 1 lanes. Page saves waited behind other minds' decodes for up to 11.6 s (inference.kv_page.action, 05:13-05:16Z: 6.8 / 8.7 / 13.1 s total, 0.8-1.5 s engine).

Change: lanes = residents.min(1). One sequence in the engine; helper calls borrow it through the existing single-slot save-and-lend path. No scratch slot, since helpers decoding beside the mind is parallel too.

Measured

After deploy (owner Fable): page-action wait_ms near zero, decode tok/s at the single-stream rate, acts/hour at 4 residents vs 05:14Z (23 acts/h, 87% reuse). Next step: the RAM-tier page so the switch itself drops from seconds to ms (CONTINUUM-ENGINE 4.14, #6092).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ever one per resident

Joel, 2026-11-18: "Never run the parallel." demand.rs planned residents + 1 lanes, so the M5
launched llama-server with --parallel 5 -c 745985: five minds resident in the engine at once.
Each switch's page save waited behind another mind's decode, up to 11.6 s (inference.kv_page.action
05:13-05:16Z: saves 6.8 / 8.7 / 13.1 s, of which the engine's own copy was 0.8-1.5 s).

The plan is now one slot: the active mind. Every other resident is paged out and her page moves
in on the switch; a helper call borrows the one slot through the existing single-slot
save-and-lend path (inference/slots). No scratch slot: helper calls decoding beside the mind is
parallel decode too.

Measured after deploy (owner Fable): page-action wait_ms near zero, decode tok/s per act at the
single-stream rate, acts/hour at 4 residents vs the 05:14Z health line (23 acts, 87% reuse).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Closed: wrong shape (Joel). A lane count passed to llama-server's --parallel is a flag on someone else's scheduler, not one-mind-at-a-time. The fix is the persona engine as formal objects (CONTINUUM-ENGINE 4.14, #6092): one active PersonaUnit, the next staged, the previous retired to the RAM tier; there is no slot count to plan.

@joelteply joelteply closed this Nov 18, 2026
joelteply added a commit that referenced this pull request Nov 18, 2026
…API before integration) (#6130)

* The persona engine's objects: PersonaUnit moves whole, Roles holds exactly one active mind, Tier and NextPolicy are traits

CONTINUUM-ENGINE 4.14, API before integration (Codex). One mind decodes at a time by
construction: Roles has one active place; the next is staged as data under its copy-in fence;
handoff binds her only after that fence and moves the previous mind to retiring under its
copy-out fence; release_retired gives her back to her tier only once it lands. PersonaUnit owns
her five parts and assemble() refuses a partial move by name. Tier (one contract for device,
host, unified and flash) and NextPolicy (who is next, learnable) are the traits the native
adapters over the fork's llama_persona_* / llama_state_seq_* calls implement next. The engine is
libllama called through its API in-process: no llama-server, no launch flags, no slot count.

Contract tests (pipeline/tests.rs): one active mind and the next staged not decoding;
fence-before-ready; retire-after-handoff with the previous retirement landing first;
refuse-partial; no mind in two places. Lints deny unwrap/expect/panic.

Replaces #6129 (a lane count on llama-server's --parallel), closed per Joel: objects, not flags.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Cascade persona suspension through its declared parts

* Poll sibling suspension futures together while fences are pending

* Exercise the independent persona engine in CI scope fixtures

* Every refusal returns custody; the copy-out begins after the bind; fences are tagged; a partial unit cannot be built (Codex on #6130)

- Roles::stage returns the unit and its copy-in fence on every refusal (Refused { reason, returned })
  and refuses a fence for another persona, epoch or direction.
- Roles::handoff takes no fence: it binds next once her copy-in lands and leaves the previous
  mind AwaitingCopyOut, so no read of her blocks starts before she stops being active. The
  completion owner begins the copy-out after the bind and attaches it with begin_retire, which
  returns the fence on refusal (nobody retiring, already moving, wrong tag). release_retired
  waits for it to land; the next handoff waits for the release.
- Fence carries a FenceTag (persona, epoch, direction).
- PersonaUnit::assemble and PartialMove are gone: the only constructor takes a complete
  PersonaParts (Codex's single declaration, #6131), so a partial move is unrepresentable.
- Contract tests use non-Clone, drop-counted units and fences: a refusal that drops custody fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The Core describes the exact copy-out to begin; Tier::begin takes that typed descriptor (Codex on #6130)

Tier::copy_in/copy_out(PersonaId) become Tier::begin(FenceTag): the adapter is handed her persona,
epoch and direction, and the fence it returns carries the same tag. Roles::awaiting_copy_out
returns the FenceTag of the mind awaiting her copy-out, so the completion owner begins exactly
that transfer with no second lookup by id that could name another generation. Test: a test tier
begins the described copy-out (accepted, released with her epoch); a transfer of a stale epoch is
refused with its fence returned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Persona engine tests: the test part's behaviours are one enum, and each test expect names its precondition (state_as_flags, unjustified_unwraps)

Codex's lifecycle fixture held release_after_retry and failure as two bools (four states, three
used): now Behaviour { Ready, PendingOnce, Fails }. Each expect in the pipeline contract tests
carries its same-line justification.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant