Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2ea9412
refset, tools: mainline's Qwen3.6 MTP step taps as a reference set
midagedev Oct 15, 2026
8fcd684
tools, refset: the oracle harnesses share one input and output contra…
midagedev Oct 15, 2026
9f25fcc
refset: the MTP step family names its build through the mainline tree…
midagedev Oct 15, 2026
e4c1e9a
refset, tools: an MTP step set's trailer counts its tap rows, and one…
midagedev Oct 15, 2026
e6f28bc
refset: the MTP step set tests hold the trailer's zero field and each…
midagedev Oct 15, 2026
b16206f
tools: dump-q35mtp --cpu writes only a set Q35MTP_SET names
midagedev Oct 15, 2026
ca32804
tools: the ik dumpers read --tokens-count through ref_io.h and refuse…
midagedev Oct 15, 2026
316f3b1
refset, tools: one owner for a header's one value, a set's file name …
midagedev Oct 15, 2026
a3c06b3
tools, refset: the ik dumpers read ids through ref_io.h, and the MTP …
midagedev Oct 15, 2026
478d5a2
refset: one f32 file reader for the MTP step and nemotron sets, and t…
midagedev Oct 15, 2026
4e85602
tools: dump-q35mtp's staging cleanup is ref-paths.sh's
midagedev Oct 15, 2026
80bc2cd
refset, tools: the nemotron reader takes columns::need, the prose ids…
midagedev Oct 15, 2026
3a4fce7
refset: the nemotron tests take testkit::scratch, and an MTP step set…
midagedev Oct 15, 2026
02dae20
tools, refset: dump_ref's --tokens list and the ik dumpers' typed wri…
midagedev Oct 15, 2026
d1ac016
refset: the MTP step set tests hold a tap file name's backslash and N…
midagedev Oct 15, 2026
b014ab2
refset: an MTP step set refuses a repeated # rows entry, and one i32 …
midagedev Oct 15, 2026
c72bba8
refset: the MTP step set tests hold the empty-set guard on a set with…
midagedev Oct 15, 2026
a4e7111
refset, tools, gpu-gates: a reference f32 value is finite, an unreada…
midagedev Oct 15, 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
7 changes: 4 additions & 3 deletions crates/gpu-gates/src/bin/gate_qwen35moe_mtp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ mod gate {

const WHAT: &str = "gate_qwen35moe_mtp";

/// The file the gate runs on: unsloth's `UD-Q4_K_M` with its next-token
/// layer. Pinned by `general.name` and by its size in bytes.
const DRAFT_FILE: &str = "/models/qwen36-hf/unsloth-mtp/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf";
// The file the gate runs on: unsloth's `UD-Q4_K_M` with its next-token
// layer (the MTP step family's file). Pinned by `general.name` and by its
// size in bytes.
use refset::arch::qwen35moe::mtp::MODEL as DRAFT_FILE;
const DRAFT_NAME: &str = "Qwen3.6-35B-A3B";
const DRAFT_BYTES: u64 = 22_663_387_424;

Expand Down
30 changes: 12 additions & 18 deletions crates/refset/src/arch/nemotron_h/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub static FAMILIES: &[&Family] = &[&LOGITS];
mod tests {
use super::LOGITS;
use crate::RefError;
use crate::clefvis::testkit::scratch as dir;
use crate::family::Build;
use crate::nemotron::LogitsSet;
use std::path::Path;
Expand Down Expand Up @@ -67,13 +68,6 @@ mod tests {
std::fs::write(dir.join("MANIFEST.tsv"), text).unwrap_or_else(|e| panic!("{e}"));
}

fn dir(tag: &str) -> std::path::PathBuf {
let d =
std::env::temp_dir().join(format!("bloomery-nemotron-{tag}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&d);
d
}

/// The build pin is the tokenizer family's constant.
#[test]
fn the_build_pin_is_the_tokenizer_familys() {
Expand All @@ -93,7 +87,7 @@ mod tests {
/// A finished set opens, and `logits` is that column's file.
#[test]
fn a_finished_set_reads_logits_by_column_name() {
let d = dir("ok");
let d = dir("nemotron-ok");
write(&d, &runs(), pin(), true);
let set = LogitsSet::open(&d, &LOGITS).unwrap_or_else(|e| panic!("{e}"));
assert_eq!(set.prompts.len(), 1);
Expand All @@ -107,7 +101,7 @@ mod tests {
/// No `# complete`: unfinished, even when the other lines are well formed.
#[test]
fn a_set_without_its_trailer_is_unfinished() {
let d = dir("trailer");
let d = dir("nemotron-trailer");
write(&d, &runs(), pin(), false);
match LogitsSet::open(&d, &LOGITS) {
Err(RefError::Unfinished { set }) => assert_eq!(set, d.display().to_string()),
Expand All @@ -119,7 +113,7 @@ mod tests {
/// Another model path is stale.
#[test]
fn a_set_of_another_model_is_stale() {
let d = dir("model");
let d = dir("nemotron-model");
write(&d, "/models/other/file.gguf", pin(), true);
match LogitsSet::open(&d, &LOGITS) {
Err(RefError::Stale { dumped_from, .. }) => {
Expand All @@ -133,7 +127,7 @@ mod tests {
/// Another mainline build is foreign.
#[test]
fn a_set_of_another_build_is_foreign() {
let d = dir("build");
let d = dir("nemotron-build");
write(
&d,
&runs(),
Expand All @@ -150,7 +144,7 @@ mod tests {
/// A line that is not a token id is malformed, naming the field and the text.
#[test]
fn a_token_line_that_is_not_an_id_is_malformed() {
let d = dir("bad-id");
let d = dir("nemotron-bad-id");
write(&d, &runs(), pin(), true);
std::fs::write(d.join("p.ids"), "0\n1\n2\ngarbage\n0\n").unwrap_or_else(|e| panic!("{e}"));
match LogitsSet::open(&d, &LOGITS) {
Expand All @@ -168,7 +162,7 @@ mod tests {
/// A NaN or infinite logit is malformed, naming its index.
#[test]
fn a_non_finite_logit_is_malformed() {
let d = dir("nan-logit");
let d = dir("nemotron-nan-logit");
write(&d, &runs(), pin(), true);
let logits: Vec<u8> = [0.0f32, f32::NAN, -0.5, 0.25]
.into_iter()
Expand All @@ -177,7 +171,7 @@ mod tests {
std::fs::write(d.join("p.logits.f32"), logits).unwrap_or_else(|e| panic!("{e}"));
match LogitsSet::open(&d, &LOGITS) {
Err(RefError::Malformed { what, .. }) => {
assert!(what.contains("non-finite logit at index 1"), "{what}");
assert!(what.contains("non-finite value at index 1"), "{what}");
}
other => panic!("a non-finite logit: {other:?}"),
}
Expand All @@ -187,7 +181,7 @@ mod tests {
/// An empty line among the ids is malformed, as the C++ reader that writes the set refuses it.
#[test]
fn an_empty_token_line_is_malformed() {
let d = dir("empty-id");
let d = dir("nemotron-empty-id");
write(&d, &runs(), pin(), true);
std::fs::write(d.join("p.ids"), "0\n\n1\n2\n3\n0\n").unwrap_or_else(|e| panic!("{e}"));
match LogitsSet::open(&d, &LOGITS) {
Expand All @@ -202,7 +196,7 @@ mod tests {
/// An id at or past `n_vocab` is malformed, naming the id and the vocabulary.
#[test]
fn a_token_id_outside_the_vocabulary_is_malformed() {
let d = dir("oob-id");
let d = dir("nemotron-oob-id");
write(&d, &runs(), pin(), true);
std::fs::write(d.join("p.ids"), "0\n1\n2\n3\n4\n").unwrap_or_else(|e| panic!("{e}"));
match LogitsSet::open(&d, &LOGITS) {
Expand All @@ -217,7 +211,7 @@ mod tests {
/// The trailer's count is the prompt rows. One row and `# complete 2` is malformed.
#[test]
fn a_completion_count_that_is_not_the_prompt_rows_is_malformed() {
let d = dir("complete-n");
let d = dir("nemotron-complete-n");
write(&d, &runs(), pin(), true);
let text =
std::fs::read_to_string(d.join("MANIFEST.tsv")).unwrap_or_else(|e| panic!("{e}"));
Expand All @@ -238,7 +232,7 @@ mod tests {
/// A completion count that does not parse is malformed, naming the field.
#[test]
fn a_completion_count_that_does_not_parse_is_malformed() {
let d = dir("complete-bad");
let d = dir("nemotron-complete-bad");
write(&d, &runs(), pin(), true);
let text =
std::fs::read_to_string(d.join("MANIFEST.tsv")).unwrap_or_else(|e| panic!("{e}"));
Expand Down
2 changes: 2 additions & 0 deletions crates/refset/src/arch/qwen35moe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::RefError;
use crate::family::{Build, Family, Identity};

pub mod fixture;
pub mod mtp;
pub mod vis;

/// The file every qwen35moe set is dumped from and the tree runs. The
Expand Down Expand Up @@ -56,6 +57,7 @@ pub static IK: Family = Family {
pub static FAMILIES: &[&Family] = &[
&IK,
&fixture::IK,
&mtp::MAINLINE,
&vis::TAPS,
&vis::CHATIDS,
&vis::HIDDEN,
Expand Down
37 changes: 37 additions & 0 deletions crates/refset/src/arch/qwen35moe/mtp.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//! The Qwen3.6 MTP step oracle: llama.cpp mainline's next-token graph
//! (`llama_model_qwen35moe::graph_mtp`) tap by tap, on the first 64 prose ids fed teacher-forced
//! (`tools/ref/q35mtp_ref.cpp`, `just dump-ref-q35mtp`), read by [`crate::mtptaps::TapSet`], at the mainline tree
//! [`QVIS_LCPP_BUILD`] (`MTP_LCPP` of tools/ref/models/qwen35moe.sh). The file is
//! unsloth's UD-Q4_K_M, the one with the next-token layer (`blk.40`); the node dumps' file has none.

use crate::RefError;
use crate::clefvis::QVIS_LCPP_BUILD;
use crate::family::{Build, Family, Identity};

/// The file the set is dumped from and the tree runs: the Q4_K_M mix that carries the next-token layer.
pub const MODEL: &str = "/models/qwen36-hf/unsloth-mtp/Qwen3.6-35B-A3B-UD-Q4_K_M.gguf";

/// The set: 63 steps over the first 64 prose ids, taps at four of them.
pub const SET: &str = "ref-mtp/qwen35moe_mainline_prose64";

/// [`MODEL`], as the family's `runs`.
fn model() -> Result<String, RefError> {
Ok(MODEL.to_string())
}

/// Mainline's MTP step taps (`just dump-ref-q35mtp`).
pub static MAINLINE: Family = Family {
name: "mtp-qwen35moe-mainline",
sets: &[SET],
resolve: None,
recipe: "just dump-ref-q35mtp",
identity: Identity::MtpTaps,
arch: Some(super::ARCH),
build: Some(Build::Is(QVIS_LCPP_BUILD)),
runs: Some(model),
draft_runs: None,
consumers: &[],
};

#[cfg(test)]
mod tests;
Loading
Loading