use anyhow::{Result, bail};
use metrale_config::ModelConfig;
use crate::cli;
pub(super) fn refuse_speculation_over_mamba2(
args: &cli::ServeArgs,
config: &ModelConfig,
) -> Result<()> {
if args.speculative_proposer_requested() && config.has_mamba2_layers() {
bail!(
"speculative decoding is not supported for `{}`: it has {} Mamba-2 layers, and \
speculative verify cannot roll Mamba-2 state back after a rejected draft (the \
rollback copies 0 bytes of it), so output would silently diverge. Serve without \
--speculative, --self-speculative, --ngram-speculative and --dflash.",
config.model_type,
config.num_ssm_layers(),
);
}
Ok(())
}
#[cfg(test)]
#[path = "mamba2_spec_tests.rs"]
mod tests;