1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! The real-checkpoint Qwen decode flow for [`RealForwardRunner`], serving
//! BOTH the `qwen36` family and (ROADMAP's 1-bit entry) the dense `qwen3_5`
//! one, which differ in their FFN half and in nothing else.
pub use ;
/// Re-exported for `real_forward_rollback`'s retaining rollback, whose
/// replay half lives beside the verify encoders it mirrors.
pub use replay_linear_state_batched;
pub use BatchedScratch;
pub use DflashState;
pub use ;
pub use HadamardPlan;
pub use MtpState;
pub use ;
pub use RealQwenState;
/// Both drafters a speculative caller can ask for at open, as ONE argument
/// so the opener signatures do not grow a parameter per future drafter.
///
/// At most one is ever non-`Off` in practice -- a round drafts with one
/// model -- but nothing here enforces that, because the interesting
/// failure (both asked for) is better refused where the drafter is chosen,
/// with the caller's names in the message.
pub const RMS_EPS: f32 = 1e-6;
/// The stable prefix every MoE speculation refusal opens with, named ONCE
/// because four assertion sites in two languages match on it.
///
/// Both `speculation_blocker` and `dflash_speculation_blocker` refuse a routed
/// install and each words the rest of its sentence for its own drafter, so
/// what the tests can share is this leading phrase and nothing else. Before it
/// existed the shared substring was `"dense-only"`, repeated as a literal in
/// two Rust test files and one Swift one, which is exactly how a message and
/// its guards drift apart: `5640c3f` gave the routed pair a batched kernel,
/// `c9c8848` swept the docs the same day, and all four guards went on
/// asserting a sentence that had stopped being true. Swift cannot import a
/// Rust constant, so `RealModelTests` keeps the one literal copy and says so.
///
/// **IT NAMES A POLICY, NOT A CAPABILITY.** The batched routed verify runs and
/// is gated (`families/qwen/moe_batch.rs`, bit-identical to M sequential
/// `produce` calls); what no MoE checkpoint of this architecture ships is a
/// DRAFTER this port can ingest. Lifting either arm is a checkpoint question.
pub const MOE_SPECULATION_BLOCKER_MARKER: &str = "no MoE drafter";
/// The stable prefix every vision speculation refusal opens with, named ONCE
/// for the same reason [`MOE_SPECULATION_BLOCKER_MARKER`] is: assertion sites
/// in tests match on it, and a message and its guards must not drift apart.
///
/// Both blockers refuse a vision-active arch, and `produce_batched` carries
/// the same phrase by name as the defense-in-depth arm. The condition this
/// marker names is UNREACHABLE on every install that exists today (no
/// published conversion carries both a tower and a drafter), which is exactly
/// why it is a refusal rather than a vision-aware verify pass: there is no
/// artifact to test that pass against, and an untested numeric path that
/// MUTES its own wrongness behind fluent output is the worse failure
/// (`docs/VISION.md`'s "Still not built" paragraph).
pub const VISION_SPECULATION_BLOCKER_MARKER: &str = "the verify pass is vision-blind";
use crateRealForwardRunner;
/// The trunk's tensor-name prefix.
pub const TRUNK_PREFIX: &str = "language_model.model";
/// The multi-token-prediction head's, for `prefixed_layer_tensor`.
///
/// **No trailing dot**, unlike `repack`'s `classify::MTP_PREFIX`. The two
/// answer different questions and are deliberately not shared: that one
/// MATCHES a name (`name.starts_with("mtp.")`) and this one BUILDS one
/// (`format!("{prefix}.layers.{layer}.{suffix}")`), so a single constant
/// would be wrong at one of the two sites.
pub const MTP_PREFIX: &str = "mtp";
pub
/// [`layer_tensor`] under an explicit prefix.
///
/// The ONLY reason this exists is the multi-token-prediction head
/// (`docs/MTP_SPECULATIVE.md`), whose single block is shape-identical to a
/// trunk full-attention layer field for field and so can run the SAME
/// encoders under `mtp.layers.0.*` -- rather than a second copy of them,
/// which is what Gotcha 11 is about the cost of.
///
/// It is a STRING change and not a flow change: every caller passing
/// [`TRUNK_PREFIX`] resolves the byte-identical name it resolved before, and
/// `qwen38_quality_gate` was re-run to say so rather than to hope so.
pub