Skip to content

feat(lfm2): add Rust Choice preparation and verified FP32 export - #218

Draft
psv666 wants to merge 2 commits into
mainfrom
codex/lfm159-native-contract-20261123
Draft

psv666 wants to merge 2 commits into
mainfrom
codex/lfm159-native-contract-20261123

Conversation

@psv666

@psv666 psv666 commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Required human contributor answers

  1. Outcome: reproducible LFM2.5-350M Choice support with a stable contract and verifiable evidence.
  2. Highest-leverage variable: confidence that a native executor receives the same prepared inputs and can be checked against the approved numeric reference.
  3. This contribution moves it by freezing prep and response behavior against real captures and providing a verified F32 package for the executor stage.
  4. System1-Omni model, application and agent developers need compatible requests, dependable decisions and reproducible deployment on the target hardware.

The contributor approved focused draft deliveries for required implementation in the assigned issue queue. This draft provides the preparation prerequisite for #159. Bug-fix failure evidence is inapplicable because this introduces a preparation path.

Summary

Choice request → validate → render → token plan
supplied FP32 sequence totals → probabilities / choice / confidence / usage
pinned BF16 snapshot → CPU F32 export → per-value verification → Rust inspection

Purpose

Provide the Rust processing contract and verified weights needed by the future LFM2.5-350M executor. The Transformers worker continues to serve Choice. The CLI operates on CPU with supplied scores, supports exact question and candidate ordering, and exposes regular and cached logit readout intervals.

Test Plan

Base 2bb7d2affb46b29f13fa8d9e647a47051b455dca. Head 0e2eec50cb1906dccd1478325c275b449074b176, tree 465badc806a6dd916957f3624a9e3ec85243fb21. Tests ran in the L20 host's CPU environment with CUDA visibility empty, Rust 1.100.0 and the locked crate dependencies.

  • cargo fmt --all --check
  • cargo clippy --workspace --locked --all-targets --features omni-laya/serve -- -D warnings
  • cargo test -p omni-jev --test frontend --locked
  • cargo test --workspace --locked --features omni-laya/serve
  • cargo build --workspace --release --locked --features omni-laya/serve
  • cargo test --locked -p omni-lfm2-native -- --list and focused default tests
  • cargo test --release --locked -p omni-lfm2-native -- --ignored with the pinned tokenizer and full artifact
  • mkdocs build --strict

Cargo ran with an isolated offline cache. Export, artifact inspection and replay commands are in the Rust preparation recipe.

Test Result

All listed checks passed. Workspace tests reported 434 passes and 123 ignored hardware or asset checks. Frontend tests passed 12/12. LFM discovered 10 tests, with eight default CPU passes and two separate opt-in passes using the real tokenizer and complete F32 package.

Demo / evidence

  • Before: the repository provided a Python Choice worker. After: the CPU Rust CLI prepares the original five public requests, six questions and 266 branches and replays both captured uncached and Python batch-8 scores. Choice, order and usage were exact. The maximum probability and confidence differences observed in the CLI results were zero. The original 17 internal flat schemas also matched their prompt text, IDs, scoring offsets and choices.
  • The fixture uses public capture SHA-256 1e8786bb3ffb29f56ffb55090e0dc3206ab4dd7ec0fd2994cb597cfc185206f4 and the approved true-FP32 profile. The Rust tokenizer was checked against the pinned asset. The default test path uses frozen fragments and requires no checkpoint.
  • CPU widening and independent PyTorch verification checked 354,483,968 parameters across 148 tensors, including a single tied embedding/head copy. The output is 1,417,952,352 bytes, SHA-256 4757f9b07ce4eb8540130f40cd1607f0c953ef8d8f53768ddfb6b782db420fb8. Rust inspection accepted the artifact and rejected a modified config. Weights remain under their upstream license.
  • Native CUDA inference, context capacity, HTTP readiness and latency remain unverified. The existing exact-choice, strict score error below 0.15, and cache isolation and distribution gates apply to the subsequent executor.

Merge Danger

Door: Two-way. Blast radius: LFM preparation and workspace registration. The runnable worker and existing dispatch paths have no behavioral change.

Self-review

The draft includes a CPU-verified, model-specific slice for contributor review.

  • I have reviewed the full diff and addressed the issues I found.
  • I have checked that the change follows the project's architecture and stays focused on the stated purpose.
  • I have run the checks appropriate to this change and reported commands, results, and anything I could not verify above.
  • I have checked that the PR description, documentation, and any accuracy or performance claims match the implementation and available evidence.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant