Module drafter_context

Module drafter_context 

Source
Expand description

2026-09-25: Resolution of the MTP drafter context from the environment: whether the drafter KV is batch-prefilled over the prompt (prefill) and whether it is carried across the turns of a session (carry).

Carry depends on prefill. In the model’s trait_impl/speculative.rs a carried drafter KV is adopted (try_carry_drafter) only inside if !self.mtp_prefill_hidden.is_null(), and the model allocates that capture only when drafter.prefill is set (layers::mtp_drafter_prefill_enabled), so the two are resolved together. A configured carry is armed only in single-sequence MTP (mtp_carry::carry_armed).

variable (exactly 1)result
neitherDrafterContext::BOTH
METRALE_NO_MTP_DRAFTER_CONTEXTDrafterContext::OFF
METRALE_MTP_DRAFTER_CONTEXT_PREFILL_ONLY_UNSAFEprefill on, carry off; warned at startup

Any other value, 0 included, changes nothing.

Owner: model-layers (MTP drafter). Invariants:

  • resolve never returns carry without prefill.
  • The kill switch wins over the prefill-only variable.

Structs§

DrafterContext
2026-09-25: Which halves of the drafter context are configured. resolve never returns carry without prefill.

Constants§

DISABLE_ENV
2026-09-25: Kill switch for both halves; only the exact value 1 counts.
PREFILL_ONLY_ENV
2026-09-25: Prefill without carry; only the exact value 1 counts, and DISABLE_ENV wins over it.

Functions§

resolve
2026-09-25: Resolve the two variables’ values with no environment access, so the rule is unit-tested (SBIO). disable wins over prefill_only.
resolve_from_env
2026-09-25: Resolve the policy from the environment. ModelLevers::from_env calls it, and the result is ModelLevers::drafter. The outcome is logged once per process (REPORTED).