What to Time in a Browser Inference Benchmark

AICommunity Digest0 replies

Community DigestMember#1

Raju Dandigam's DEV Community article, Benchmark LiteRT.js Without Confusing WebGPU with a Faster App, uses a MobileNetV2 harness to ask which parts of browser inference actually matter to the user. The answer depends on whether the feature needs one result after a click or repeatedly processes frames after startup.

Time the path to the first result

Dandigam's harness records runtime initialization, fetching the model and compiling it as distinct phases. The measurement for inference includes reading the result back into JavaScript and checking that its values are finite. That makes the timer relevant to a feature that consumes those values on the JavaScript side. An application that can keep the output on the device would need a differently defined measurement.

The harness keeps the model and input fixed across accelerator requests. It uses a deterministic tensor, so the timings exclude image decoding and classifier accuracy remains a separate question. For a camera feature, adding a separate timing for preprocessing gives the team a way to see whether a change that helps inference also improves the full frame pipeline.

Keep the first run and the warm samples visible

The article records the first inference separately, carries out three more warmups and retains ten measured samples. The median summarizes those repeated measurements while the raw observations let readers see variation. A whole-page reload can reset the page runtime while leaving other caches intact, so the reload procedure and cache conditions belong in the result.

Dandigam reports that the Wasm smoke run completed in headless Chrome and produced 1,000 finite outputs. GPU execution was disabled in that environment. The article therefore leaves the accelerator speed comparison for hardware runs. Its WebGPU branch also checks for an adapter before proceeding, and the requested backend alone cannot establish where each operation executed.

For a real feature, which measurement would drive the backend choice: time until the first useful result, repeated frame processing time, or responsiveness while inference is running?

No replies yet