Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9df67ed
Enable adaptive verify window for ngram/draft speculation
michaelneale Jul 19, 2026
141ef39
Replace speculative rollback with positional MTP n-gram pipelining
i386 Jul 20, 2026
c06bca6
Pipeline speculative verify windows across latency
i386 Jul 20, 2026
55db388
Fix positional correction and adaptive pipeline depth
i386 Jul 20, 2026
0b3720c
Continuously refill the speculative horizon
i386 Jul 20, 2026
20e457a
Productionize pipelined MTP n-gram speculation
i386 Jul 20, 2026
87de12b
Fix speculative docs and UI formatting
i386 Jul 20, 2026
5b824cb
Remove stale speculative projections and fix CI
i386 Jul 20, 2026
296c949
Handle fragmented direct-return fallback replies
i386 Jul 21, 2026
2af07bc
Replace speculative repair with fixed-depth positional pipeline
i386 Jul 21, 2026
68f4502
Expose split-stage compute overlap telemetry
i386 Jul 21, 2026
7f8ef6c
Lock split topology placement
i386 Jul 21, 2026
9160b31
Document locked split topology
i386 Jul 21, 2026
1d02631
Address locked topology review feedback
i386 Jul 21, 2026
bd940a2
Merge locked split topology for deterministic benchmarks
i386 Jul 21, 2026
479a4e1
Fix SPEED-Bench timing JSONL output
i386 Jul 22, 2026
c8227ef
Bound benchmark telemetry finalization
i386 Jul 22, 2026
6006848
Hash SPEED-Bench request and response pairs
i386 Jul 22, 2026
87e691a
mesh: stop re-applying formation-time RTT gate to operational stage s…
michaelneale Jul 22, 2026
34bd3b8
skippy: raise return-sink ready timeout 5s->20s for cold WAN bridge s…
michaelneale Jul 22, 2026
c05355a
runtime: relaunch withdrawn splits when peers return instead of endin…
michaelneale Jul 22, 2026
05dae2a
Merge remote-tracking branch 'origin/main' into agent/positional-mtp-…
michaelneale Jul 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions SKIPPY_PROTOCOL_TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,28 +155,23 @@ chunk and every normal decode token.

## E. State Lifecycle Efficiency

- [ ] Reduce checkpoint and restore round trips for speculative decode.
- Avoid checkpointing every `VerifySpan` when a cheaper journal or suffix
trim can preserve correctness.
- Use `SKIP_VERIFY_CHECKPOINT` only when the repair path is proven safe.

- [ ] Add speculative journals.
- Record enough per-stage state to commit or discard a verify span without a
full restore where possible.

- [ ] Improve suffix trim semantics.
- Make rejected speculative suffix rollback cheaper than full session restore.
- Validate recurrent-state families separately from transformer-only KV.
- [x] Make speculative positions authoritative in stage-state v9.
- Decode and `VerifyWindow` messages carry the absolute position each stage
must have before execution.
- Stages ahead of that position rewind attention KV locally.
- Speculation never checkpoints, restores, trims by control message, or
replays a rejected prefix.
- Recurrent-state stages reject positional speculation instead of falling
back to the removed checkpoint protocol.

- [ ] Add checkpoint hierarchy.
- Keep coarse prompt checkpoints and lightweight decode-span checkpoints.
- Keep coarse prompt checkpoints for non-speculative session/cache workflows.
- Evict checkpoint state with explicit memory accounting.

- [ ] Track state-control latency separately from activation latency.
- Emit checkpoint, restore, trim, prefix-restore, and decode-fuse timings per
stage.
- Use these metrics to decide whether direct final replies or journaled
rollback should land first.
- Keep speculative position-rewind counts and trimmed-token totals separate.

## Validation Gates

