Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 20 additions & 3 deletions recipe/vela/native.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,18 @@ cargo fmt --all --check
cargo clippy -p omni-vela-native --all-targets -- -D warnings
VELA_NATIVE_BUNDLE="$PWD/weights/vela-2.0-0.8b-native" \
VELA_NATIVE_MANIFEST_SHA256=<the digest the exporter prints> \
cargo test -p omni-vela-native --test vela_native_processing \
cargo test -p omni-vela-native --release --locked --test vela_native_processing \
--test vela_native_heads --test vela_native_response -- --ignored --nocapture
VELA_NATIVE_BUNDLE="$PWD/weights/vela-2.0-0.8b-native" \
VELA_NATIVE_MANIFEST_SHA256=<the digest the exporter prints> \
VELA_CUDA_LIB=/path/to/libqwen3_5_cuda.so \
cargo test -p omni-vela-native --test vela_native_executor -- --ignored --nocapture
cargo test -p omni-vela-native --release --locked --test vela_native_executor -- --ignored --nocapture
~~~

Use release test binaries for these full-bundle replays; the ordinary suite above
stays independent of weights and devices. Release changes the build profile,
while every fixture, external manifest anchor and numerical gate stays fixed.

The default test suite runs everywhere with no weights and no GPU: the wire contract
against the pinned runtime's 422/400 bodies (one known residual: a
non-finite JSON number answers the generic 400 message, where the
Expand Down Expand Up @@ -120,7 +124,8 @@ For a field-level diff of one token-plan case:

~~~sh
VELA_NATIVE_BUNDLE="$PWD/weights/vela-2.0-0.8b-native" \
cargo run -p omni-vela-native --example parity -- example-request
VELA_NATIVE_MANIFEST_SHA256=<the digest the exporter prints> \
cargo run -p omni-vela-native --release --locked --example parity -- example-request
~~~

## Recorded hardware evidence
Expand All @@ -140,6 +145,18 @@ score 0.0158). This closes the executor finding for that profile only;
broader hardware coverage and the windowed long-input GPU case remain
unverified.

An independent L20 profile is recorded in
[PR #205](https://github.com/InferMatrixLab/system1-omni/pull/205): NVIDIA L20,
sm_89, 46,068 MiB, driver 580.178.04, nvcc 12.8.61 and Rust 1.100.0. It uses
the unchanged executor/backend source from `55ed516`, the pinned 0.8B package
and uniform-BF16 export, FP32 heads, and the release replay commands above.
All original processing/head/response CPU checks and four GPU logit cases pass;
the largest GPU drift is 0.3297 with `VELA_GPU_LOGIT_GATE` unset and the original
0.35 ceiling. Raw command output, artifact hashes and the interrupted initial
debug attempt are retained with that run. This is native-library validation;
GPU end-to-end answers, long-window GPU behavior and a native HTTP worker remain
separate acceptance work.

## Scope and limits

- Implemented: bundle export + manifest gate, wire admission,
Expand Down
42 changes: 2 additions & 40 deletions src/models/vela/native/src/heads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,43 +329,5 @@ impl Heads {
}

#[cfg(test)]
mod tests {
use super::{linear, scalar_tensor, tensor};
use safetensors::{Dtype, SafeTensors, tensor::TensorView};

fn f32_tensor(name: &str, shape: Vec<usize>, values: &[f32]) -> Vec<u8> {
let bytes: Vec<u8> = values
.iter()
.flat_map(|value| value.to_le_bytes())
.collect();
let view = TensorView::new(Dtype::F32, shape, &bytes).expect("tensor view");
safetensors::tensor::serialize([(name, view)], None).expect("serialize")
}

#[test]
fn tensor_rejects_a_shape_that_only_matches_when_flattened() {
let raw = f32_tensor("head.weight", vec![4], &[0.0; 4]);
let file = SafeTensors::deserialize(&raw).expect("safetensors");
let error = match linear(&file, "head", false, 2, 2) {
Ok(_) => panic!("wrong rank must fail"),
Err(error) => error,
};
assert!(error.to_string().contains("head.weight has shape"));
}

#[test]
fn tensor_rejects_non_finite_values() {
let raw = f32_tensor("head.weight", vec![1], &[f32::NAN]);
let file = SafeTensors::deserialize(&raw).expect("safetensors");
let error = tensor(&file, "head.weight", &[1]).expect_err("non-finite tensor must fail");
assert!(error.to_string().contains("non-finite"));
}

#[test]
fn scalar_tensor_accepts_the_checkpoint_rank_zero_shape() {
let raw = f32_tensor("set_bias", vec![], &[0.25]);
let file = SafeTensors::deserialize(&raw).expect("safetensors");
let values = scalar_tensor(&file, "set_bias").expect("rank-0 scalar");
assert_eq!(values, [0.25]);
}
}
#[path = "../../../../../tests/vela/native_head_tensors.rs"]
mod tests;
40 changes: 40 additions & 0 deletions tests/vela/native_head_tensors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//! Private head-loader checks, registered from `heads.rs`.

use super::{linear, scalar_tensor, tensor};
use safetensors::{Dtype, SafeTensors, tensor::TensorView};

fn f32_tensor(name: &str, shape: Vec<usize>, values: &[f32]) -> Vec<u8> {
let bytes: Vec<u8> = values
.iter()
.flat_map(|value| value.to_le_bytes())
.collect();
let view = TensorView::new(Dtype::F32, shape, &bytes).expect("tensor view");
safetensors::tensor::serialize([(name, view)], None).expect("serialize")
}

#[test]
fn tensor_rejects_a_shape_that_only_matches_when_flattened() {
let raw = f32_tensor("head.weight", vec![4], &[0.0; 4]);
let file = SafeTensors::deserialize(&raw).expect("safetensors");
let error = match linear(&file, "head", false, 2, 2) {
Ok(_) => panic!("wrong rank must fail"),
Err(error) => error,
};
assert!(error.to_string().contains("head.weight has shape"));
}

#[test]
fn tensor_rejects_non_finite_values() {
let raw = f32_tensor("head.weight", vec![1], &[f32::NAN]);
let file = SafeTensors::deserialize(&raw).expect("safetensors");
let error = tensor(&file, "head.weight", &[1]).expect_err("non-finite tensor must fail");
assert!(error.to_string().contains("non-finite"));
}

#[test]
fn scalar_tensor_accepts_the_checkpoint_rank_zero_shape() {
let raw = f32_tensor("set_bias", vec![], &[0.25]);
let file = SafeTensors::deserialize(&raw).expect("safetensors");
let values = scalar_tensor(&file, "set_bias").expect("rank-0 scalar");
assert_eq!(values, [0.25]);
}