Unlocking Compositional Generalization in Continual Few-Shot Learning

Phu Quy Nguyen Lam, Phu-Hoa Pham, Dao Sy Duy Minh, Tran Chi Nguyen, Trung-Kiet Huynh, Long Tran-ThanhNeurIPS 2026

TL;DR

Humans recognize unfamiliar scenes by breaking them into familiar parts, yet AI models that explicitly train to match image parts paradoxically become worse at recognizing truly novel concepts. This paper diagnoses why—training with part-by-part matching forces representations to over-specialize to seen patterns—and solves it with COMPOSE, a framework that trains on whole scenes to keep object representations general, then flips to part-by-part matching only at test time when gradients are safely turned off.

What Problem Does This Paper Address?

Imagine learning new visual concepts sequentially from just a handful of examples without forgetting old ones—a regime called Continual Few-Shot Learning (CFSL). Intuitively, breaking an image into object-level "slots" (parts) rather than squashing it into a single global vector should make generalizing to completely unseen concepts effortless.

In practice, slot-based continual learners hit a wall on novel concepts. The authors trace this failure to two coupled flaws:

  1. Representation Pollution: Standard Slot Attention (a mechanism that groups image patches into $K$ object vectors) updates slots using a recurrent GRU. This mixes spatial routing mechanics into visual content, corrupting the clean semantic geometry of the underlying Vision Transformer (ViT).
  2. The Compositional Optimization Trap: Training slots by matching them part-by-part (e.g., via Chamfer distance, where each query slot pulls toward its nearest support slot) sends divergent gradients to every slot. Over time, slots overfit to narrow, training-specific local textures rather than reusable whole-object concepts.
Figure 1: The compositional optimization trap. Gradient field each training objective induces on slot embeddings. Left: a part-level (Chamfer) loss pulls every point toward its nearest support slot, so the sphere splits into K basins and each query slot falls toward its own match. Right: a holistic loss sends all slots one shared direction, toward the class prototype Pc, scaled only by the router weight ωk (exact at the projections ˇyk before normalization; Proposition 1). Point positions and weights are schematic.

Methods

COMPOSE resolves this tension by strictly decoupling how slots are trained from how they are read at inference, built atop a frozen self-supervised ViT (DINOv2) and frozen COCO-pretrained Slot Attention:

  • Bypassing the GRU (New): Instead of using the polluted GRU hidden states, COMPOSE takes the attention masks from Slot Attention and computes a direct, L2-normalized weighted average of the frozen ViT patch tokens ($\tilde{\phi}_k$).
  • Phase I — Holistic Training (New): Only a lightweight MLP router (which assigns an importance weight $\omega_k$ to each slot) and a shared linear projection head ($W_2$) are trained, alongside a tiny 20-exemplar/class replay buffer. Crucially, the projected slots are summed into a single holistic image vector and scored against class prototypes via cross-entropy. Every slot receives the same shared gradient direction. To prevent all slots from collapsing into identical vectors, a Barlow Twins-style cross-correlation penalty decorrelates features across dimensions.
  • Phase II — Compositional Inference (New): With gradients turned off, part-level matching can no longer corrupt the features. Slots are mean-centered per image (stripping away shared background and lighting biases), and the top-$\kappa$ slots are matched part-by-part using bidirectional Chamfer similarity. The final prediction blends the holistic score and the part-level Chamfer score (weighted by $\gamma$, which can even be derived automatically in closed form from slot variance).
Figure 2: One slot set, read two ways. A frozen ViT with slot attention turns each image into K slots ˜ϕk (four shown). The trainable MLP router weights the slots by ωk, and a shared projection W2 maps either their weighted sum to a single image embedding e (Whole) or each slot to its own embedding zk (Parts). Phase I trains the router and projection through the Whole branch only, with cross-entropy on cos(eq, Pc) and a cross-correlation penalty; no part-level matching is used. Phase II is gradient-free: the holistic score is blended with a bidirectional Chamfer score over the per-image centered slots ˆzk. Point positions and weights are schematic; the inputs are a query and a support image of one COBJ class.

Datasets

No new datasets are introduced; the authors evaluate across three distinct continual learning setups:

  • Compositional Few-Shot Transfer (CFST): CGQA (synthetic $2\times2$ object grids; 100 classes across 10 sessions) and COBJ (complex natural scenes from Objects365; 30 classes across 3 sessions), testing five generalization axes—most notably non-compositional (noc), which evaluates combinations of completely unseen concepts.
  • Standard Continual & Few-Shot Class-Incremental Learning (CIL / FSCIL): CIFAR-100, ImageNet-R, ImageNet-A, miniImageNet, and CUB-200.
  • Domain-Incremental Learning: DN4IL, a six-session split of DomainNet testing domain shift.

