ROS2 · LLM Safety · Deterministic Verification

Sole developerNov 2025 to Aug 2026complete, every result replayed in CI

Catching hallucinations before the wheels turn

Language models are being handed the steering wheel of real robots, and sometimes they invent a goal inside a wall. This project puts a deterministic verifier between the LLM and the hardware, and shows what it catches with committed, replayable data.

35/35 · 32/32
unsafe plans caught, for qwen2.5-7B and llama-3.3-70B respectively, with zero false positives over the same 40 scenarios
0
missed dangers: 2,071 constructed + 80 real-model cases, each count CI-enforced in the repo
10.3 µs
median verification latency (p99: 77 µs) on x86-64

Watch the film

A narrated walk-through of this project, 3 min 31 s, with subtitles.

Try the verifier

This is the verifier itself, ported line for line to JavaScript and run in your browser on six of the forty evaluation maps. Lay a path, or load what a model proposed on this map and watch the same check that rejected it in the repository reject it here, at the same waypoint. Paint a wall across a safe path and it stops being safe.

It opens on map 4 with llama-3.3-70B's proposal, exactly as the model wrote it. The route brushes a wall on the way into waypoint 13. The verifier found it there and rejected it, as the C++ build did when the proposal was recorded.

The problem

Ask a language model for a navigation plan and it usually gives a sensible one. Usually is the problem. When this project prompted qwen2.5:7b-instruct (temperature 0) for waypoint routes over 40 seeded indoor maps, the model produced unsafe plans in 35 of 40 cases: waypoint jumps no robot can follow, coordinates off the map, and paths straight through walls. The same 40 maps put to llama-3.3-70b-versatile, a model with ten times the parameters, still produced unsafe plans in 32 of 40.

The idea behind the project is that checking a neural network does not take a second one. A deterministic verifier (swept footprint collision against the costmap, continuity, workspace bounds, unmapped-space checks) gives a yes or no in microseconds, and the same answer every time.

The architecture

Where the verifier sits: between the language model and the robot LLM planner Llama-3.1-8B, quantized goals and trajectories may hallucinate Safety verifier deterministic, latency target 50 ms costmap collision check kinematic feasibility workspace bounds Jetson Orin Nano Nav2 controller executes on TurtleBot3 only verified commands proposed plan safe: pass unsafe: rejected, replan requested design concept - implementation and evaluation in progress
The verifier sits in the command path as a ROS2 node: proposals arrive on one topic, only verified plans leave on another, and every rejection names its violation and waypoint. The checks live in a ROS-free, unit-tested core; the Nav2 node is a thin adapter, build-verified against Humble in CI.

The results

Bar charts: all 40 qwen2.5-7B plans by pre-registered outcome bucket, and the violation classes among the 35 rejections
Every plan lands in one of six outcome buckets that were committed before any model output was evaluated, so the accounting cannot bend around the results. The load-bearing cell is unsafe_missed: zero. Failure modes span three classes, not one.
An actual qwen2.5-7B plan drawn on its scenario map, colliding with an obstacle at waypoint 1, with the verifier's rejection point marked
One of the 35, exactly as the model proposed it: the route collides immediately and never reaches the goal. This is committed data: the prompt, the raw response, and the map that reproduce this figure are all in the repository.
Histogram of verification latency over 2,071 constructed evaluation cases: median 10.3 microseconds, p99 77 microseconds
Latency over the 2,071-case constructed evaluation: six built-to-be-unsafe hallucination classes plus oracle-verified safe paths. 1,472 of 1,472 unsafe cases caught, zero false positives, at microsecond cost.

A second model went through the identical pipeline. llama-3.3-70b-versatile (temperature 0, hosted) proposed unsafe trajectories in 32 of 40 of the same scenarios; the verifier caught all 32, passed all 8 safe plans, and missed zero. The failure profile differs in kind, not just count: collision dominates its rejections (17, against qwen's 8), and it is the first model to trip the unmapped-space check (2 cases). Its endpoint adherence is perfect: 0 of 40 failures against qwen's 18. The larger model starts and ends exactly where asked and still drives through obstacles on the way: unsafe-but-on-target, the precise failure class a runtime gate exists for.

The detail136 words, about 1 min

Labels never come from the verifier under test. An independent reference checker with 4x finer sampling validates every safe case and confirms every unsafe one, and CI replays both evaluations from the committed datasets on every push, and the build fails if a single unsafe plan slips through.

Scope: these are facts about two models, a 7B and a 70B, each at one temperature on the same n=40 scenarios, reported per model and never averaged, and about six constructed violation classes. They are not facts about "LLMs" in general. Real-hardware trials (TurtleBot3 + Jetson) are the next roadmap step and will be published the same way: raw data first. An earlier version of this project claimed hardware results it could not back; those were retracted, and the git history documents both the retraction and the rebuild.