← Back to Pull requests

vela: add the 0.8B native F32 heads, scoring and span decoding #176

Open
unknown opened this pull request with 514 lines diff across 6 files
View on GitHub
unknown unknown commented on Oct 25, 2026 06:02 UTC
Author

Stacked on #151 + #174 + #175 — incremental review. Current head 541de98c, rebased onto main at 285c791; the latest commits are the review fixes listed under Test Result.

Required human contributor answers

1. What outcome are you trying to achieve?

Implement the Vela-owned output side of the native path: CandidateHead, both SpanHeadV2 heads, set_bias, and the full calibration/decode chain — checked against recorded reference fixtures without any GPU. (Source: issue #137.)

2. What is the highest-leverage variable?

Head-logit parity — if the F32 math doesn't match the reference to ~1e-5, every downstream answer is wrong.

3. How will this work move that variable?

The recorded head-input fixtures (hidden states, logits, calibrated answers) freeze both the math and the scoring chain; five cases pin the numbers.

4. Who is the customer or user?

Same as #175 — this is the second half of the native output path.

Is a PR needed? Yes — prerequisite for the executor PR.

For a bug fix: N/A.

Purpose

heads.rs (CandidateHead bilinear + scalar-MLP with erf-GELU via libm, both SpanHeadV2 instances, set_bias — plain F32), scoring.rs (temperatures, set thresholds, PII length rule, sparse gate, span_decode_r4, label aliasing, score normalization, f64 window aggregation), head-input fixture exporter, five recorded fixture sets (~15.8 MB safetensors).

Test Plan

System1-Omni Version / Commit: model/vela2-native-heads @ 541de98c

| Check | Command | Result |
|---|---|---|
| CPU tests | cargo test -p omni-vela-native | 49 passed; 3 ignored |
| clippy | cargo clippy -p omni-vela-native --all-targets -- -D warnings | clean |
| Docs | mkdocs build --strict | exit 0 |
| Opt-in head parity | VELA_NATIVE_BUNDLE=… VELA_NATIVE_MANIFEST_SHA256=… cargo test --test vela_native_heads -- --ignored | 5/5: logit ≤3.8e-5, answer ≤7.3e-7 |

Test Result

All passed. Gates default 4e-5/1e-6 (env-overridable, tighten-only); recorded maxima 3.7e-5 / 7.3e-7.

  • Head 541de98c (rebased onto main at 285c791): every check in the table rerun and green — cargo test -p omni-vela-native --locked (49 passed, 3 opt-in ignored), the opt-in head parity (5/5) and render parity (2/2) against the local 0.8B export with exactly the drifts in the table below, PYTHONPATH=src pytest tests/vela (141 passed), cargo fmt --all --check, crate clippy -D warnings and strict mkdocs build; CI and Docs workflows green.

  • What the latest commits change: 2f50eb85 is the heads and scoring slice, with window calls mapped to their recorded rows and the positive long-span regression; 085761e3 accepts the checkpoint's rank-0 set_bias; 19c24d23 and 0810a59d set VELA_NATIVE_MANIFEST_SHA256 in the opt-in commands; d7384085 carries the executor slice's bundle-directory walk verbatim with three walk regressions; e546e0c4 makes the calibration anchor sort NaN-safe (total_cmp); 3b2d8de5 indexes the window aggregation by offset, the 0.8B executor slice's version; b9ea8333 and 541de98c move the head loader and state unit tests under tests/vela with #[path] wiring, so no test body is left under src/.

  • Earlier head ce8c0ca9: every check in the table plus PYTHONPATH=src pytest tests/vela (139 passed), cargo fmt --all --check and strict mkdocs rerun and green at that head.
  • Demo / evidence

    Author-run, x86 WSL2, CPU FP32, five cases:

    | Case | Logit drift | Answer drift |
    |---|---|---|
    | example-request | 3.719e-5 | 7.252e-7 |
    | set-threshold | 6.676e-6 | 1.126e-7 |
    | cjk | 3.624e-5 | 4.768e-7 |
    | score | 1.669e-6 | 6.077e-7 |
    | long-span-windowed | 1.121e-5 | 0.0 (exact) |

    Structural assertions: discrete picks, span label/text/start/end, threshold rules — all equal.

    Fixture facts: ~15.8 MB total safetensors; regenerable via documented command; rows block in JSON is informational.

    Not measured: GPU, performance.

    Self-review

  • Full diff reviewed.

  • Architecture and scope checked.

  • Checks run and reported above.

  • Description and claims match implementation.
  • Diff: 514 lines (+385 / -129) across 6 files Reviewer: Levius-Fubuki Review duration: 53297m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.55) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.55 · 514 lines diff across 6 files
    0.55
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.374
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #176"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 54.7% (MEDIUM) · Higher = larger blast radius
    54.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 30.2% · Safe to merge
    30.2%