Model Benchmarking¶
Research question¶
How do different perception models trade off latency, energy, and safety outcomes across network conditions and deployment placements?
Layers involved¶
Data Source — CARLA, replay, or synthetic
Processing Core — model registry; per-device artifact selection via
nodes[*].deviceNetWaggle — link conditions under which models are evaluated
Analysis — per-frame latency, collision outcome, queue depth
What to configure¶
The model registry maps a logical model name to per-device artifact paths. The example below shows the registry structure from the braking experiment:
examples/braking/flat/atspeed_braking.yaml¶# At-speed emergency-braking experiment.
#
# What this is: the ego is spawned already below the speed-kick gate (the
# scenario places it at y=85) so it is travelling when the obstacle comes into
# view, which is the case the open-loop config cannot produce. A static obstacle
# sits ahead; the ego streams camera frames to the detection server and brakes on
# command. Used to compare link backends on an identical closed-loop scenario.
#
# How to use (the backend is chosen per run, the experiment is not):
# cadet run examples/braking/flat/atspeed_braking.yaml --app-module examples.braking.flat.app \
# --set links.0.network.mode=delay --model-dir <DIR>
# cadet emulate examples/braking/flat/atspeed_braking.yaml --app-module examples.braking.flat.app \
# --set links.0.network.mode=netwaggle --model-dir <DIR>
#
# No simulator address to pass: this config launches its own server and reaches
# it on the loopback. CADET_SCENARIO_RUNNER_DIR and CADET_CARLA_PYTHONAPI_DIR
# say where this machine keeps the two trees the scenario container mounts.
#
# The simulator address is reached off-link (over each emulated host's bypass
# interface under netwaggle), so it is passed at run time and never committed.
extends: ../../../configs/base.yaml
experiment:
name: atspeed_braking
app: braking
repetitions: 3 # the parity convention for this scenario
seed: 0
# What ends a run, stated rather than left to whichever process exits first.
#
# client_report is what the original orchestrator did, and its code says so
# plainly: it launched the client with wait=True (in the foreground), printed
# the final client report the moment the client returned, and only then sent
# ScenarioRunner a SIGTERM. It never waited on the scenario process at all.
# Measured here too - ScenarioRunner is still running when the client
# finishes, and the "All scenario tests were passed successfully!" line in its
# log is printed while it handles that teardown signal, not because the
# behaviour tree completed.
#
# Ending on the sim hook would also cut this scenario short: the behaviour
# tree finishes when the ego has driven 100 m, while the run's point is the
# braking that happens well before then.
end_on: client_report
# The two phase limits. Stated here because this is the example where they
# differ most: the server spends about ten seconds loading yolo11x before the
# client sends its first frame, so one limit over both phases would mostly be
# a limit on that load, and would mean something different on other hardware.
max_startup_s: 240.0 # 60 s for the server's listening line + 180 s for the
# scenario's readiness marker; the same as the default
# sum, written out so it is visible.
max_active_s: 120.0 # the streaming-and-braking phase
# The simulator side this experiment owns. Declaring the pieces together is the
# point: a CARLA server, the client egg that talks to it and a ScenarioRunner
# tree have to match, and a mismatch never announces itself as one - it arrives
# as an import error, or as a scenario that loads and behaves differently.
# Preflight refuses the run on any disagreement.
#
# The paths are the deployment image's own conventions, not a machine's: the
# image mounts the CARLA PythonAPI at /opt/carla and ScenarioRunner at
# /opt/scenario_runner.
source:
kind: carla
fps: 10
camera:
# Matches the open-loop client: 800x600 sensor at 60 deg FOV.
width: 800
height: 600
fov: 60.0
scenario:
map: Town05 # AtSpeed.xml declares Town05
# What the scenario driver is told to run. Naming it here is what lets the
# framework build the original'"'"'s scenario command itself (--reloadWorld,
# --timeout 10000, --output, and the simulator address) instead of taking
# the whole command from the environment; see cadet.sim.scenario_command.
name: AtSpeedBraking_1
definition: examples/braking/flat/scenarios/at_speed_braking_scenario.py
config_file: examples/braking/flat/scenarios/AtSpeed.xml
# The braking app has a tuned brake controller per ego; audi.tt is the one
# the open-loop matrix uses as its first axis value. The scenario spawns the
# ego the sim hook names, so the XML's own model attribute is not used.
ego_vehicle: audi.tt
target_object: car
# Default = the original's 40mph (1:1 rule). The original client's throttle
# targets 40mph and overrides the scenario's KeepVelocity(10 m/s), so the ego
# approaches at ~36 mph. Override to 36kph to instead agree with KeepVelocity
ego_speed: 40mph
runner:
path: /opt/scenario_runner
# The scenario driver runs in a container from this image, which
# carries ScenarioRunner's pinned dependencies; the tree above is
# mounted into it. Built by docker/Dockerfile (INSTALL_SIM=1).
image: cadet:dev
source_digest: 27dae4b3e9d3aff5
weather: clear
carla:
image: carlasim/carla:0.9.10.1
gpu_index: 1 # the simulator owns GPU 1; the detector has GPU 0
quality: Low
offscreen: true
client_egg:
name: carla-0.9.10-py3.7-linux-x86_64.egg
port: 2000
timeout: 10
models:
# The original braking scripts ran without model warm-up; set true to warm
# the model.
warmup: false
detector: yolo
tracker: sort
predictor: linear
model: yolo11x
registry:
yolo11x:
per_device:
gpu: yolo11x.pt
edge: yolo11x.engine
hailo: yolo11x.hef
coco_labels:
per_device:
gpu: coco.names
edge: coco.names
hailo: coco.names
nodes:
- name: client
host: localhost
launcher: local
role: client
device: cpu
- name: server
host: localhost
port: 10100
launcher: local
role: server
device: gpu
gpu_index: 0 # detector on GPU 0; the simulator owns GPU 1
# The original server's fixed per-request cost. Compute, not network.
extra_processing_ms: 13.0
channels:
- name: frames
from: client
to: server
max_queue: 2
send_meta: false
stop_on_brake: true
links:
# A real network path: p50 30 ms, p99 100 ms. Log-normal is the family that
# fits a latency - strictly positive with a long tail - and its parameters
# here are those percentiles as the link states them: p50_ms is the median
# and p99_ms is the tail, from which sigma = ln(p99/p50) / 2.3263 = 0.5176.
#
# Only `mode: delay` reproduces this exactly; it samples the distribution per
# message. The kernel backends (netem, netwaggle) delay packets with a single
# netem, whose jitter is a *uniform* half-width about the delay, so they
# cannot render a spread this wide - a p99 of 100 ms on a 30 ms p50 would need
# a jitter larger than the delay, whose low side netem clamps to zero and
# moves the p50. They refuse it and say so. To run this scenario under a
# kernel backend, override the link with a spread it can hold, e.g.
# --set links.0.network.distribution.p99_ms=55.0 # a shorter tail
# --set links.0.network.bandwidth_mbps=100
# A bandwidth is required for any jittered kernel link: it is what serialises
# netem's output and keeps the flow in order.
- name: frames_link
from: client
to: server
direction: forward
network:
mode: delay # overridden per run on the command line
distribution:
kind: lognormal
p50_ms: 30.0 # the median
p99_ms: 100.0 # the tail; sigma = ln(p99/p50) / 2.3263 = 0.5176
loss: 0.0
app:
plugin: braking
# outputs / transport / metrics inherited from configs/base.yaml.
Key fields:
models.model— active logical model name (must be a key inmodels.registry)models.registry.<key>.per_device.<device>— path to the model artifact for each device typenodes[*].device— which device type this node uses to look up the artifact
To sweep over link delay conditions:
docs/snippets/sweep-link-delay.yaml¶# Sweep example: constant delay values. Generates 4 run configs.
# Use as a template; replace with lognormal or netem fields as needed.
# Passes cadet validate.
extends: ../../configs/base.yaml
experiment: {name: snippet_sweep_delay, app: reference, repetitions: 1}
source: {kind: synthetic, count: 8, width: 64, height: 48}
nodes:
- {name: client, host: localhost, role: client, device: cpu}
- {name: server, host: 127.0.0.1, port: 15016, role: server, device: cpu}
links:
- name: inference_link
from: client
to: server
network:
mode: delay
distribution:
kind: constant
value_ms: 20.0
loss: 0.0
sweep:
axes:
links[0].network.distribution.value_ms: [10, 20, 40, 80]
app: {plugin: reference, params: {model_kind: stub}}
To sweep over model variants, register each under a distinct key in
models.registry and add models.model to the sweep axes.
How to run¶
cadet run examples/braking/flat/atspeed_braking.yaml \
--set source.carla.host=$(hostname -I | awk '{print $1}') \
--app-module examples.braking.flat.app
For a sweep over delay conditions:
cadet sweep examples/braking/flat/atspeed_braking.yaml \
--set source.carla.host=$(hostname -I | awk '{print $1}') \
--app-module examples.braking.flat.app
Where results land¶
outputs/{experiment}/{app}/{run_id}/:
{run_id}_latency_location_log.csv— per-frame latency and brake reaction timerun.json— resolved model and node config for the cell
The brake_reaction_latency_s column is the primary metric. The paper’s
Table II sweeps YOLO11n through YOLO11x against link delay percentiles.
How to extend¶
Register additional YOLO variants under separate registry keys and sweep
models.modelover them.Evaluate on replayed data: set
source.kind: replaywithsource.pathpointing to a recorded frames directory.Enable the queue collector: add
metrics.collectors: [queue].
See also¶
Register per-device model artifacts — artifact registration
Tutorial 5: Sweeps and Reproducibility — sweep configuration
Tutorial 4: Multi-Device Deployment — multi-device deployment
Dataset Mode — VLM/LLM dataset mode