ARCHITECTURE / 架构

One execution cycle.
Every part accounted for.

DeepInfer-derived scheduling meets native MLX execution and exact hybrid-state recovery. 从请求入口到下一轮预算,保持清晰的执行边界。

ENGINE / APPLE SILICON MLX + METAL
CLIOpenAI APILocal UI
↓
01
Exact contextBounded cache · isolated snapshots
⌘
↓
ADAPTIVE DECODE LOOPCOST-AWARE
Draftpropose
→
Targetverify
→
Recoverreplay
↓
Text stream+ observable decisions
LOCAL EXECUTION. INSPECTABLE BY DESIGN.
THE REQUEST PATH

One engine, three entrances.

CLI, local UI and a supported OpenAI-compatible chat API share a strict request schema and a bounded FIFO worker. A single inference owner executes MLX on Metal and returns text events with request metrics.

Baseline generation uses MLX-LM sampling. The explicit configured path adds a locked draft model, cost-aware budget selection and exact recovery for Qwen3.5 hybrid state.

Execution layers and source attribution ↗
EXPLORE THE CYCLE / 探索执行周期

Choose. Verify. Recover.

Select a stage to explore its implemented responsibility. This diagram explains the architecture; the measured trace is linked in the milestones.

ACCEPTANCE × COMPLETE-CYCLE COST

Choose a budget from observed work.

The MTPVarlen-derived core selects an expected-yield / cost budget. A lagged mean recovery adapter feeds measured complete-cycle costs, keeping scheduling history distinct from partial, interrupted rounds.

observed cycle → cost curve → next draft budgetCore method and adaptation ↗
01 / ADAPT

Make the budget a decision.

A DeepInfer MTPVarlen-derived scheduler uses observed acceptance and complete-cycle cost to choose the next draft budget. Decisions can be replayed against the original C++ reference.

02 / RECOVER

Preserve the exact state.

Hybrid attention and recurrent state travel together. Checkpoint, restore and replay the consumed prefix when a draft is rejected, keeping mutable branches isolated.

03 / REUSE

Carry context forward.

Native MLX-LM LRU reuse and exact hybrid snapshots share a bounded cache interface. Verified message boundaries create reusable checkpoints for repeated and changed-tail requests.

MLX / MLX-LM supply model execution, sampling and native LRU reuse. The scheduler reimplements pinned DeepInfer methods; hybrid recovery, service integration and measurement are Mac adaptations. Full attribution lives in the source mapping and NOTICE.

MULTI-REQUEST / 多请求执行

Many requests.
One accountable lifecycle.

Bounded admission, per-request state and cancellation recovery now connect to real joint target verification. The joint service passed 35/35 functional checks with distinct SmolLM2 360M target and 135M draft models, including concurrent requests, actual token SSE and recovery after cancellation.

330 portable tests + 48 real Metal tests passed at this checkpoint. The small models are engineering controls; Qwen3.5-9B remains the primary demonstration. Default service uses baseline; joint execution is explicit opt-in.

MECHANISM ILLUSTRATION / 机制示意 · PHASE 3

A shared budget.
Different request depths.

Explore the allocation mechanism: cumulative prefix survival ranks candidate verification positions across requests. The numbers below are illustrative inputs, not model measurements or benchmark results.

5 / 9

Fixed example conditional acceptance inputs: A [0.95, 0.90, 0.85], B [0.80, 0.60, 0.40], C [0.60, 0.50, 0.30]. Each position's score is the cumulative product. Equal scores use request order then position order. This view illustrates allocation only; cost-based total-budget selection, real verification and recovery remain separate responsibilities.

This browser-only mechanism illustration executes no model and makes no latency claim. The separate joint-service report records actual model execution, streaming and cancellation checks.

Follow the implementation.