Expand Down
9 changes: 4 additions & 5 deletions crates/mesh-llm-cli/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct BenchmarkTuneCommand {
/// Flash attention values to benchmark independently: on, off.
#[arg(long = "flash-attention", value_delimiter = ',')]
pub flash_attention: Vec<BenchmarkFlashAttention>,
/// Speculative decoding types to benchmark: auto, disabled, mtp, draft, ngram.
/// Speculative decoding types to benchmark: auto, disabled, mtp, draft, mtp-ngram.
#[arg(
long = "speculative-types",
value_delimiter = ',',
Expand Down Expand Up @@ -83,10 +83,10 @@ pub struct BenchmarkTuneCommand {
/// Candidate minimum draft-token windows for MTP and draft speculation.
#[arg(long = "spec-draft-min-tokens", value_delimiter = ',')]
pub spec_draft_min_tokens: Vec<u32>,
/// Candidate minimum ngram draft-token counts for ngram speculation.
/// Candidate minimum match lengths for MTP + N-gram speculation.
#[arg(long = "spec-ngram-min", value_delimiter = ',')]
pub spec_ngram_min: Vec<u32>,
/// Candidate maximum ngram draft-token counts for ngram speculation.
/// Candidate maximum match lengths for MTP + N-gram speculation.
#[arg(long = "spec-ngram-max", value_delimiter = ',')]
pub spec_ngram_max: Vec<u32>,
/// Candidate draft-acceptance-threshold values for speculative draft sweeps.
Expand Down Expand Up @@ -158,8 +158,7 @@ pub enum BenchmarkSpeculativeType {
Disabled,
Mtp,
Draft,
#[value(alias = "ngram-mod")]
Ngram,
MtpNgram,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)]
Expand Down
5 changes: 2 additions & 3 deletions crates/mesh-llm-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub use mesh_llm_events::LogFormat;
pub use parser::{
AuthCommand, BinaryFlavor, Cli, Command, ConfigCommand, DiscoveryScope, DoctorCommand,
GpuCommand, MeshDiscoveryMode, MeshGuardrailCliMode, NormalizedRuntimeArgs, PluginCommand,
RuntimeSurface, SkillAgentArg, SkillCommand, SpeculativeNgramProposerCli, TrustCommand,
TrustPolicy, legacy_runtime_surface_warning, normalize_runtime_surface_args,
validate_discovery_mode_args,
RuntimeSurface, SkillAgentArg, SkillCommand, TrustCommand, TrustPolicy,
legacy_runtime_surface_warning, normalize_runtime_surface_args, validate_discovery_mode_args,
};
2 changes: 1 addition & 1 deletion crates/mesh-llm-cli/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod validation;
pub use commands::{
AuthCommand, BinaryFlavor, Cli, Command, ConfigCommand, DiscoveryScope, DoctorCommand,
GpuCommand, MeshDiscoveryMode, MeshGuardrailCliMode, PluginCommand, SkillAgentArg,
SkillCommand, SpeculativeNgramProposerCli, TrustCommand, TrustPolicy,
SkillCommand, TrustCommand, TrustPolicy,
};
pub use normalization::{
NormalizedRuntimeArgs, RuntimeSurface, legacy_runtime_surface_warning,
Expand Down
45 changes: 10 additions & 35 deletions crates/mesh-llm-cli/src/parser/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,21 +395,6 @@ impl MeshGuardrailCliMode {
}
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)]
pub enum SpeculativeNgramProposerCli {
Simple,
Cache,
}

impl SpeculativeNgramProposerCli {
pub const fn as_str(self) -> &'static str {
match self {
Self::Simple => "simple",
Self::Cache => "cache",
}
}
}