Key Insights and Ideas

  • Training and inference need opposite objectives: Compositional part-matching is great for inference, but toxic during gradient descent. Adding Chamfer matching during training (COMPOSE-CT) drops novel-concept accuracy by 2.69 percentage points (pp).
  • Decomposition alone carries massive weight: Simply extracting clean slots and summing them ($\gamma = 1.0$) jumps novel-concept accuracy by +11.53 pp over meta-learning on a standard monolithic [CLS] token (90.85% vs. 79.32% on CGQA), before part-by-part matching even begins.
  • Semantic patch geometry beats sheer scale: Slot decomposition relies on nearby patches clustering by object semantics—a property induced by local self-distillation (DINOv1/v2, iBOT). OpenCLIP ViT-L/14, despite having ~3.5$\times$ the parameters and ~1500$\times$ the training images (2 billion), still trails iBOT ViT-B/16 on unseen concepts because language alignment plateaus in local patch purity. Supervised ViTs and pixel-reconstructing MAEs fail similarly.
  • Not all anti-collapse penalties play nice with prototypes: Standard VICReg variance-hinges fight against cross-entropy (which naturally contracts within-class variance toward zero), whereas a cross-correlation matrix penalty is invariant to orthogonal rotations and harmonizes cleanly.

Key Results

  • State-of-the-art unseen-concept transfer: On CGQA (10-way 10-shot), COMPOSE hits 93.46% noc (and 92.42% harmonic mean $H_a$). It beats CoFiMA—which fine-tunes the entire DINOv2 backbone—by 1.49 pp on novel concepts while training in ~5 minutes instead of ~4 hours.
  • Minimal forgetting: Because the backbone is frozen, catastrophic forgetting on CIFAR-100 FSCIL drops to 3.54% (compared to 27.91% for Comp-FSCIL), while leading ImageNet-A CIL at 70.31% average accuracy.
  • Clean slot pooling matters: Swapping the direct patch aggregate $\tilde{\phi}_k$ back to standard Slot Attention GRU states drops noc by 2.96 pp on CGQA and 4.98 pp on natural images (COBJ).

Limitations and Future Work

  • Cluttered natural scenes challenge slot routing: On COBJ (complex real-world photos), noisy object boundaries make part-matching harder; at the fixed $\gamma=0.3$ blend, COMPOSE (noc 88.32%) trails zero-shot SimpleShot (89.19%) and EASE (89.03%), preferring a heavier reliance on the holistic branch.
  • Strict dependence on backbone pretraining: COMPOSE only works if the frozen backbone already possesses dense, semantic patch-level geometry. Supervised ViTs, pixel/mask-reconstruction models, and even massive vision-language models cap or degrade slot purity regardless of model size. Future progress hinges on backbones with stronger local self-distilled geometry.

Summary updated

Abstract

Object-centric representations promise a key property for few-shot learning: Rather than treating a scene as a single unit, a model can decompose it into individual object-level parts that can be matched and compared across different concepts. In practice, this potential is rarely realized. Continual learners either pool scenes into one vector before any decomposition exists, or train with part-level matching objectives that tie representations too closely to seen patterns, leaving them unable to generalize to truly novel concepts. In this paper, we identify this fundamental structural conflict and pioneer a new paradigm that strictly decouples representation learning from compositional inference. Leveraging the inherent patch-level semantic geometry of self-supervised Vision Transformers (ViTs), our framework employs a dual-phase strategy. During training, the slot set is scored as a whole against class identity, which preserves highly generalizable, object-level geometries; at inference, those same preserved slots are composed part by part to match novel scenes. We demonstrate that this paradigm offers dual structural benefits: The frozen backbone naturally prevents representation drift, while our lightweight, holistic optimization preserves the features' capacity for novel-concept transfer. Extensive experiments validate this approach, achieving state-of-the-art unseen-concept generalization and competitive accuracy with low forgetting on standard continual learning benchmarks. Code is available at https://github.com/NLPQuy/COMPOSE.
BibTeX
@inproceedings{lam2026unlocking,
  author = {Phu Quy Nguyen Lam and Phu-Hoa Pham and Dao Sy Duy Minh and Tran Chi Nguyen and Trung-Kiet Huynh and Long Tran-Thanh},
  title = {{Unlocking Compositional Generalization in Continual Few-Shot Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=JiDX823MQW},
}
Figure