qnsai-constraint-bench 開源:Rust 機械人安全驗證器達 288.9 ns/op,並提供量子啟發式 QUBO 最佳化器
Zero-Dependency Rust for Neuro-Symbolic Robotics Guardrails (288.9 ns/op, 0 Allocs) & Quantum-Inspired QUBO Optimization
ofraMesseJ 開源 qnsai-constraint-bench v0.1.0,這個零依賴 Rust 專案提供神經符號安全包絡驗證器及量子啟發式 QUBO 最佳化器。
When deploying autonomous robotics or multi-agent fleets, pure neural policies inevitably produce out-of-distribution (OOD) hallucinations — commanding excessive torque, breaching speed envelopes, or violating pairwise collision clearance.
At ofraMesseJ, we just open-sourced qnsai-constraint-bench (v0.1.0, MIT) — a zero-dependency Rust (edition = "2021", empty [dependencies]) proof and benchmark harness demonstrating two core primitives of our Quantum-Inspired Neuro-Symbolic AI (Q-NSAI) architecture:
-
Deterministic Neuro-Symbolic Safety Envelope Verifier (
src/symbolic.rs) — enforces 5 hard symbolic invariants (INV-01finite kinematics,INV-02Euclidean speed bound,INV-03torque ceiling,INV-04power & battery reserve floor,INV-053D collision clearance) with zero heap allocations on the hot path and emits a deterministic FNV-1a verification certificate. -
Quantum-Inspired QUBO Optimizer (
src/qubo.rs) — pure-Rust geometric annealing solver forN-variable QUBO Hamiltonians (E(x) = x^T Q x) usingO(N)incremental delta-energy updates and a deterministicxorshift64*PRNG.
Measured --release Benchmarks (rust:1.85-alpine, Linux x86_64)
1. Neuro-Symbolic Safety Verifier (100,000 neural proposals, 6 neighbors)
| Metric | Unconstrained Neural | Q-NSAI Guarded (Rust) |
|---|---|---|
| Safety Envelope Violations |
15,000 (15.00%) |
0 (0.00%) |
| Accepted Safe Actions | 85,000 |
85,000 |
| Avg Verification Latency | — | 288.9 ns/op (0.289 µs/op) |
| Throughput | — | 3.46M verifications/sec |
| Hot-Path Heap Allocations | — | 0 |
2. Quantum-Inspired QUBO Optimizer (200 annealing sweeps)
Variables (N) |
Initial E(x)
|
Optimized E(x)
|
Latency (ms) |
|---|---|---|---|
16 |
-10.66 |
-22.48 |
0.149 ms |
32 |
+1.96 |
-45.22 |
0.304 ms |
64 |
+90.46 |
-84.05 |
3.039 ms |
Reproduce Locally in 10 Seconds
git clone https://github.com/ofraMesseJ/qnsai-constraint-bench.git
cd qnsai-constraint-bench
cargo test --verbose
cargo run --release
Or via Docker without installing Rust:
docker run --rm -v "$PWD:/src" -w /src rust:1.85-alpine sh -c "cargo test && cargo run --release"
- GitHub Repo (MIT, Zero External Crates): https://github.com/ofraMesseJ/qnsai-constraint-bench
- ofraMesseJ Architecture House: https://oframessej.com/
- Flagship Venture (NyxSynth Post-Quantum AI Settlement): https://nyxsynth.com/architecture/
來源:DEV Community · dev.to