NibbleFlow: Sign-Exponent-Mantissa Refinement for 4-Bit Optical Flow

Perception, Robotics, AI and Sensing (PRAISe) Lab, University of Colorado Boulder
Sintel flow from RAFT-small, RAPIDFlow and NibbleFlow in FP32, with 4-bit weights and a linear output layer, and with 4-bit weights and SEM, next to a bar chart of Sintel clean EPE for each network

Sign-Exponent-Mantissa refinement for 4-bit optical flow. Each network is shown in FP32 and with 4-bit weights, with its linear output layer or with SEM. The 4-bit results use post-training quantization to 4-bit weights and 8-bit activations, except NibbleFlow with SEM, which runs as INT4 on the Hailo-8. Left, one Sintel clean pair (ambush_7) with the EPE and parameter count in each panel; the FP32 panels of RAFT-small and RAPIDFlow use SEM. Right, Sintel clean EPE. SEM significantly reduces the 4-bit error of every network.

up to 86%of the error that 4-bit weights add, removed by SEM
0.51Mparameters, with 86% of the weights in 4 bits
up to 45%lower Sintel error than the best deployable baseline
<1 pxof EPE lost to the FP32 version on Sintel

Abstract

Accurate optical flow relies on iterative refinement, yet the edge accelerators that small robots and other devices on batteries carry execute only static integer graphs and often leave just 4 bits per weight. Under this constraint, iterative networks lose much of their accuracy, and the networks designed for these chips are far less accurate to begin with.

We trace this loss to a single layer, the linear output of the update block. Refinement needs steps whose sizes differ by more than a factor of one hundred, but a linear output represents them like a fixed point number. The rounding error of its weights therefore adds the same error to every update, however small, and this error accumulates over the iterations.

We introduce SEM, an output layer that instead predicts each flow update as a floating point number with a Sign, an Exponent and a Mantissa. A rounding error then perturbs each update only in proportion to its size, while every output remains bounded and easy to quantize. Replacing only the output layer of existing networks such as RAFT-small and RAPIDFlow preserves their floating point accuracy and removes up to 86% of the error that 4-bit weights add. Built around SEM, NibbleFlow has only 0.51M parameters and runs on a Hailo-8 with most of its weights in 4 bits. It loses less than one pixel of EPE to its floating point version and cuts the Sintel error of the best deployable baseline by up to 45%, with 5.4× fewer parameters.

Motivation

Optical flow underpins visual odometry, structure from motion, tracking and navigation, and its accuracy today is driven by iterative refinement, in which an update block repeatedly corrects the current estimate. These methods run in floating point on desktop GPUs, whereas small robots and other battery-powered devices rely on edge AI accelerators such as the Hailo-8 and the Coral Edge TPU, which deliver several TOPS within a few watts.

This efficiency comes at a price, since these accelerators execute only a static graph with integer weights and keep all weights in the memory on the chip, which often leaves only 4 bits per weight. Under such quantization, iterative flow networks lose much of their accuracy, while the networks that were designed for these chips are far less accurate to begin with. As a result, accurate optical flow has remained out of reach on the very hardware that needs it.

The problem lives in one layer

Refinement asks one output layer for steps of very different sizes. The first iterations must cover most of the motion, while the last ones only polish it. At the first step of our coarsest level alone, the needed steps span seven octaves, from to pixels.

A standard linear output head represents a step the way a fixed point number represents a value. Its error is absolute, so this error decides the smallest step the head can take accurately, while the largest value of the last layer decides the largest one. The window of accurate steps therefore has a fixed width.

Measured dynamic range of one step. At the first step of the 1/32 level, the linear update saturates below one pixel and covers only 5.6 octaves, a 49× range of step sizes, whereas SEM follows the needed step from 2−6.9 to 20.1 pixels, 7.0 octaves or a 128× range, which matches the span of its exponents.

SEM: a floating point step

