Offline differentials: port the Strata 0.1.50 chat-template empty-turn filter, GGUF types 143-146, native PLE key types; fix two stale smokes
chat template (prompt bytes): ChatTemplate.render (#843) drops completed empty assistant turns (no text after strip, no picture, no tool calls; the final message is kept; STRATA_KEEP_EMPTY_TURNS=1 keeps them) before the template runs. prompt.rs now does the same in Renderer::render and in the typed render_with_images path. diff_chat_template: 136/3000 -> 0 (also 2 x 12000). chat_template_oracle.json regenerated from the Original; one responses.rs test asserted the old behaviour. gguf: block_geometry knows the APR trellis types 143-146 (PTQ1_0, TQ2_T, TQK6, TQK7); gguf_headers.json regenerated. diff_gguf_header: 188/400 -> 0. native pack: NATIVE_PLE_KEY gained IQ3_XXS/IQ4_XS (#381); NVFP4 expert tails and prism.hadamard experts are refused (not ported, the runtime reads neither). diff_native_pack f16_nan uses a quiet NaN (numpy's widening of a signaling NaN differs between builds). The live differential still needs one run on Linux. smoke-mtp-pack.py reads the Q8_0 names from required[]/wq(); Dockerfile.systemd-smoke drops its apt version pins. docs/ci-audit.md findings 14, 15, 16, 18 updated in place. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
af387583f9
commit
97c33d8b2c
@@ -218,6 +218,15 @@ fn expert_layout(shards: &[Shard]) -> Result<Layout<'_>> {
|
||||
let gate = roles[0].1;
|
||||
let up = roles[1].1;
|
||||
let down = roles[2].1;
|
||||
// Strata 0.1.50 `expert_layout` gives an NVFP4 expert blob a 16-byte tail {s_gate, s_up, s_down, 0} read from the
|
||||
// `blk.N.ffn_*_exps.scale` tensors and forces `experts.bin`. This packer does not write the tails, and the runtime
|
||||
// here does not read them: a pack without them would be silently wrong, so it is refused.
|
||||
if [gate, up, down].iter().any(|t| t.kind == 40) {
|
||||
return Err(format!(
|
||||
"layer {layer}: NVFP4 experts need the scale tails of tools/iq_pack.py (Strata 0.1.50), which this packer does not write"
|
||||
)
|
||||
.into());
|
||||
}
|
||||
if gate.kind != up.kind
|
||||
|| gate.dimensions != up.dimensions
|
||||
|| gate.dimensions[0] != down.dimensions[1]
|
||||
@@ -609,6 +618,12 @@ fn convert_tensor(
|
||||
}
|
||||
}
|
||||
|
||||
/// `iq_pack.py` `NATIVE_PLE_KEY`: the PLE key encodings left in the GGUF for the engine's native PLE key (Q8_0, Q2_0, and since
|
||||
/// Strata 0.1.50 IQ3_XXS and IQ4_XS, #381). Another quantized key takes the BF16 path (`--compat-bf16`).
|
||||
fn native_ple_key(kind: u32) -> bool {
|
||||
matches!(kind, 8 | 42 | 18 | 23)
|
||||
}
|
||||
|
||||
/// `tools/iq_pack.py::index_standalone`: every non-expert tensor of the model. Floats the engine reads from the pack
|
||||
/// go into `dense.bin` in the form it reads them; quantized ones are served natively from the GGUF.
|
||||
fn dense_files(shards: &[Shard], output: &Path, options: &Options) -> Result<()> {
|
||||
@@ -634,7 +649,7 @@ fn dense_files(shards: &[Shard], output: &Path, options: &Options) -> Result<()>
|
||||
let required = form(&tensor.name);
|
||||
let native = !float
|
||||
&& (required.is_none()
|
||||
|| (tensor.name == "blk.1.ple_key.weight" && matches!(tensor.kind, 8 | 42)));
|
||||
|| (tensor.name == "blk.1.ple_key.weight" && native_ple_key(tensor.kind)));
|
||||
if native {
|
||||
rows.push(format!(
|
||||
"{} 0 0 0 0 {pool} 0 {ne0} {ne1} 8 0 32 0 0 0 0 0 0 0\n",
|
||||
@@ -877,6 +892,18 @@ pub fn primary_shard(manifest: &model::Manifest, source: &Path) -> Result<PathBu
|
||||
|
||||
fn tokenizer_assets_preflight(source: &Path) -> Result<()> {
|
||||
gguf::tokenizer_metadata(source)?;
|
||||
// `iq_pack.py` `hadamard_spec` (Strata 0.1.50) packs `prism.hadamard.*` experts (stored in a block-Hadamard-rotated basis)
|
||||
// with a `hadamard.txt` and a v5 `native_experts.txt` so that an engine which cannot rotate refuses them. This packer writes
|
||||
// neither, and a folded weight run on unrotated activations computes plausible garbage: refuse the model.
|
||||
if let Some((key, _)) = gguf::metadata_entries(source)?
|
||||
.into_iter()
|
||||
.find(|(key, _)| key.starts_with("prism.hadamard."))
|
||||
{
|
||||
return Err(format!(
|
||||
"{key}: Hadamard-folded experts need the hadamard.txt of tools/iq_pack.py (Strata 0.1.50), which this packer does not write"
|
||||
)
|
||||
.into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1117,6 +1144,70 @@ fn same_bytes(
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// One layer of expert tensors of `kind`, the way a GGUF index lists them (no file behind it).
|
||||
fn one_layer(kind: u32) -> Vec<Shard> {
|
||||
let tensor = |name: &str, dimensions: Vec<u64>, bytes: u64, kind: u32| gguf::TensorInfo {
|
||||
name: name.to_owned(),
|
||||
dimensions,
|
||||
kind,
|
||||
offset: 0,
|
||||
bytes,
|
||||
};
|
||||
vec![Shard {
|
||||
path: PathBuf::from("m.gguf"),
|
||||
index: gguf::TensorIndex {
|
||||
summary: gguf::Summary {
|
||||
tensors: 4,
|
||||
metadata: 0,
|
||||
architecture: None,
|
||||
split_no: None,
|
||||
split_count: None,
|
||||
split_tensors_count: None,
|
||||
data_start: 0,
|
||||
file_size: 0,
|
||||
types: Default::default(),
|
||||
},
|
||||
tensors: vec![
|
||||
tensor("blk.0.ffn_gate_inp.weight", vec![64, 4], 1024, 0),
|
||||
tensor("blk.0.ffn_gate_exps.weight", vec![64, 64, 4], 4096, kind),
|
||||
tensor("blk.0.ffn_up_exps.weight", vec![64, 64, 4], 4096, kind),
|
||||
tensor("blk.0.ffn_down_exps.weight", vec![64, 64, 4], 4096, kind),
|
||||
],
|
||||
},
|
||||
}]
|
||||
}
|
||||
|
||||
/// Strata 0.1.50 packs NVFP4 experts with a scale tail this packer does not write: it refuses them instead of writing a pack
|
||||
/// whose experts the engine would read without their scales.
|
||||
#[test]
|
||||
fn nvfp4_experts_are_refused_and_other_experts_are_laid_out() {
|
||||
let error = expert_layout(&one_layer(40))
|
||||
.err()
|
||||
.expect("NVFP4 is refused");
|
||||
assert!(error.to_string().contains("NVFP4 experts"), "{error}");
|
||||
let shards = one_layer(21);
|
||||
let layout = expert_layout(&shards).expect("IQ3_S experts");
|
||||
assert_eq!(layout.n_expert, 4);
|
||||
assert!(layout.text.starts_with("# strata native experts v3:"));
|
||||
}
|
||||
|
||||
/// `iq_pack.py` `NATIVE_PLE_KEY` = {Q2_0, Q8_0, IQ3_XXS, IQ4_XS} (Strata 0.1.50, #381); any other quantized key is converted.
|
||||
#[test]
|
||||
fn the_native_ple_key_encodings_are_the_originals() {
|
||||
for (kind, native) in [
|
||||
(42, true),
|
||||
(8, true),
|
||||
(18, true),
|
||||
(23, true),
|
||||
(21, false),
|
||||
(14, false),
|
||||
(12, false),
|
||||
(16, false),
|
||||
] {
|
||||
assert_eq!(native_ple_key(kind), native, "kind {kind}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Numpy (`astype(float16)`) and gguf-py (`BF16.quantize_blocks`) answers for 4096 f32 bit patterns, from
|
||||
/// `scripts/offline/gen_goldens.py`. The packer's F32 -> F16 / BF16 helpers must match bit for bit.
|
||||
#[test]
|
||||
|
||||
+213
-2
@@ -406,6 +406,90 @@ pub struct ChatInput<'a> {
|
||||
pub kwargs: Vec<(&'a str, Json)>,
|
||||
}
|
||||
|
||||
/// `STRATA_KEEP_EMPTY_TURNS=1` renders completed empty assistant turns as before (`ChatTemplate.render`).
|
||||
fn keep_empty_turns() -> bool {
|
||||
std::env::var_os("STRATA_KEEP_EMPTY_TURNS").is_some_and(|v| v == "1")
|
||||
}
|
||||
|
||||
/// `serve/frontend.py` `_text_of`, as far as the emptiness test needs it: the text of a message's content, or the `TypeError`
|
||||
/// Python raises for a content it cannot iterate (a number or a boolean). A string is itself, a list joins the `text` of its text
|
||||
/// parts (type `text`, `input_text` or no type), an object is iterated by key (no part is a dict, so its text is empty).
|
||||
fn content_text(content: Option<&Json>) -> Result<String, String> {
|
||||
match content {
|
||||
None | Some(Json::Null) | Some(Json::Object(_)) => Ok(String::new()),
|
||||
Some(Json::String(text)) => Ok(text.clone()),
|
||||
Some(Json::Array(parts)) => {
|
||||
let mut text = String::new();
|
||||
for part in parts {
|
||||
let Json::Object(_) = part else { continue };
|
||||
let text_part = match part.get("type") {
|
||||
None | Some(Json::Null) => true,
|
||||
Some(Json::String(kind)) => kind == "text" || kind == "input_text",
|
||||
Some(_) => false,
|
||||
};
|
||||
if !text_part {
|
||||
continue;
|
||||
}
|
||||
match part.get("text") {
|
||||
None => {}
|
||||
Some(Json::String(piece)) => text.push_str(piece),
|
||||
Some(_) => {
|
||||
return Err("TypeError: sequence item: expected str instance".into());
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(text)
|
||||
}
|
||||
Some(_) => Err("TypeError: object is not iterable".into()),
|
||||
}
|
||||
}
|
||||
|
||||
/// `serve/frontend.py` `_has_image`: a list content with an `image_url`, `input_image` or `image` part.
|
||||
fn content_has_image(content: Option<&Json>) -> bool {
|
||||
let Some(Json::Array(parts)) = content else {
|
||||
return false;
|
||||
};
|
||||
parts.iter().any(|part| {
|
||||
matches!(part.get("type"), Some(Json::String(t)) if matches!(t.as_str(), "image_url" | "input_image" | "image"))
|
||||
})
|
||||
}
|
||||
|
||||
/// Python truthiness of a JSON value (`not m.get("tool_calls")`).
|
||||
fn truthy(value: Option<&Json>) -> bool {
|
||||
match value {
|
||||
None | Some(Json::Null) | Some(Json::Bool(false)) => false,
|
||||
Some(Json::Bool(true)) => true,
|
||||
Some(Json::Number(n)) => n.as_f64().is_none_or(|f| f != 0.0),
|
||||
Some(Json::String(s)) => !s.is_empty(),
|
||||
Some(Json::Array(items)) => !items.is_empty(),
|
||||
Some(Json::Object(fields)) => !fields.is_empty(),
|
||||
}
|
||||
}
|
||||
|
||||
/// A completed empty assistant turn: an assistant message with no text (after `str.strip`), no picture and no tool calls.
|
||||
/// A reasoning content does not keep it.
|
||||
fn is_empty_assistant_turn(message: &Json) -> Result<bool, String> {
|
||||
if !matches!(message.get("role"), Some(Json::String(role)) if role == "assistant") {
|
||||
return Ok(false);
|
||||
}
|
||||
let content = message.get("content");
|
||||
Ok(content_text(content)?.trim_matches(py_space).is_empty()
|
||||
&& !content_has_image(content)
|
||||
&& !truthy(message.get("tool_calls")))
|
||||
}
|
||||
|
||||
/// `ChatTemplate.render` (serve/frontend.py, Strata 0.1.50, #843): "Do not use completed empty assistant turns as examples
|
||||
/// for the next reply. Keep the final message." The template sees the list without them; `STRATA_KEEP_EMPTY_TURNS=1` keeps them.
|
||||
fn without_empty_assistant_turns(messages: &[Json]) -> Result<Vec<Json>, String> {
|
||||
let mut kept = Vec::with_capacity(messages.len());
|
||||
for (index, message) in messages.iter().enumerate() {
|
||||
if index + 1 == messages.len() || keep_empty_turns() || !is_empty_assistant_turn(message)? {
|
||||
kept.push(message.clone());
|
||||
}
|
||||
}
|
||||
Ok(kept)
|
||||
}
|
||||
|
||||
pub struct Renderer {
|
||||
env: Environment<'static>,
|
||||
}
|
||||
@@ -435,7 +519,8 @@ impl Renderer {
|
||||
|
||||
pub fn render(&self, input: &ChatInput<'_>) -> Result<String, String> {
|
||||
let mut context: BTreeMap<&str, Value> = BTreeMap::new();
|
||||
context.insert("messages", Value::from_serialize(input.messages));
|
||||
let messages = without_empty_assistant_turns(input.messages)?;
|
||||
context.insert("messages", Value::from_serialize(&messages));
|
||||
context.insert(
|
||||
"tools",
|
||||
input.tools.map_or(Value::from(()), Value::from_serialize),
|
||||
@@ -506,6 +591,21 @@ pub struct Message<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Message<'a> {
|
||||
/// A completed empty assistant turn (see [`without_empty_assistant_turns`]): no text after `str.strip`, no picture, and (the
|
||||
/// typed messages carry none) no tool calls.
|
||||
fn is_empty_assistant_turn(&self) -> bool {
|
||||
if self.role != Role::Assistant {
|
||||
return false;
|
||||
}
|
||||
match self.parts {
|
||||
None => self.content.trim_matches(py_space).is_empty(),
|
||||
Some(parts) => parts.iter().all(|part| match part {
|
||||
Part::Text(text) => text.trim_matches(py_space).is_empty(),
|
||||
Part::Image(_) => false,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn text(role: Role, content: &'a str, reasoning: Option<&'a str>) -> Self {
|
||||
Self {
|
||||
role,
|
||||
@@ -672,6 +772,18 @@ fn render_native(
|
||||
Ok(prompt)
|
||||
}
|
||||
|
||||
/// The typed counterpart of [`without_empty_assistant_turns`].
|
||||
fn without_empty_turns<'a>(messages: &[Message<'a>]) -> Vec<Message<'a>> {
|
||||
messages
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(index, message)| {
|
||||
index + 1 == messages.len() || keep_empty_turns() || !message.is_empty_assistant_turn()
|
||||
})
|
||||
.map(|(_, message)| *message)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// [`render_with_tools`] and the sources of the pictures the prompt contains, in prompt order (`images_of`).
|
||||
pub fn render_with_images(
|
||||
messages: &[Message<'_>],
|
||||
@@ -681,6 +793,10 @@ pub fn render_with_images(
|
||||
if messages.is_empty() {
|
||||
return Err("prompt needs a message".into());
|
||||
}
|
||||
// The template never sees a completed empty assistant turn (`without_empty_assistant_turns`); the checks below and the native
|
||||
// renderer work on the same list.
|
||||
let kept = without_empty_turns(messages);
|
||||
let messages = kept.as_slice();
|
||||
let first_non_system = messages
|
||||
.iter()
|
||||
.position(|message| !matches!(message.role, Role::System | Role::Developer))
|
||||
@@ -970,7 +1086,7 @@ mod tests {
|
||||
.map(chat_tool)
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.unwrap();
|
||||
let native = render_native(&messages, effort, &chat_tools);
|
||||
let native = render_native(&without_empty_turns(&messages), effort, &chat_tools);
|
||||
assert_eq!(
|
||||
native,
|
||||
reference,
|
||||
@@ -1016,6 +1132,101 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// Strata 0.1.50 `ChatTemplate.render` (#843): completed empty assistant turns are not rendered, the final message is kept
|
||||
/// whatever it is, and a reasoning content does not keep a turn. The expectation is the unmodified `serve/frontend.py`'s
|
||||
/// (`scripts/offline/diff_chat_template.py` runs the same comparison over thousands of generated conversations).
|
||||
#[test]
|
||||
fn completed_empty_assistant_turns_are_not_rendered() {
|
||||
let head = "<|im_start|>system\nReasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.<|im_end|>\n";
|
||||
let user = |content| Json::object([("role", Json::str("user")), ("content", content)]);
|
||||
let assistant = |content, extra: Vec<(&str, Json)>| {
|
||||
let mut fields = vec![("role", Json::str("assistant")), ("content", content)];
|
||||
fields.extend(extra);
|
||||
Json::Object(fields.into_iter().map(|(k, v)| (k.to_owned(), v)).collect())
|
||||
};
|
||||
let render = |messages: &[Json]| {
|
||||
pinned()
|
||||
.render(&ChatInput {
|
||||
messages,
|
||||
tools: None,
|
||||
add_generation_prompt: false,
|
||||
kwargs: vec![("reasoning_effort", Json::str("xhigh"))],
|
||||
})
|
||||
.unwrap()
|
||||
};
|
||||
let tail =
|
||||
format!("{head}<|im_start|>user\nhi<|im_end|>\n<|im_start|>user\nagain<|im_end|>\n");
|
||||
// null, empty, blank, text-less list content and a reasoning-only turn all vanish between the two user turns
|
||||
for dropped in [
|
||||
assistant(Json::Null, vec![]),
|
||||
assistant(Json::str(""), vec![]),
|
||||
assistant(Json::str(" \n\u{3000}"), vec![]),
|
||||
assistant(Json::Array(vec![]), vec![]),
|
||||
assistant(
|
||||
Json::str(""),
|
||||
vec![("reasoning_content", Json::str("thought"))],
|
||||
),
|
||||
assistant(Json::str(""), vec![("tool_calls", Json::Array(vec![]))]),
|
||||
] {
|
||||
let got = render(&[
|
||||
user(Json::str("hi")),
|
||||
dropped.clone(),
|
||||
user(Json::str("again")),
|
||||
]);
|
||||
assert_eq!(got, tail, "{dropped:?}");
|
||||
}
|
||||
// kept: a tool call, a picture, and the final message
|
||||
let call = assistant(
|
||||
Json::str(""),
|
||||
vec![(
|
||||
"tool_calls",
|
||||
Json::Array(vec![Json::object([("name", Json::str("f"))])]),
|
||||
)],
|
||||
);
|
||||
let got = render(&[user(Json::str("hi")), call, user(Json::str("again"))]);
|
||||
assert_eq!(got.matches("<|im_start|>assistant").count(), 1, "{got}");
|
||||
let picture = assistant(
|
||||
Json::Array(vec![Json::object([("type", Json::str("image"))])]),
|
||||
vec![],
|
||||
);
|
||||
let got = render(&[user(Json::str("hi")), picture, user(Json::str("again"))]);
|
||||
assert!(got.contains("<|vision_start|>"), "{got}");
|
||||
let got = render(&[user(Json::str("hi")), assistant(Json::Null, vec![])]);
|
||||
assert_eq!(got.matches("<|im_start|>assistant").count(), 1, "{got}");
|
||||
// a content Python cannot iterate fails the render instead of being dropped
|
||||
let error = pinned().render(&ChatInput {
|
||||
messages: &[
|
||||
user(Json::str("hi")),
|
||||
assistant(Json::Number(42.into()), vec![]),
|
||||
user(Json::str("again")),
|
||||
],
|
||||
tools: None,
|
||||
add_generation_prompt: false,
|
||||
kwargs: vec![],
|
||||
});
|
||||
assert!(error.is_err());
|
||||
// the typed path takes the same turns out, native renderer included
|
||||
let typed = |role, content| Message {
|
||||
role,
|
||||
content,
|
||||
reasoning: Some("thought"),
|
||||
parts: None,
|
||||
};
|
||||
let messages = [
|
||||
typed(Role::User, "hi"),
|
||||
typed(Role::Assistant, " "),
|
||||
typed(Role::User, "again"),
|
||||
];
|
||||
let native = render_with_tools(&messages, Effort::XHigh, &[]).unwrap();
|
||||
assert_eq!(native, format!("{tail}<|im_start|>assistant\n<think>\n"));
|
||||
assert_eq!(
|
||||
render_via_template(&messages, Effort::XHigh, &[])
|
||||
.unwrap()
|
||||
.0,
|
||||
native
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_unrepresentable_message_order() {
|
||||
let system = Message {
|
||||
|
||||
@@ -5821,10 +5821,15 @@ Oslo
|
||||
let truncated = make_request(
|
||||
json!({"input":[{"role":"user","content":"Check"},{"type":"reasoning","content":[{"type":"reasoning_text","text":"Unfinished"}]},{"role":"user","content":"Continue"}]}),
|
||||
);
|
||||
// Strata 0.1.50 `ChatTemplate.render` (#843) does not render a completed empty assistant turn, and a reasoning content
|
||||
// does not keep one: the unfinished thinking between the two user turns is not part of the prompt. (It was, before the
|
||||
// sync to 41cf05a0; `STRATA_KEEP_EMPTY_TURNS=1` restores it in the Original and here.)
|
||||
let prompt = render_request_prompt(&truncated).unwrap();
|
||||
assert!(!prompt.contains("Unfinished"), "{prompt}");
|
||||
assert!(
|
||||
render_request_prompt(&truncated)
|
||||
.unwrap()
|
||||
.contains("<think>\nUnfinished\n</think>")
|
||||
prompt.contains(
|
||||
"<|im_start|>user\nCheck<|im_end|>\n<|im_start|>user\nContinue<|im_end|>\n"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -999,6 +999,12 @@ pub fn block_geometry(kind: u32) -> Option<(u64, u64)> {
|
||||
39 => (32, 17),
|
||||
40 => (64, 36),
|
||||
42 => (64, 18),
|
||||
// APR trellis types (gguf_reader.hpp 143 to 146, gguf_reader.py BLOCK_GEOMETRY): 128 values per block,
|
||||
// PTQ1_0 28 bytes, TQ2_T 34, TQK6 26, TQK7 30
|
||||
143 => (128, 28),
|
||||
144 => (128, 34),
|
||||
145 => (128, 26),
|
||||
146 => (128, 30),
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
FROM ubuntu@sha256:f610ab94648195aa356059f5b41d6085c9d4d903c072430cdd1af7bdb646106b
|
||||
# The base image is pinned by digest. The apt packages are not pinned to versions: the Ubuntu archive keeps only the current
|
||||
# security/updates builds, so exact version pins (systemd=255.4-1ubuntu8.17, ca-certificates=20260601~24.04.1 ...) stop resolving
|
||||
# within months ("Version ... was not found") and the image can no longer be built. This image is a disposable fixture, not a
|
||||
# shipped artifact; the smoke checks the behaviour of a user manager, not a package version.
|
||||
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
systemd=255.4-1ubuntu8.17 dbus=1.14.10-4ubuntu4.1 \
|
||||
dbus-user-session=1.14.10-4ubuntu4.1 python3=3.12.3-0ubuntu2.1 \
|
||||
util-linux=2.39.3-9ubuntu6.6 ca-certificates=20260601~24.04.1 && rm -rf /var/lib/apt/lists/*
|
||||
systemd dbus dbus-user-session python3 util-linux ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
RUN useradd --create-home --uid 10001 fixture && \
|
||||
mkdir -p /run/systemd/system /run/user/10001 /home/fixture/.config && \
|
||||
chown fixture:fixture /run/user/10001 /home/fixture/.config && \
|
||||
|
||||
+43
-9
@@ -159,7 +159,7 @@ Nothing was installed on Windows or in the Ubuntu WSL distro. Logs: `artifacts/c
|
||||
| `build-cpu.sh` (cmake, 16 ctest targets) | **PASS** 150 s | 16/16 |
|
||||
| `scripts/cuda-stubs/check-cu.py` (clang) | **FAIL (advisory), partly fixed** | on glibc/libstdc++ all 104 files failed on name clashes with libm (1236 errors); stub definitions skipped under `__GLIBC__`, a missing include directory for `s26_tsum.cuh` added, and `check-local.sh` now runs the C++-only `--plain` pass off macOS: 101/104 pass. The 3 failures are `static_assert(sizeof(FusedGrArgs)==112)` / `GrMulti==912` in `chain_window.cu`, `mtp_original_full_fused_gr.cu`, `mtp_original_scalar_gr.cu`: the stub types give 168 / 1360, so either the stub types differ from the CUDA ones or the ABI drifted; not resolved here. Clang's CUDA frontend mode passes 22/104 on Linux (it needs macOS-only stub overloads) |
|
||||
| `check-local.sh --full` (CI `verify` job environment, includes `test-keyless-routing.py` with numpy) | **PASS** 437 s | exit 0: fast path, type-check, shim, 13 Python test scripts (146 unittest cases), Linux-only block, control-plane gates, replay, `build-cpu.sh`; 1402 Rust tests passed, 104 ignored; reported debt: `literal_port` (4), rustfmt/Clippy debt, `test-cuda-driver-bootstrap.sh`, the 3 stub files |
|
||||
| `port.yml` port-oracles: live differentials against the unmodified Python (numpy 2.5.4, PyYAML 6.0.3, tqdm 4.70.1, Jinja2 3.1.6, regex 2026.9.10; llama.cpp `gguf-py` at the pinned commit) | **4 PASS, 3 FAIL** | PASS: `tokenizer` (14,456,832 pre-tokenizer strings, 0 real mismatches), `dequant` (69 fixtures, 23 types, bit-exact), `tools` (5 tools byte-identical), `mtp_fetch` (10 scenarios). **FAIL**: `native_pack` 60 of 2755 cases, `gguf_header` 188 of 400, `chat_template` 136 of 3000 (finding 16) |
|
||||
| `port.yml` port-oracles: live differentials against the unmodified Python (numpy 2.5.4, PyYAML 6.0.3, tqdm 4.70.1, Jinja2 3.1.6, regex 2026.9.10; llama.cpp `gguf-py` at the pinned commit) | **4 PASS, 3 FAIL** | PASS: `tokenizer` (14,456,832 pre-tokenizer strings, 0 real mismatches), `dequant` (69 fixtures, 23 types, bit-exact), `tools` (5 tools byte-identical), `mtp_fetch` (10 scenarios). **FAIL**: `native_pack` 60 of 2755 cases, `gguf_header` 188 of 400, `chat_template` 136 of 3000 (finding 16); fixed on `claude/offline-diff`) |
|
||||
| `desktop.yml` with .NET 10.0.403 | **PASS** 91 s | `dotnet restore --locked-mode`, build (0 warnings, 0 errors), `--self-check` (C# to gRPC to the Rust node), `reconnect.py`, `lifecycle.py`; the two macOS-only SSH tests do not apply |
|
||||
| workflow YAML parse, `test-gitea-release.py` (26 tests) after the edits | **PASS** | |
|
||||
| `hosted-cuda-package` (manual dispatch) | SKIPPED | builds the Original engine with a downloaded CUDA 13 toolkit (several GB, hours of compile) on an isolated CPU runner; no model or GPU is needed but it is a release build, not a check |
|
||||
@@ -218,20 +218,54 @@ Nothing was installed on Windows or in the Ubuntu WSL distro. Logs: `artifacts/c
|
||||
|
||||
14. **`smoke-mtp-pack.py` is stale after the upstream sync.** It discovers the MTP tensor names with a regex over
|
||||
`engine/strata/src/core/mtp.cpp`; in engine 0.1.50 that file lists them in a `required[]` array and reads them through `wq(...)`, so
|
||||
`self_attn.q_proj.weight` is not generated and `assert bad_index != good_index` fails. Needs the owner of the native MTP bootstrap.
|
||||
`self_attn.q_proj.weight` is not generated and `assert bad_index != good_index` fails. **Fixed on `claude/offline-diff`**: the nine Q8_0
|
||||
names are now read from `required[]` and `wq("...")` (all 26 names resolve in the pinned manifest; an assertion fails if the count changes).
|
||||
Not run end to end there (the smoke needs a Linux `strata-next`, a POSIX shell worker and Python 3.11).
|
||||
15. **`deploy/Dockerfile.systemd-smoke` pins apt package versions that no longer exist** (`systemd=255.4-1ubuntu8.17`,
|
||||
`ca-certificates=20260601~24.04.1`; apt answers "Version ... was not found"), so `smoke-systemd-manager.py` cannot build its image. Version pins
|
||||
rot against a rolling archive; use a snapshot mirror or drop the version pins and keep the base-image digest.
|
||||
16. **The offline-port differentials against the updated Original fail in three places**: `native_pack` (60 cases: `f16_nan` inputs and
|
||||
`IQ3_XXS`/`IQ4_XS` PLE tensors differ), `gguf_header` (188 cases: GGUF tensor types 144 to 146 are "unsupported" in the Rust indexer) and
|
||||
`chat_template` (136 cases: for example an assistant message with `content: null` renders as an extra empty assistant turn in Rust). The four
|
||||
that pass (tokenizer, dequant, tools, mtp_fetch) are bit-exact or byte-identical. These look like the Rust ports not yet re-synced to engine 0.1.50
|
||||
(`docs/offline-port.md`); the chat-template cases touch prompt bytes, so they deserve an owner's look before the next quality run.
|
||||
rot against a rolling archive. **Fixed on `claude/offline-diff`**: the version pins are gone, the base-image digest stays. The image build was
|
||||
not re-run (Docker Desktop could not start again, see 18).
|
||||
16. **The offline-port differentials against the updated Original fail in three places** (found in 3.4; root causes and fixes on
|
||||
`claude/offline-diff`, 2026-11-03):
|
||||
* `chat_template` (136 of 3000): a **real port drift in the prompt bytes**. The sync to Strata 41cf05a0 (2026-10-25) brought `ChatTemplate.render`
|
||||
a filter (#843) that removes completed empty assistant turns before the template runs (assistant message, no text after `str.strip()`, no
|
||||
picture, no tool calls; the final message is always kept; `STRATA_KEEP_EMPTY_TURNS=1` turns it off; a reasoning content does not keep a turn;
|
||||
a content Python cannot iterate, such as a number, fails the render). `control-plane/src/prompt.rs` did not have it, so an assistant message with
|
||||
`content: null`, `""` or a reasoning-only turn rendered as `<|im_start|>assistant
|
||||
<think>
|
||||
|
||||
</think>
|
||||
|
||||
<|im_end|>
|
||||
` in Rust and not at all in
|
||||
Python. Ported literally in `Renderer::render` and in the typed `render_with_images` path (native renderer included); 0 failures in
|
||||
3000, 2 x 12000 further cases. Real sessions: only a conversation that carries such a turn is affected, i.e. an empty assistant output item or a
|
||||
replayed `reasoning` item followed by a user turn (an interrupted or cancelled turn); turns with tool calls and any turn with text render as
|
||||
before (no captured session was replayed for this: the captures are not in Git). Since 2026-10-25 the Rust prompt differed from the Original for
|
||||
those conversations. `responses.rs` had one test that asserted the old behaviour (unfinished reasoning kept before the next user turn); it now asserts the Original's.
|
||||
`chat_template_oracle.json` was regenerated from the Original (it encoded the old behaviour: 11 of 112 shared requests changed).
|
||||
* `gguf_header` (188 of 400): the Original's `gguf_reader.py/.hpp` gained the APR trellis types 143 to 146 (`PTQ1_0`, `TQ2_T`, `TQK6`, `TQK7`,
|
||||
128-value blocks of 28/34/26/30 bytes); `leleka_model_format::gguf::block_geometry` did not know them. Added; `gguf_headers.json` regenerated (it now covers them); 0 failures in 400.
|
||||
* `native_pack` (60 of 2755): (a) `iq_pack.py` `NATIVE_PLE_KEY` gained IQ3_XXS and IQ4_XS (#381, the runtime side `native_dense_plan.rs` already had them), so
|
||||
`native_pack.rs` converted such a PLE key to BF16 or refused it: fixed (`native_ple_key`). (b) the `f16_nan` cases used the signaling NaN
|
||||
0x7D55, whose numpy widening to F32 differs between numpy builds (2.0.2 keeps it, the 2.5.4 run of 3.4 did not); that is the oracle disagreeing with itself,
|
||||
not the port, so the case now uses a quiet NaN (0x7F55). (c) **Not ported, now refused**: the Original's NVFP4 expert tail (16 bytes of scales per blob, forced
|
||||
`experts.bin`) and `prism.hadamard.*` experts (`hadamard.txt`, `native_experts.txt` v5, resumable `experts.bin`); the runtime here reads neither, so a pack
|
||||
without them would be silently wrong. The Rust packer returns an error naming the feature. The live `native_pack` differential could not be re-run on the laptop
|
||||
(on Windows the Rust packer ends in "Access is denied" after verifying the input, probably its directory fsync, and Docker Desktop did not start): its unit tests and the (a) and (c) paths are covered by
|
||||
`native_pack` unit tests; the 2755-case run needs one pass in a container.
|
||||
The other four differentials (tokenizer, dequant, tools, mtp_fetch) were re-run against the fixed binary and still match.
|
||||
Also found, not fixed (stale goldens, not differentials): regenerating `reasoning_budget_oracle.json` from the Original changes 59 of 400 `Service.run` cases
|
||||
(every pre-cancelled run, and 25 thinking runs whose completion token count differs; `server.py` gained the answer-room and `#984` budget clamp), and
|
||||
`setup_policy_oracle.json` changes in 1204 places (a new 204800 context step in `setup.py`). Both ports (`reasoning_budget.rs`, `leleka-context` setup policy)
|
||||
are behind 41cf05a0; the committed goldens still pass because they are the old Original's.
|
||||
17. **Every workflow job failed at the first script on a real Linux checkout** (mode loss, see section 3.4) and **the static musl CLI did not
|
||||
compile** since the huge-page work (2026-11-01), so `linux-static-cli`, `release-cli` and `linux-cli-container` were red as well. Fixed.
|
||||
18. **Docker Desktop on this laptop could not start**: `%LOCALAPPDATA%\Docker\run\dockerInference` was a stale 0-byte socket file from 2025-06-20 that
|
||||
nothing (Docker, `del`, `icacls`) could remove ("The file cannot be accessed by the system", error 1920). The directory `run` was renamed to
|
||||
`run.stale-before-ci-audit-20260625`, Docker created a fresh one; the renamed directory can be deleted.
|
||||
`run.stale-before-ci-audit-20260625`, Docker created a fresh one; the renamed directory can be deleted. It happened again on 2026-11-03: the
|
||||
`dockerInference` socket file the audit run left behind (the app was not quit cleanly) blocked the next start with the same error. Docker Desktop
|
||||
stays unusable until `run` is renamed again, and each unclean quit recreates the problem; nothing outside the repository folder was touched to work around it.
|
||||
|
||||
## 5. What changed on this branch
|
||||
|
||||
|
||||
@@ -116,7 +116,10 @@ def value_class(rng, cls, n):
|
||||
if cls == 'f16_inf':
|
||||
bits[2] = 0x7C00
|
||||
if cls == 'f16_nan':
|
||||
bits[2], bits[6] = 0x7E00, 0x7D55
|
||||
# Quiet NaNs only: numpy's F16 to F32 widening of a SIGNALING NaN (the former 0x7D55) is not the same on every numpy
|
||||
# build and CPU (numpy 2.0.2 keeps it signaling, 0x7FAAA000; the 2.5.4 run of the CI audit differed on x86), so the oracle
|
||||
# itself disagrees across hosts. The Rust widening keeps the payload and the quiet bit exactly (quant-core).
|
||||
bits[2], bits[6] = 0x7E00, 0x7F55
|
||||
return ('F16', bits.tobytes())
|
||||
if cls in ('bf16', 'bf16_inf', 'bf16_nan', 'bf16_edge'):
|
||||
a = (rng.normal(size=n).astype(np.float32).view(np.uint32) >> 16).astype(np.uint16)
|
||||
|
||||
@@ -31,7 +31,12 @@ def main():
|
||||
source = root / 'http'; source.mkdir()
|
||||
# Independent engine-consumer names, rather than the validator's own table.
|
||||
consumer = (REPO / 'engine/strata/src/core/mtp.cpp').read_text()
|
||||
names = sorted(set(re.findall(r'\b(q8|bf16|f32)\("([^" ]+)"\)', consumer)))
|
||||
# Engine 0.1.50 reads the Q8_0 weights through `wq("name", type)` (Q8_0, or Q4_0 under --mtp-q4) after checking them
|
||||
# against the `required[]` list; the f32 and bf16 ones still go through `f32("name")` / `bf16("name")`.
|
||||
required = re.search(r'const char\* required\[\] = \{(.*?)\};', consumer, re.S).group(1)
|
||||
q8_names = set(re.findall(r'\bwq\("([^" ]+)"', consumer)) | set(re.findall(r'"([^"]+)"', required))
|
||||
assert len(q8_names) == 9, q8_names # the drafter's nine Q8_0 projections; another count means mtp.cpp changed again
|
||||
names = sorted(set(re.findall(r'\b(q8|bf16|f32)\("([^" ]+)"\)', consumer)) | {('q8', name) for name in q8_names})
|
||||
records = json.loads((REPO / 'engine/strata/bench/results/2026-09-30-community-rtx-5090/mtp-manifest.json').read_text())
|
||||
shapes = {t['name'].removeprefix('mtp.').removeprefix('layers.0.'): t['shape'] for t in records}
|
||||
names += [('q8', 'self_attn.indexer.index_qk_proj.weight'), ('f32', 'self_attn.indexer.k_layernorm.weight'), ('f32', 'self_attn.indexer.q_layernorm.weight')]
|
||||
|
||||
Reference in New Issue
Block a user