mtp_envelope.h

src/inference/mtp_envelope.h

@file mtp_envelope.h @brief Pure envelope check for the MTP speculative path (gh#108).

Owners: @tvanfossen

looks_like_mtp_head

bool entropic::looks_like_mtp_head(int n_layer)

True when the model's layer count is consistent with an MTP head GGUF.

src/inference/mtp_envelope.h:146

Show on the map →

Called by TEST_CASE, mtp_head_guard_fires

Calls none

Source · 3 lines
inline bool looks_like_mtp_head(int n_layer) {
    return n_layer >= 1 && n_layer <= 2;
}
Activity · 1 steps
lines 147–147return n_layer >= 1 && n_layer <= 2;

Requirements

REQ-INFER-015

mtp_head_classical_path_error

std::string entropic::mtp_head_classical_path_error(int n_layer)

Actionable error message for gh#107: MTP head on classical path.

src/inference/mtp_envelope.h:163

Show on the map →

Called by TEST_CASE, mtp_head_guard_fires

Calls none

Source · 6 lines
inline std::string mtp_head_classical_path_error(int n_layer) {
    return "Draft model has " + std::to_string(n_layer)
           + " layer(s) — this looks like an MTP head GGUF. "
             "Set speculative.mtp: true in your config to route through "
             "the target-owned shared-KV MTP path instead of crashing.";
}
Activity · 1 steps
lines 164–167return "Draft model has " + std::to_string(n_layer) + " layer(s) — this looks like an MTP head GGUF. " "Set speculative.mtp: true in your config to route through " "the target-owned shared-KV MTP path instead of crashing.";

Requirements

REQ-INFER-015

mtp_unsupported_reason

std::string entropic::mtp_unsupported_reason(float temperature, bool has_grammar, bool streaming)

Reason MTP cannot run for a request, or "" when the envelope is safe.

src/inference/mtp_envelope.h:123

Show on the map →

Called by TEST_CASE, mtp_guard, safe

Calls none

Source · 7 lines
inline std::string mtp_unsupported_reason(float temperature, bool has_grammar,
                                          bool streaming) {
    (void)temperature;
    (void)has_grammar;  // gh#108 v2.10.0: grammar propagated via to_common_sampling
    (void)streaming;    // gh#108 v2.10.0: StreamThinkFilter handles live strip
    return {};
}
Activity · 5 steps
lines 125–125(void)temperature;lines 126–126(void)has_grammar;lines 127–127(void)streaming;lines 128–128returnlines 128–128;

Requirements

REQ-INFER-015