A floating point number escapes this limit because it stores the order of magnitude separately from the significant digits. SEM lets the update block do the same. For each flow component, it predicts a sign logit , exponent logits over powers of two, and a mantissa logit , and the step is their product:

Taking the logarithm turns the product into a sum, so the network's outputs set the logarithm of the step. An error in them becomes a relative error of the step, and a step of pixels and a step of pixels are taken with the same relative precision.

Why it suits integer hardware. Every predicted quantity lies in a fixed interval, , and , so each quantizes to 8 bits with a static scale. Decoding needs only a softmax, a fixed 1×1 convolution with weights and two elementwise products, all of which edge accelerators support.

Because only the output layer changes, SEM drops into any network that refines its flow by increments, with the same exponents and no tuning.

NibbleFlow

NibbleFlow architecture: features at 1/8, 1/16 and 1/32 are correlated along fixed directions without warping, and one shared SEM update block refines the flow coarse to fine
(a) Features at 1/8, 1/16 and 1/32 are correlated along fixed directions, so nothing is warped, and the flow is refined coarse to fine from zero. (b) The SEM update block predicts each step as the product of a sign, an exponent and a mantissa.

We build a network around SEM that an edge accelerator can run as a single static graph. Without a warp, each level correlates the two frames only along a few directions through each pixel, eight directions at 1/32, six at 1/16 and four at 1/8, and all three levels use a single SEM update block of width 96. NibbleFlow has 0.51M parameters and runs on a Hailo-8 with 86% of its weights in 4 bits. It is quantized with the Hailo compiler and its quantization-aware fine-tuning, which uses no Sintel data.

See the difference

Drag the slider. Both sides are the same network in INT4, with its linear output layer or with SEM, on one Sintel clean pair from Fig. 3 of the paper, with the EPE of the pair.

Input frame (Sintel clean)
Ground truth flow

RAPIDFlow with 4-bit weights

SEM · 1.24 EPELinear · 3.65 EPELinear · 3.65 EPESEM · 1.24 EPE

NibbleFlow with 4-bit weights

SEM · 1.41 EPELinear · 6.51 EPELinear · 6.51 EPESEM · 1.41 EPE
Grid of flow fields from RAPIDFlow, RAFT-small, IRR-PWC and NibbleFlow on Sintel clean, Sintel final and FlyingChairs, each in FP32, linear INT4 and SEM INT4
The linear output layer and SEM in four iterative flow networks. Each network is shown in FP32 and in INT4, with its linear output layer or with SEM, and the EPE of the pair is given in each panel. With the linear layer, every network loses much of the flow in INT4, whereas with SEM the flow stays close to FP32.

Results

SEM in existing networks

RAFT-small iterates a GRU at a single scale, RAPIDFlow refines from coarse to fine with a shared block, and IRR-PWC refines a feature pyramid with shared weights. In each network, we replace the convolution that regresses the update by the SEM head, with the same exponents for all networks and no tuning, and change nothing else. Both versions are trained from scratch on FlyingChairs with the official settings and the same seed. Replacing the output layer costs no accuracy in RAFT-small and RAPIDFlow in floating point. The picture changes completely once the weights are quantized to 4 bits.

Network FP32 INT4, linear INT4, SEM
RAFT-small 2.84 17.83 8.79
RAPIDFlow, 12 iterations 2.57 4.85 3.27
RAPIDFlow, 1 iteration 5.32 9.73 5.84
IRR-PWC 2.94 5.72 4.43

Sintel clean EPE (lower is better). FP32 is the linear version. INT4 is 4-bit weights with 8-bit activations, simulated with the same quantizer for both versions. With one iteration of RAPIDFlow, 4-bit weights add 4.41 EPE to the linear version and only 0.61 to SEM, which removes 86% of the added error.

