Spending Compute Where the Dark Is: Gain-Predictive Patch Routing for Low-Light Enhancement

A photo taken at night is not uniformly hard to fix. A streetlit sidewalk needs little more than a tone adjustment. A shadowed doorway three meters away is dominated by sensor noise and needs heavy denoising and detail recovery. Today's best low-light enhancement networks nonetheless run every pixel through the same deep stack. Those networks are Transformers built around Retinex theory, which treats an image as reflectance times illumination. Several recent models add "mixture-of-experts" layers, meaning several sub-networks plus a small gating network that chooses among them. Even these keep the cost per pixel fixed: they vary which computation a region gets, but not how much. We propose a network that gives every patch a nearly free brightening pass. A small scoring model then predicts, for each patch, how much image quality a heavy restoration pass would add. Only the patches with the highest predicted gain get the heavy pass, up to a compute budget the user sets at inference time.

The opportunity is practical. Low-light enhancement currently offers two options and nothing in between. Curve-based networks run in milliseconds but do no denoising, as with Zero-DCE at 500 FPS or SCI at 0.0017 s. Transformers restore well but take hundreds of milliseconds per frame. Conditional computation is the idea from large-scale vision and language models of running only part of a network for each input. It is the natural tool for filling that gap, but it has been used in this field only for specialization, never for skipping compute. The two-sentence version is this: in dim images, how much processing a region needs varies strongly and predictably across the frame, so a cheap predictor of "how much would heavy processing help here" should let one network trade quality for speed along a smooth curve. We will test whether that predictor beats a simple brightness threshold, and whether the resulting curve beats simply using a smaller network.

Core Claim

We claim that per-patch compute allocation, guided by a learned estimate of restoration gain, gives a better quality-versus-cost curve on real low-light benchmarks than equally expensive dense networks. We further claim that a single trained model can cover that whole curve through an inference-time budget. The gain estimate is the expected error reduction from running the heavy pass on a patch instead of the cheap pass alone.

The work differs from prior mixture-of-experts enhancers in what the router decides. ISALux replaces Transformer feedforward layers with a sparse set of convolutional experts, guided by a max-channel illumination prior and MobileNetV3 semantic maps. Every token still traverses the full depth of that model. GM-MoE blends three hand-designed experts (color, detail, general refinement) with soft weights that sum to one, so all three always run; its authors list real-time operation as future work. AdaptIR builds structurally different experts (depthwise convolution, Fourier-domain, channel gating) into a frozen restoration backbone, but routes at the level of the whole task rather than per region. All three use routing to decide what kind of processing to apply. We use it to decide whether and how much to apply, and we make the budget a knob. The mechanism we borrow is Batch Prioritized Routing from V-MoE: tokens are sorted by a priority score and only the top ones are processed under a fixed capacity. V-MoE used this to drop uninformative background patches in classification. Here the priority score gets a physical meaning, predicted restoration gain, and the dropped patches still receive a valid output.

Research Program

The network has three parts. The first is a cheap full-resolution path that every pixel receives. It is a pixel-wise curve estimator in the style of Zero-DCE, applying $LE(I(x);\alpha)=I(x)+\alpha I(x)(1-I(x))$ iteratively. It is extended with a very small global color-correction head, so that its failures are mostly noise and lost detail rather than wrong exposure. The second is a heavy residual path: a stack of illumination-guided attention blocks following Retinexformer, run on 32×32 patches with a halo margin of overlapping context. Each patch is also given a pooled low-resolution feature of the whole image so that the heavy path is not blind to global illumination. Its output is a residual added to the cheap result and blended across patch overlaps. The third is a scoring network that sees the cheap result, the input brightness, and a local-variance statistic, and outputs one score per patch.

The scoring network is trained to predict gain directly. For patch $p$, let $e_{\text{cheap}}(p)$ and $e_{\text{heavy}}(p)$ be the reconstruction error of the cheap output and the cheap-plus-residual output against the ground truth. The router target is

$$g(p) = e_{\text{cheap}}(p) - e_{\text{heavy}}(p),$$

the error a patch would shed if it were given the heavy pass. The router's prediction $\hat g(p)$ is regressed onto $g(p)$, measured during training with the heavy path run densely on a random subset of patches. At inference, a budget $b \in [0,1]$ selects the top $\lceil bN \rceil$ of the $N$ patches by $\hat g$. Alternatively, the network can threshold $\hat g$, which lets compute vary per image. We train with budgets sampled uniformly per batch so one model serves all budgets. The heavy residual is also scaled by the gate score, as in V-MoE, so reconstruction gradients reach the router as well.

We extend this to two or three depth levels, where patches can receive zero, one, or two heavy stages. This turns the choice from "on or off" into a small depth allocation, predicted the same way with one gain target per stage.

Measured speed, not just floating-point operations (FLOPs), is a first-class target. V-MoE and systems-aware MoE scaling both show that routing overhead erodes theoretical savings. We therefore route whole patches on a single device: selected patches are gathered into one batched tensor, processed, and scattered back. We report wall-clock latency on 400×600 inputs, the resolution at which ISALux reports its latencies, alongside FLOPs.

The analysis side asks what the router learns. We decompose the oracle gain $g(p)$ by regressing it on local brightness, which predicts shot-noise-limited signal-to-noise, and on local texture energy in excess of expected noise. This tells us how much of "where compute helps" is simple physics and how much is scene structure. Our hypothesis is that dark flat regions such as walls and sky are cheap to fix, because smoothing suffices, while dark textured regions carry most of the gain. A brightness-only rule cannot see that difference.

