HyperFlow: Gradient-Free Test-Time Adaptation for Cross-Domain Few-Shot Classification

Donggyun Kim, Chanwoo Kim, Seunghoon HongNeurIPS 2026

TL;DR

Adapting a vision model to a brand-new domain using just a handful of examples usually requires running backpropagation at deployment—a memory- and compute-heavy luxury that edge devices simply can't afford. HyperFlow dodges test-time gradients altogether by training a tiny auxiliary network offline to imitate the trajectory of gradient descent as a continuous flow. At deployment, adapting your model reduces to solving a lightweight ordinary differential equation (ODE) with fast forward passes, capturing much of the accuracy of fine-tuning at ~1% of the compute and a fraction of the memory.

What Problem Does This Paper Address?

Imagine deploying a model trained on everyday photos (cats, cars, coffee mugs) and suddenly asking it to classify chest X-rays or satellite imagery using only five labeled examples per class. This is cross-domain few-shot classification.

Historically, you had two options at deployment:

  1. Direct Transfer: Freeze the backbone, extract features, and classify based on nearest-neighbor prototypes. It’s cheap and fast, but accuracy crumbles when the visual domain shifts dramatically.
  2. Test-Time Fine-Tuning: Run a few dozen steps of gradient descent on those five examples. Accuracy shoots up, but backpropagation forces you to store intermediate activations across a massive network. Even parameter-efficient fine-tuning (PEFT) methods like LoRA or bias-tuning—which update tiny fractions of weights—still require backpropagating through the giant frozen backbone.

On a memory-constrained edge device, test-time backpropagation is often a non-starter. The authors ask: Can we get the adaptability of test-time fine-tuning without ever computing a gradient at deployment?

Methods

The core insight behind HyperFlow is an old mathematical bridge: iterative gradient descent is essentially a discrete step-by-step approximation of a continuous gradient flow—an Ordinary Differential Equation (ODE) describing how parameters $\theta$ move over time $t$.

Instead of computing true gradients at test time, HyperFlow learns a lightweight conditional drift network ($h_\phi$) offline to predict the velocity ($d\theta/dt$) of parameters for a given task.

Overview of the four-stage HyperFlow pipeline, from offline trajectory collection to gradient-free ODE solving at test time.

Here is how the pipeline works:

  1. Pick a Compact Subspace: Predicting updates for millions of ViT weights is intractable. Instead, HyperFlow targets a tiny PEFT subspace—by default, just the QKV-projection bias parameters in attention blocks (13,824 scalars for ViT-S), though it also works on rank-4 LoRA or adapters.
  2. Collect Offline Trajectories: On a beefy server, the authors run standard Adam fine-tuning across thousands of simulated few-shot tasks from a base dataset, saving the step-by-step parameter snapshots $\{\theta_0, \theta_1, \dots, \theta_T\}$.
  3. Interpolate & Train the Drift Network: Discrete steps are turned into smooth, continuous paths so $h_\phi$ can be trained at any arbitrary time $t$. The authors test straight-line interpolation (HyperFlow-L) and smooth cubic Hermite splines (HyperFlow-C) that bend through intermediate steps. The drift network itself uses a frozen ResNet-18 to summarize the task's support images into a "task vector," feeding it via Adaptive LayerNorm (AdaLN) into a shallow MLP (or transformer) that outputs parameter velocities.
  4. Gradient-Free Test-Time Adaptation: On an unseen task, the target backbone stays untouched by backprop. HyperFlow encodes the few-shot support set once, then runs Euler integration (up to 50 tiny forward passes through $h_\phi$) to slide the bias parameters along the learned flow before classifying queries.

Datasets

