Measured on device (edge-compat, rfdetr_grapha_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 18.5 ms p50 (2026-08-26); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 15.1 ms p50 (2026-08-26); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 458 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 18.5 ms p50 · output matches CPU (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/rf-detr-nano__rfdetr_grapha_fp16/CARD.md
Measured on device (edge-compat, rfdetr_graphb_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 7.41 ms p50 (2026-08-25); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 12.8 ms p50 (2026-08-25); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 64.0 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 4.80 ms p50 · output differs from CPU (max rel diff 2.4e+02) (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/rf-detr-nano__rfdetr_graphb_fp16/CARD.md
RF-DETR Nano — LiteRT (CompiledModel GPU)
[Image blocked: RF-DETR Nano on a Pixel 8a — both transformer graphs on CompiledModel GPU]
RF-DETR (Roboflow 2025, an LW-DETR derivative) object detection,
converted to LiteRT and running 100% on the CompiledModel GPU (ML Drift) on a phone — the first
transformer/DETR detector to ride the LiteRT GPU API with no CPU/ONNX fallback.
RF-DETR is a transformer detector (windowed DINOv2-S backbone + deformable-attention DETR decoder).
Off-the-shelf it is GPU-incompatible (deformable grid_sample → GATHER_ND, windowed attention →
5D/6D tensors, two-stage query selection → TOPK/GATHER). Here it is converted with litert-torch
and split into two GPU graphs with a tiny host step between them, so the whole detector runs on the
GPU.
Try it in your browser: huggingface.co/spaces/litert-community/rf-detr-nano-object-detection — the two .tflite graphs below running on LiteRT.js (graph A on WebGPU, graph B on WASM). Nothing to install; inference runs on your machine.
Files
How it runs (two-graph split)
The two-stage query selection (TOPK/GATHER) has no GPU op, but the proposal grid is
image-independent, so the model splits at exactly that point — the standard two-stage-DETR edge split.
Both graphs are 100% GPU-resident.
Minimal usage
Android (Kotlin, CompiledModel GPU)
Python (desktop verification)
On-device (Pixel 8a, Tensor G3 — verified)
Full pipeline ≈ 27 ms (model) / ~100 ms end-to-end incl. host pre/post-processing. On a real image the
device chain reproduces the PyTorch detections at IoU 0.98–0.99 with matching class and score.
Preprocessing / outputs
- Input: square resize to 384×384, RGB, ImageNet mean/std (
[0.485,0.456,0.406]/[0.229,0.224,0.225]), NCHW.
- Output: Graph B
boxes are cxcywh normalized to [0,1]; logits are 91-way (index = COCO category id). Host applies sigmoid + score threshold + cxcywh→xyxy + per-class NMS.
Conversion notes
Converted with litert-torch (NCHW preserved — onnx2tf destroys ViT attention). Re-authoring (per-graph
tflite-vs-torch correlation 1.0): windowed DINOv2 backbone (6D window-partition → ≤4D, SDPA → manual
attention), deformable grid_sample → a GATHER/CAST-free tent-matmul, MSDeformAttn ≤4D, baked sine
pos-embed, and a down-scaled fp16-safe LayerNorm in the projector and decoder (the Mali delegate
computes in fp16, and those LayerNorm channel-sums otherwise overflow). The two-stage topk/gather runs on
the host between the two graphs.
A runnable Android sample (CompiledModel GPU) and the conversion scripts are in the official
ai-edge-litert/litert-samples object_detection
example.
Performance
Measured on a Pixel 8a (Tensor G3, Android 16) with the standard TFLite benchmark_model tool — 10 warm-up runs then 50 timed runs, reported as the tool's mean.
Any on-device figure recorded when this model shipped came from a different runtime. It was taken through LiteRT's own CompiledModel accelerator (logcat reports it as LITERT_CL), which is the path the Kotlin sample app and the LiteRT API use, and it appears elsewhere on this card. The rows above are the classic TFLite OpenCL delegate, measured with a tool anyone can download and re-run. The two are not comparable, so read the rows above as a reproducible floor rather than as this model's speed on LiteRT.
Note that the GPU does not take the whole graph here (68 / 404 in rfdetr_graphB_fp16.tflite); the remainder runs on the CPU and the split costs a per-partition round trip.
Snapdragon NPU (Hexagon)
rfdetr_graphA_fp16.tflite — the NPU is 1.22x faster than the GPU (15.11 ms against 18.45 ms) and loads 12.94x faster (176 ms against 2272 ms).
rfdetr_graphB_fp16.tflite — the GPU is faster: 7.41 ms against 12.82 ms on the NPU, a factor of 1.73. The NPU still loads 10.43x faster (125 ms against 1299 ms).
Measured on a Samsung Galaxy S26 (Snapdragon 8 Elite Gen 5 / SM8850, Hexagon v81, Android 16) with LiteRT CompiledModel 2.2.0, one accelerator per process, 5 warm-up runs then N=50 timed runs, median reported. Every run held thermal status NONE throughout. Headroom 0.76–0.78, where 1.0 is the throttling threshold.
The NPU rows ran the published file unchanged. LiteRT compiled it for the Hexagon on the device at first load. Those first compiles took 14 s to 36 s here. The load column above is the cached load every later run pays. Recipe and the runtime libraries it needs: NPU guide.
GPU wiring: GPU guide.
Raspberry Pi 5 (CPU)
Measured on a Raspberry Pi 5 Model B Rev 1.1 (8 GB, Raspberry Pi OS 64-bit) with the LiteRT benchmark_model tool from litert-cli-nightly 0.2.0.dev20260805: CPU inference (XNNPACK, 4 threads), 3 invocations per file of 10 warm-up plus 50 timed runs (the tool caps a phase at 150 s, so very slow graphs run fewer — the Runs column is the actual timed total). The latency is the median across invocations; the spread is the min–max over all timed runs. No thermal throttling occurred during these runs (vcgencmd get_throttled stayed 0x0).
License
Apache-2.0, inherited from roboflow/rf-detr.