Baselines

The naive reference points are the cheap path alone ($b=0$) and the heavy path run densely on every patch ($b=1$). Both come from our own trained model, with identical data and schedule. Together they bracket the curve: beating the cheap path is trivial, and the interesting question is how close we get to the dense result at a fraction of its cost. We also report random routing at each budget. Any router that fails to beat random patch selection has learned nothing.

The key ablation replaces the learned gain predictor with a fixed physics rule: route the darkest patches first, by mean max-channel brightness, the same illumination prior ISALux uses. We also report an oracle that routes by the true $g(p)$, which gives an upper bound on what any router could achieve. All routers share one trained cheap path and heavy path and differ only in patch ordering, so the comparison isolates routing quality exactly. Learned routing counts as a real contribution only if it closes a substantial share of the gap between the brightness rule and the oracle, on average across budgets from 10% to 50%.

The compute-matched dense competitor is a Retinexformer-style network with width and depth shrunk until its FLOPs and measured latency match our model at a given budget. It is trained with the same data, loss, augmentation, and number of iterations, and we give its hyperparameters the same tuning budget as ours. This is the most dangerous baseline, because it answers the question "why not just a smaller model?" Beating it means higher PSNR and SSIM at matched latency on LSRW and SDSD, where lighting is uneven.

The strongest existing methods are reported both as published and, where code exists, as retrained under our protocol. For absolute quality, Retinexformer+ reports 25.29 dB PSNR on LOLv1 and 63.67% mAP on ExDark with YOLOv3, at roughly 3.3 times Retinexformer's FLOPs. GM-MoE reports top PSNR on five benchmarks including LSRW, but only as margins over second-best methods; we found no reported absolute PSNR for GM-MoE on Lacuna. For speed at quality, ISALux reports 105 ms per 400×600 image, against 300 ms for Retinexformer and 650 ms for GLARE. We do not claim to beat Retinexformer+ in raw PSNR. Success means matching our dense $b=1$ model within 0.2 dB PSNR while using at most 40% of its measured latency, and landing below 30 ms at a PSNR on LSRW competitive with ISALux-class models.

Why not just…?

Why not just route by brightness, since noise in dark regions is predictable from physics? This is the real threat, and it is built into the design rather than argued away. The brightness rule is our main ablation, and the physics signals are inputs to the learned router. If the learned router adds nothing over the brightness rule, the honest conclusion is that a two-line heuristic suffices. The paper then becomes a study showing that heuristic-routed patch compute works, which is still a new result for this field. We expect the learned router to win because the brightness rule treats a dark flat wall and a dark textured shelf the same. The gain decomposition described in the Research Program directly measures how much of the oracle's ordering brightness explains.

Why not just train a smaller dense network? Retinexformer+ shows that quality in this field has been bought with dense FLOPs, and nothing in the file shows that routing beats width reduction at equal cost. The compute-matched dense baseline settles this. If the smaller dense model matches us on uneven-lighting benchmarks, patch routing is not worth its complexity. We expect it to lose because it spends its reduced capacity equally on well-lit patches that need none.

Why not just run Zero-DCE or SCI and follow it with an off-the-shelf denoiser? The Zero-DCE authors note that it lacks denoising, and a separate denoiser run over the full frame spends heavy compute everywhere. That is exactly our $b=1$ setting with a weaker, non-jointly-trained heavy path. We include Zero-DCE plus a full-frame denoiser as an additional point on the quality-latency plot. This combination is also what our model reduces to when the router sends everything, so any advantage we show comes specifically from selective allocation.

Why not just use ISALux or GM-MoE, which already bring experts to low-light enhancement? Neither skips computation per region. GM-MoE runs all three experts on every input by construction, and ISALux keeps depth fixed and adds a segmentation network. Their routing could in principle be combined with ours, for example by making the heavy path an ISALux-style expert layer. The question we answer, how much compute each region deserves, is not addressed by either.

Proposed Experiments

Training and paired evaluation use LOLv1, LOLv2-real, LOLv2-synthetic, LSRW-Huawei, LSRW-Nikon, and SDSD indoor and outdoor. We report PSNR and SSIM, and alongside them FLOPs and measured latency at 400×600 on one GPU, across budgets $b \in \{0, 0.1, 0.2, 0.3, 0.5, 1\}$. The result is a quality-latency curve per dataset, rather than a single point.

We expect LOLv1 to be the least favorable case, since its images are largely globally underexposed and most patches are hard. For that reason we stratify every test set by the fraction of dark patches per image. The prediction is that routing gains over the compute-matched dense model grow with within-image variation in brightness. If gains are flat across strata, the core premise is wrong.

For unpaired perceptual quality, we report NIQE on MEF, LIME, DICM, and NPE. For downstream use, we measure ExDark detection mAP with YOLOv3, to compare against Retinexformer+'s 63.67%, and DARK FACE detection AP.

The decisive checks are three, in order. The first is whether learned routing closes most of the gap between the brightness rule and the oracle. The second is whether the routed model beats the compute-matched dense model at equal measured latency on LSRW and SDSD. The third is whether the savings survive on wall-clock timing, not just FLOPs, once gather-scatter and halo overhead are included.

We will also inspect failures. Patch seams at budget boundaries are checked with a gradient-discontinuity measure along patch borders. Temporal flicker is checked on SDSD sequences, where routing decisions may flip between frames; if it appears, we test smoothing the scores over time.