Attribution of the quantization error. Quantizing one part of the network at a time locates this loss in a single layer. In RAPIDFlow with a single iteration, the 4-bit weights of the last convolution alone, which is the layer that SEM replaces, cost the linear version 4.98 of the 5.00 EPE that quantizing every layer costs, and SEM only 0.10. Keeping this one layer in 8 bits also rescues the linear version, which then matches SEM. The value of SEM is that its output layer tolerates 4-bit weights like every other layer, so no layer needs special treatment.

Comparison with edge optical flow networks

Network Params GMACs Sintel clean Sintel final Chairs Hailo-8 FPS
NanoFlowNet 0.17M 0.93 14.14 14.31 10.39 120.55
EdgeFlowNet 2.75M 19.98 8.65 9.22 5.50 76.30
NibbleFlow (ours) 0.51M 6.97 4.76 5.68 3.14 15.19

EPE of the INT4 networks quantized for the Hailo-8 (lower is better), on all 1041 Sintel pairs and 640 FlyingChairs validation pairs. In FP32, NibbleFlow reaches 3.88 / 4.76 on Sintel clean / final. No network is trained or calibrated on Sintel.

With 86% of its weights in 4 bits, NibbleFlow loses less than one pixel of EPE and reaches 4.76 and 5.68, which cuts the error of EdgeFlowNet, the best deployable baseline, by up to 45%, with 5.4× fewer parameters. NanoFlowNet is smaller and faster, but its INT4 error is more than twice as high.

A controlled test of the update alone

Update Sintel clean Sintel final Clean, last 50 epochs Final, last 50 epochs Range (octaves) Largest step
Linear 4.89 6.10 5.04 ± 0.07 6.23 ± 0.07 5.6 2−0.6 px
SEM 4.85 5.84 4.95 ± 0.06 5.99 ± 0.06 7.0 20.1 px

The same network, trained on FlyingChairs only with the same seed, changing only the output of the update block. The range and the largest step are measured at the first update of the 1/32 level.

Downstream: visual odometry

Estimated trajectories of NibbleFlow, EdgeFlowNet and NanoFlowNet against the ground truth on two UZH-FPV flights and two TartanAir trajectories
Visual odometry trajectories from optical flow alone with the INT4 models. Estimated paths of NibbleFlow (orange), EdgeFlowNet (blue) and NanoFlowNet (purple) against the ground truth (black) for two UZH-FPV flights (a, b) and two TartanAir trajectories (c, d). NibbleFlow has the lowest ATE on all four and keeps the shape of the loops and of the turns, EdgeFlowNet keeps the shape but drifts further from the ground truth path, and the path of NanoFlowNet jitters and leaves it.

Dense flow on a small robot is rarely the end product, so we test whether the ranking survives a downstream task. The three deployable networks run in INT4 and feed the same pose estimator, the five point algorithm inside RANSAC. No depth is used and the translation scale is taken from the ground truth, so the metrics measure only how well the flow constrains the camera rotation and the direction of travel.

Mean ATE (m) NibbleFlow EdgeFlowNet NanoFlowNet Ground truth flow
TartanAir, 8 synthetic trajectories 4.95 6.70 10.64 0.26
UZH-FPV, 3 real drone flights 5.46 8.89 18.76 n/a

Absolute trajectory error after SE(3) alignment, unweighted mean over the sequences. NibbleFlow has the lowest ATE on seven of the eleven sequences, EdgeFlowNet on four and NanoFlowNet on none.

Beyond optical flow

We believe that the same principle applies to any iterative regressor that must run in fixed point arithmetic, such as depth or disparity refinement. We will release our code and trained checkpoints upon acceptance.

Contact: xiaoao.song@colorado.edu, chahat.singh@colorado.edu

BibTeX

@misc{song2026nibbleflow,
  title  = {NibbleFlow: Sign-Exponent-Mantissa Refinement for 4-Bit Optical Flow},
  author = {Song, Xiao'ao and Singh, Chahat Deep},
  year   = {2026},
  url    = {https://www.praisecu.com/research/NibbleFlow}
}