No new datasets are introduced; the authors evaluate on two standard cross-domain benchmarks:

  • Meta-Dataset (8 in-domain / 2 out-of-domain split): Models meta-train and collect trajectories on 8 diverse datasets (ImageNet-1k, Omniglot, Aircraft, CUB Birds, Textures, QuickDraw, Fungi, VGG Flower) and are tested on all 8 plus Traffic Signs and MSCOCO as out-of-domain (OOD) tasks.
  • CD-FSL Benchmark: Evaluates progressively steeper domain shifts away from natural scenes across four OOD datasets: CropDisease, EuroSAT (satellite), ISIC (skin lesions), and ChestX (X-rays), tested in 5-way {5, 20, 50}-shot episodes.

Key Insights and Ideas

  • Parameter efficiency $\neq$ memory efficiency—unless you drop backprop: Updating 0.05% of a ViT via standard Bias-Tuning still eats gigabytes of VRAM because gradients must flow through the backbone's activations. Decoupling the update rule into an external drift network turns parameter compactness into actual deployment memory savings.
  • Curved trajectories beat one-shot parameter generation: Comparing HyperFlow against a direct HyperNetwork (which spits out final weights $\theta_T$ in one jump) and linear flows shows that following intermediate, curved optimization paths (HyperFlow-C) generalizes noticeably better to unfamiliar domains. The journey across the loss landscape matters, not just the endpoints.
  • Not all tiny subspaces are equally "learnable": Updating MLP biases instead of Attention QKV biases degrades performance, even with a similar parameter count. QKV biases appear to share a cleaner, low-dimensional adaptation geometry across diverse visual domains.

Key Results

Built atop the strong P>M>F (Pretrain > Meta-train > Fine-tune) ProtoNet pipeline with ViT-S and ViT-L backbones:

Figure 3: Computation cost analysis of HyperFlow in P>M>F framework. (a) Average 5-shot CD-FSL accuracy over FLOPs (log scale). HyperFlow occupies an intermediate accuracy–efficiency regime between direct transfer and fine-tuning. (b) Peak memory requirement in a 40-way 5-shot setting. HyperFlow substantially reduces memory usage compared with Bias-Tuning and Full-Tuning, while adding a moderate overhead over Direct Transfer.
  • Bridging the OOD Accuracy Gap: On Meta-Dataset OOD tasks (ViT-L), HyperFlow-L jumps from Direct Transfer's 62.82% to 71.68% (compared to 81.02% for Bias-Tuning). On CD-FSL 5-shot tasks (ViT-L), HyperFlow-C reaches 65.57%, nearly matching Full-Tuning (66.23%) and LoRA-Tuning (65.95%) without a single test-time gradient.
  • Massive Compute Savings: HyperFlow uses roughly 1% of the FLOPs of Full-Tuning or Bias-Tuning—adding only a $0.4\times$ compute overhead over zero-adaptation Direct Transfer, making it cheaper than even a single step of classifier Head-Tuning.
  • Drastic Memory Reduction: In a demanding 40-way 5-shot episode on ViT-L, Bias-Tuning requires 27.31 GB of peak memory and Full-Tuning nears 50 GB. HyperFlow needs just 3.13 GB (an $8.7\times$ reduction over Bias-Tuning, using only 6–14% of gradient-based peak memory).

Limitations and Future Work

  • Accuracy Ceiling: HyperFlow is explicitly a trade-off, not a free lunch. When domain shifts are extreme or shot counts grow large (e.g., 50-shot ChestX or Traffic Signs), true gradient-based fine-tuning still pulls ahead by 5–18 percentage points. If your deployment hardware can easily afford backpropagation, standard PEFT remains stronger.
  • Subspace Sensitivity: Performance relies on choosing a compact parameter subspace that exhibits reusable update patterns across tasks (like QKV biases or low-rank LoRA); naively scaling to less structured parameter groups hurts generalization.
  • (Note: Explicit future work directions beyond architectural modularity—such as swapping in stronger task encoders—are not extensively discussed in the main text.)

Summary updated

BibTeX
@inproceedings{kim2026hyperflow,
  author = {Donggyun Kim and Chanwoo Kim and Seunghoon Hong},
  title = {{HyperFlow: Gradient-Free Test-Time Adaptation for Cross-Domain Few-Shot Classification}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=GACGdvulrX},
}
Figure