#[derive(Parser, Debug)]
#[command(
name = "mesh-llm",
Expand Down Expand Up @@ -544,15 +529,11 @@ pub struct Cli {
#[arg(long, hide = true)]
pub speculative_strategy: Option<String>,

/// Override the N-gram proposer kind for this invocation.
#[arg(long, value_enum, hide = true)]
pub speculative_ngram_proposer: Option<SpeculativeNgramProposerCli>,

/// Minimum matching N-gram length for a direct N-gram proposer.
/// Minimum matching N-gram length for the request-local MTP cache extension.
#[arg(long, hide = true)]
pub speculative_ngram_min: Option<u32>,

/// Maximum matching N-gram length for a direct N-gram proposer.
/// Maximum matching N-gram length for the request-local MTP cache extension.
#[arg(long, hide = true)]
pub speculative_ngram_max: Option<u32>,

Expand Down Expand Up @@ -1160,8 +1141,6 @@ mod tests {
"serve",
"--speculative-strategy",
"mtp-cache",
"--speculative-ngram-proposer",
"cache",
"--speculative-ngram-min",
"2",
"--speculative-ngram-max",
Expand All @@ -1174,10 +1153,6 @@ mod tests {
]);
let cli = Cli::try_parse_from(normalized.normalized).expect("clap parse");
assert_eq!(cli.speculative_strategy.as_deref(), Some("mtp-cache"));
assert_eq!(
cli.speculative_ngram_proposer,
Some(SpeculativeNgramProposerCli::Cache)
);
assert_eq!(cli.speculative_ngram_min, Some(2));
assert_eq!(cli.speculative_ngram_max, Some(6));
assert_eq!(cli.speculative_extension_max_tokens, Some(8));
Expand Down Expand Up @@ -1256,17 +1231,17 @@ mod tests {
"--mlock-values",
"true,false",
"--speculative-types",
"mtp,draft,ngram,disabled",
"mtp,draft,mtp-ngram,disabled",
"--spec-draft-models",
"/models/qwen-draft.gguf",
"--spec-draft-max-tokens",
"4,8",
"--spec-draft-min-tokens",
"1,2",
"--spec-ngram-min",
"12,24",
"2,3",
"--spec-ngram-max",
"48,64",
"3,4",
"--throughput-tolerance-pct",
"2.5",
"--max-tokens",
Expand Down Expand Up @@ -1333,7 +1308,7 @@ mod tests {
vec![
crate::benchmark::BenchmarkSpeculativeType::Mtp,
crate::benchmark::BenchmarkSpeculativeType::Draft,
crate::benchmark::BenchmarkSpeculativeType::Ngram,
crate::benchmark::BenchmarkSpeculativeType::MtpNgram,
crate::benchmark::BenchmarkSpeculativeType::Disabled,
]
);
Expand All @@ -1344,8 +1319,8 @@ mod tests {
);
assert_eq!(tune.spec_draft_max_tokens, vec![4, 8]);
assert_eq!(tune.spec_draft_min_tokens, vec![1, 2]);
assert_eq!(tune.spec_ngram_min, vec![12, 24]);
assert_eq!(tune.spec_ngram_max, vec![48, 64]);
assert_eq!(tune.spec_ngram_min, vec![2, 3]);
assert_eq!(tune.spec_ngram_max, vec![3, 4]);
}

#[test]
Expand Down Expand Up @@ -1373,8 +1348,8 @@ mod tests {
("--spec-draft-models", "/models/draft.gguf"),
("--spec-draft-max-tokens", "8"),
("--spec-draft-min-tokens", "2"),
("--spec-ngram-min", "12"),
("--spec-ngram-max", "48"),
("--spec-ngram-min", "2"),
("--spec-ngram-max", "4"),
] {
let err = Cli::try_parse_from([
"mesh-llm",
Expand Down
16 changes: 8 additions & 8 deletions crates/mesh-llm-commands/src/gpus/tune/benchmark/candidates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub(crate) fn benchmark_speculative_values(
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::Draft => {
push_draft_speculative_candidates(&mut candidates, request, prepared);
}
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::Ngram => {
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::MtpNgram => {
push_ngram_speculative_candidates(&mut candidates, request);
}
}
Expand All @@ -264,7 +264,7 @@ pub(crate) fn speculative_type_priority(
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::Auto => 0,
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::Mtp => 1,
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::Draft => 2,
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::Ngram => 3,
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::MtpNgram => 3,
mesh_llm_cli::benchmark::BenchmarkSpeculativeType::Disabled => 4,
}
}
Expand All @@ -276,9 +276,9 @@ pub(crate) fn push_auto_speculative_candidates(
) {
if looks_like_mtp_target(prepared) {
push_mtp_speculative_candidates(candidates, request, prepared);
push_ngram_speculative_candidates(candidates, request);
}
push_draft_speculative_candidates(candidates, request, prepared);
push_ngram_speculative_candidates(candidates, request);
candidates.push(TuneBenchmarkSpeculativeCandidate::Disabled);
}

Expand Down Expand Up @@ -446,12 +446,12 @@ pub(crate) fn push_ngram_speculative_candidates(
candidates: &mut Vec<TuneBenchmarkSpeculativeCandidate>,
request: &TuneBenchmarkRunRequest<'_>,
) {
let ngram_min_values = positive_or_default(request.spec_ngram_min, &[12, 24]);
let ngram_max_values = positive_or_default(request.spec_ngram_max, &[48, 64]);
let ngram_min_values = positive_or_default(request.spec_ngram_min, &[2]);
let ngram_max_values = positive_or_default(request.spec_ngram_max, &[4]);
for ngram_min in &ngram_min_values {
for ngram_max in &ngram_max_values {
if ngram_min <= ngram_max {
candidates.push(TuneBenchmarkSpeculativeCandidate::Ngram {
candidates.push(TuneBenchmarkSpeculativeCandidate::MtpNgram {
ngram_min: *ngram_min,
ngram_max: *ngram_max,
});
Expand Down Expand Up @@ -631,10 +631,10 @@ pub(crate) fn speculative_candidate_sort_key(
fmt_prob(*draft_acceptance_threshold),
fmt_prob(*draft_split_probability),
),
TuneBenchmarkSpeculativeCandidate::Ngram {
TuneBenchmarkSpeculativeCandidate::MtpNgram {
ngram_min,
ngram_max,
} => format!("2:ngram:{ngram_min}:{ngram_max}"),
} => format!("2:mtp-ngram:{ngram_min}:{ngram_max}"),
TuneBenchmarkSpeculativeCandidate::Disabled => "9:disabled".to_string(),
}
}
Expand Down
Loading
Loading