Skip to content

Deterministic Fuel Metering

When an LLM writes recursive functions or infinite loops (while (true) {}), traditional container runtimes rely on imprecise operating system wall-clock timeouts or CPU cgroup throttling.

  • Flaky & Variable: On an overloaded server, a legitimate function might take 500ms to complete and get prematurely killed. On an idle server, the same function completes in 50ms.
  • Non-Deterministic: Two identical executions can yield different outcomes simply because of background host CPU contention.
  • Billing Inaccuracy: Measuring CPU milliseconds makes fair serverless metering difficult.

RunVero implements instruction-level fuel metering directly via Wasmtime:

  1. Opcode Counting: Every WebAssembly bytecode instruction consumes discrete units of fuel.
  2. Deterministic Termination: If an execution exhausts its allocated fuel budget (e.g. 10,000,000 units), the Wasmtime engine traps instantly with an OutOfFuel error at the exact opcode boundary.
  3. Reproducible: Running the same input code with the same fuel budget will always consume the exact same fuel units, regardless of server load or CPU architecture.
Host Store ──> [ Fuel Budget: 10,000,000 ]
│
▼ (each opcode decr. fuel)
[ Guest Execution ]
│
▼ (Fuel reaches 0)
Deterministic Trap: OutOfFuel