Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

BiRefNet-lite rewrite runs 1024px masks on a phone NPU

AI summary

Independent researcher /u/subhashg547 reported rewriting BiRefNet-lite to generate 1024×1024 masks entirely on a Snapdragon 8 Elite Gen 5 NPU, taking 23.7 milliseconds on a Galaxy S26. The all-8-bit rewrite replaces deformable convolutions, revises shifted-window attention, and uses quantization-aware distillation; reported S-measure scores were 0.939 on ECSSD and 0.830 on DUT-OMRON. The researcher released open weights, code, a writeup, and compiled files for 42 Snapdragon chips, while noting softer edges, a 0.017 S-measure loss on DIS-VD fine structures, and no MediaTek or Tensor support.

In-depth insight

The project offers a concrete open-weight route to high-resolution, fully on-device segmentation on Snapdragon NPUs, with its latency, accuracy, code, weights, and limitations publicly documented.

I wanted tap-to-lift subject cutout in my Android gallery app, running fully on the NPU. BiRefNet-lite gave the best masks of the open models I tried, but it doesn't compile to a phone NPU. The decoder has 20 deformable convs, Swin uses 5D/6D tensors, the shifted windows use a cyclic roll, and 1024px activations don't fit in on-chip memory. So I rewrote it.

What I did:

  • Exact graph rewrites (same output as the original): 4D window partition, roll-free shifted windows with a fixed mask, channel-split convs, attention one head at a time.
  • Architecture changes: plain convs instead of deformable, 640px backbone with a 1024px mask from two inputs, a slim full-res tail, one global window in Swin stage 4.
  • QAT distillation through the exported NPU graph, all 8-bit.

Results:

  • 23.7 ms for a 1024×1024 mask on a Galaxy S26 (8 Elite Gen 5), 31.1 ms on an S25, 182 ms on a mid-range 7 Gen 1. All 2,060 layers on the NPU.
  • Stock BiRefNet-lite on the same phones: out of memory at 1024. At 512 it falls back to CPU, 677 ms and 2.1 GB peak.
  • Compiles AOT for 42 Snapdragon chips as one NPU partition (one GitHub Actions job per chip).
  • On held-out ECSSD and DUT-OMRON (neither model trained on them), the int8 model matches its fp32 teacher in S-measure (0.939 vs 0.938, 0.830 vs 0.826). Edges are a bit softer.

#BiRefNet-lite#Lumen Cutout#Snapdragon 8 Elite Gen 5#Galaxy S26#Galaxy S25#Snapdragon 7 Gen 1

Original · 2 min readRead the original
Group chat

No comments yet. Start the conversation.