Measured on device (edge-compat, gfpgan_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 88.9 ms p50 (2026-08-26); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 32.3 ms p50 (2026-08-26); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 4085 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 60.6 ms p50 · output differs from CPU (max rel diff 9e+08) (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/gfpgan-v1.4__gfp
2
13 commits
5 linked in READMEs
updated Sep 8, 2026
Measured on device (edge-compat, gfpgan_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 88.9 ms p50 (2026-08-26); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 32.3 ms p50 (2026-08-26); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 4085 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 60.6 ms p50 · output differs from CPU (max rel diff 9e+08) (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/gfpgan-v1.4__gfpgan_fp16/CARD.md
Measured on device (edge-compat, yunet_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 3.28 ms p50 (2026-08-25); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 1.83 ms p50 (2026-08-25); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 33.5 ms p50 (2026-08-31). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/gfpgan-v1.4__yunet_fp16/CARD.md

On-device GFPGAN v1.4 blind face restoration: it reconstructs
degraded / low-quality faces using a StyleGAN2 generative facial prior. Converted for LiteRT
CompiledModel with the GPU (ML Drift) accelerator and verified running fully on the GPU of a
Pixel 8a (551/551 nodes delegated to LITERT_CL, ~1.2 s per face).
| File | What | I/O |
|---|---|---|
gfpgan_fp16.tflite | GFPGAN v1.4 restoration (431 MB, fp16) | [1,3,512,512] NCHW [-1,1] → [1,3,512,512] NCHW [-1,1] |
yunet_fp16.tflite | YuNet face detector (0.3 MB) for alignment | [1,3,640,640] BGR 0-255 → 5 landmarks |
[-1,1], run gfpgan_fp16.tflite, denormalize
(x+1)*127.5.Android (Kotlin, CompiledModel GPU)
// 431 MB — stage into filesDir and load by path
val model = CompiledModel.create("${context.filesDir}/gfpgan_fp16.tflite",
CompiledModel.Options(Accelerator.GPU), null)
val inputs = model.createInputBuffers()
val outputs = model.createOutputBuffers()
inputs[0].writeFloat(chw) // [1,3,512,512] RGB in [-1,1], FFHQ-aligned face
model.run(inputs, outputs)
val restored = outputs[0].readFloat() // [1,3,512,512] in [-1,1] -> (x+1)*127.5
Python (desktop verification)
import numpy as np
from PIL import Image
from ai_edge_litert.interpreter import Interpreter
# input must be an FFHQ-aligned 512x512 face crop (YuNet 5-landmark warp; see Pipeline)
img = Image.open("aligned_face.png").convert("RGB").resize((512, 512))
x = (np.asarray(img, np.float32) / 127.5 - 1.0).transpose(2, 0, 1)[None] # [1,3,512,512]
it = Interpreter(model_path="gfpgan_fp16.tflite"); it.allocate_tensors()
it.set_tensor(it.get_input_details()[0]["index"], x); it.invoke()
y = it.get_tensor(it.get_output_details()[0]["index"])[0] # [3,512,512], [-1,1]
Image.fromarray(((y.transpose(1, 2, 0) + 1) * 127.5).clip(0, 255).astype(np.uint8)).save("restored.png")
Converted with litert-torch (NCHW preserved). The only substantial re-authoring is the StyleGAN2
ModulatedConv2d, whose original form builds a 5D weight (b,c_out,c_in,k,k) at runtime from the
style vector and convolves with that runtime filter — both GPU-incompatible (>4D tensor; a GPU
CONV_2D needs a constant filter). It is rewritten to an exact 4D form:
conv(x, W·style) == conv(x · style_per_in_channel, W_const) (conv is linear), so
the style becomes an input channel-scale and the filter stays constant.rsqrt(Σ (W·style)² + eps) == rsqrt((style²) @ Wsqᵀ + eps) where
Wsq[o,i] = Σ_k W[o,i,k]² is a constant matrix — a small matmul + RSQRT.fp16 note (Mali): the demod sum Σ style²·Wsq overflows fp16 — the style vectors reach |s|~1000,
so the sum reaches ~2.3e6 ≫ 65504, giving rsqrt(inf)=0 and collapsing the decoder to a flat color
(it still compiles and runs). Normalizing the style by its per-image max before squaring keeps every
intermediate in fp16 range; the scale cancels exactly against the demod, so the on-device output is
identical to the desktop fp32 result.
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.
| Runtime | Backend | Graph on GPU | Latency |
|---|---|---|---|
TFLite benchmark_model (TfLiteGpuDelegateV2) — yunet_fp16.tflite | GPU (OpenCL) | 146 / 146 | 22.1 ms |
TFLite benchmark_model (TfLiteGpuDelegateV2) — gfpgan_fp16.tflite | GPU (OpenCL) | 641 / 641 | 265.2 ms |
TFLite benchmark_model — yunet_fp16.tflite | CPU (XNNPACK, 4 threads) | — | XNNPACK declined the graph |
TFLite benchmark_model — gfpgan_fp16.tflite | CPU (XNNPACK, 4 threads) | — | 6070.3 ms |
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.
XNNPACK declines these fp16 graphs — it reports failed to delegate DEPTHWISE_CONV_2D and then fails to allocate tensors — so there is no usable CPU number. Disabling XNNPACK falls back to reference kernels, which measured about 20× slower than the GPU on models of this size and would not represent CPU inference anyone would ship.
gfpgan_fp16.tflite — the NPU is 2.76x faster than the GPU (32.26 ms against 88.95 ms) and loads 5.62x faster (726 ms against 4085 ms).yunet_fp16.tflite — the NPU is 1.79x faster than the GPU (1.83 ms against 3.28 ms) and loads 5.89x faster (98 ms against 578 ms).| file | backend | compiled | inference (median / min) | load |
|---|---|---|---|---|
gfpgan_fp16.tflite | NPU (Hexagon v81) | on-device JIT | 32.26 ms / 30.55 ms | 726 ms |
gfpgan_fp16.tflite | GPU (Adreno) | — | 88.95 ms / 87.71 ms | 4085 ms |
yunet_fp16.tflite | NPU (Hexagon v81) | on-device JIT | 1.83 ms / 1.78 ms | 98 ms |
yunet_fp16.tflite | GPU (Adreno) | — | 3.28 ms / 2.11 ms | 578 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.54–0.79, 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 985 ms to 25 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.
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).
| File | Inference (median) | Spread (min–max) | Runs | Peak memory |
|---|---|---|---|---|
gfpgan_fp16.tflite | 4,085.3 ms | 4,031.7–4,227.1 ms | 111 | 1309 MB |
yunet_fp16.tflite | 33.5 ms | 33.2–34.6 ms | 150 | 138 MB |
Apache-2.0, following the upstream TencentARC/GFPGAN.
Measured on device (edge-compat, gfpgan_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 88.9 ms p50 (2026-08-26); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 32.3 ms p50 (2026-08-26); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 4085 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 60.6 ms p50 · output differs from CPU (max rel diff 9e+08) (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/gfpgan-v1.4__gfp
2
13 commits
5 linked in READMEs
updated Sep 8, 2026
Measured on device (edge-compat, gfpgan_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 88.9 ms p50 (2026-08-26); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 32.3 ms p50 (2026-08-26); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 4085 ms p50 (2026-08-31); browser · Chromium 151 on M4 Max · LiteRT.js 2.5.3 · WebGPU · 60.6 ms p50 · output differs from CPU (max rel diff 9e+08) (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/gfpgan-v1.4__gfpgan_fp16/CARD.md
Measured on device (edge-compat, yunet_fp16): Galaxy S26 · LiteRT 2.2.0 · GPU (ML Drift) · 3.28 ms p50 (2026-08-25); Galaxy S26 · LiteRT 2.2.0 · NPU (QNN/HTP) · 1.83 ms p50 (2026-08-25); Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 33.5 ms p50 (2026-08-31). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/gfpgan-v1.4__yunet_fp16/CARD.md

On-device GFPGAN v1.4 blind face restoration: it reconstructs
degraded / low-quality faces using a StyleGAN2 generative facial prior. Converted for LiteRT
CompiledModel with the GPU (ML Drift) accelerator and verified running fully on the GPU of a
Pixel 8a (551/551 nodes delegated to LITERT_CL, ~1.2 s per face).
| File | What | I/O |
|---|---|---|
gfpgan_fp16.tflite | GFPGAN v1.4 restoration (431 MB, fp16) | [1,3,512,512] NCHW [-1,1] → [1,3,512,512] NCHW [-1,1] |
yunet_fp16.tflite | YuNet face detector (0.3 MB) for alignment | [1,3,640,640] BGR 0-255 → 5 landmarks |
[-1,1], run gfpgan_fp16.tflite, denormalize
(x+1)*127.5.Android (Kotlin, CompiledModel GPU)
// 431 MB — stage into filesDir and load by path
val model = CompiledModel.create("${context.filesDir}/gfpgan_fp16.tflite",
CompiledModel.Options(Accelerator.GPU), null)
val inputs = model.createInputBuffers()
val outputs = model.createOutputBuffers()
inputs[0].writeFloat(chw) // [1,3,512,512] RGB in [-1,1], FFHQ-aligned face
model.run(inputs, outputs)
val restored = outputs[0].readFloat() // [1,3,512,512] in [-1,1] -> (x+1)*127.5
Python (desktop verification)
import numpy as np
from PIL import Image
from ai_edge_litert.interpreter import Interpreter
# input must be an FFHQ-aligned 512x512 face crop (YuNet 5-landmark warp; see Pipeline)
img = Image.open("aligned_face.png").convert("RGB").resize((512, 512))
x = (np.asarray(img, np.float32) / 127.5 - 1.0).transpose(2, 0, 1)[None] # [1,3,512,512]
it = Interpreter(model_path="gfpgan_fp16.tflite"); it.allocate_tensors()
it.set_tensor(it.get_input_details()[0]["index"], x); it.invoke()
y = it.get_tensor(it.get_output_details()[0]["index"])[0] # [3,512,512], [-1,1]
Image.fromarray(((y.transpose(1, 2, 0) + 1) * 127.5).clip(0, 255).astype(np.uint8)).save("restored.png")
Converted with litert-torch (NCHW preserved). The only substantial re-authoring is the StyleGAN2
ModulatedConv2d, whose original form builds a 5D weight (b,c_out,c_in,k,k) at runtime from the
style vector and convolves with that runtime filter — both GPU-incompatible (>4D tensor; a GPU
CONV_2D needs a constant filter). It is rewritten to an exact 4D form:
conv(x, W·style) == conv(x · style_per_in_channel, W_const) (conv is linear), so
the style becomes an input channel-scale and the filter stays constant.rsqrt(Σ (W·style)² + eps) == rsqrt((style²) @ Wsqᵀ + eps) where
Wsq[o,i] = Σ_k W[o,i,k]² is a constant matrix — a small matmul + RSQRT.fp16 note (Mali): the demod sum Σ style²·Wsq overflows fp16 — the style vectors reach |s|~1000,
so the sum reaches ~2.3e6 ≫ 65504, giving rsqrt(inf)=0 and collapsing the decoder to a flat color
(it still compiles and runs). Normalizing the style by its per-image max before squaring keeps every
intermediate in fp16 range; the scale cancels exactly against the demod, so the on-device output is
identical to the desktop fp32 result.
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.
| Runtime | Backend | Graph on GPU | Latency |
|---|---|---|---|
TFLite benchmark_model (TfLiteGpuDelegateV2) — yunet_fp16.tflite | GPU (OpenCL) | 146 / 146 | 22.1 ms |
TFLite benchmark_model (TfLiteGpuDelegateV2) — gfpgan_fp16.tflite | GPU (OpenCL) | 641 / 641 | 265.2 ms |
TFLite benchmark_model — yunet_fp16.tflite | CPU (XNNPACK, 4 threads) | — | XNNPACK declined the graph |
TFLite benchmark_model — gfpgan_fp16.tflite | CPU (XNNPACK, 4 threads) | — | 6070.3 ms |
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.
XNNPACK declines these fp16 graphs — it reports failed to delegate DEPTHWISE_CONV_2D and then fails to allocate tensors — so there is no usable CPU number. Disabling XNNPACK falls back to reference kernels, which measured about 20× slower than the GPU on models of this size and would not represent CPU inference anyone would ship.
gfpgan_fp16.tflite — the NPU is 2.76x faster than the GPU (32.26 ms against 88.95 ms) and loads 5.62x faster (726 ms against 4085 ms).yunet_fp16.tflite — the NPU is 1.79x faster than the GPU (1.83 ms against 3.28 ms) and loads 5.89x faster (98 ms against 578 ms).| file | backend | compiled | inference (median / min) | load |
|---|---|---|---|---|
gfpgan_fp16.tflite | NPU (Hexagon v81) | on-device JIT | 32.26 ms / 30.55 ms | 726 ms |
gfpgan_fp16.tflite | GPU (Adreno) | — | 88.95 ms / 87.71 ms | 4085 ms |
yunet_fp16.tflite | NPU (Hexagon v81) | on-device JIT | 1.83 ms / 1.78 ms | 98 ms |
yunet_fp16.tflite | GPU (Adreno) | — | 3.28 ms / 2.11 ms | 578 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.54–0.79, 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 985 ms to 25 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.
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).
| File | Inference (median) | Spread (min–max) | Runs | Peak memory |
|---|---|---|---|---|
gfpgan_fp16.tflite | 4,085.3 ms | 4,031.7–4,227.1 ms | 111 | 1309 MB |
yunet_fp16.tflite | 33.5 ms | 33.2–34.6 ms | 150 | 138 MB |
Apache-2.0, following the upstream TencentARC/GFPGAN.