Skip to main content

ferrox_models/
minimax_engine.rs

1//! MiniMax M2/M3 dedicated stack stub — not generic GQA.
2//!
3//! Real checkpoints tag `minimax-m2` / `minimax-m3` with 256-expert
4//! sigmoid MoE and MTP (multi-token prediction) draft heads. Required
5//! tensors (llama.cpp `minimax*.cpp` graph), not implemented here:
6//!
7//! - Standard emb/norm/output head
8//! - MoE: `ffn_gate_inp`, `ffn_gate_exps`, `ffn_up_exps`, `ffn_down_exps`,
9//!   `ffn_exp_probs_b.bias` (sigmoid / `noaux_tc` routing)
10//! - MTP: `num_nextn_predict_layers` draft-head tensors (`nextn.*` in
11//!   llama.cpp) — see `docs/CLI.md` `--mtp` (honest fail until loaded)
12//!
13//! Fail-closed via [`Self::reject`] until loader + engine land.
14
15use thiserror::Error;
16
17#[derive(Debug, Error)]
18#[error("MiniMax dedicated engine not implemented: {reason}")]
19pub struct MinimaxUnavailable {
20    pub reason: &'static str,
21}
22
23pub struct MinimaxEngine {
24    pub arch: String,
25}
26
27impl MinimaxEngine {
28    /// Refuses, naming what exists and what does not.
29    ///
30    /// The block-sparse SELECTION is ported and tested
31    /// ([`ferrox_core::block_sparse`]): which 128-token KV blocks a
32    /// query may read, per KV head, with the force-included first and
33    /// newest blocks that keep a selection from ever being empty. What
34    /// is absent is everything around it -- the loader, the 256-expert
35    /// sigmoid MoE, and the MTP draft heads -- so there is nothing for
36    /// that selection to select over yet.
37    ///
38    /// Saying which half exists matters: a bare "not implemented"
39    /// invites the next reader to re-port the selection rule that is
40    /// already here and already covered.
41    pub fn reject(_arch: &str) -> Result<(), MinimaxUnavailable> {
42        Err(MinimaxUnavailable {
43            reason: "MiniMax needs a loader, 256-expert sigmoid MoE routing and MTP draft heads, \
44                     none of which exist yet. Its block-sparse attention SELECTION is ported and \
45                     tested (ferrox_core::block_sparse); only the engine around it is missing",
46        })
47    }
48}
49
50#[cfg(test)]
51mod tests {
52    use super::*;
53
54    #[test]
55    fn reject_is_fail_closed() {
56        assert!(MinimaxEngine::reject("minimax-m2").is_err());
57    }
58}