Introduction
In human cognition, learning rarely occurs in isolation. When faced with a novel problem, a student typically references "exemplars"—similar problems encountered previously—to understand the underlying logic and derive a solution. This "learning by examples" is a fundamental aspect of human intelligence. However, most conventional machine learning models rely on abstract class representations, mapping inputs directly to labels while ignoring the rich relational information between specific data instances.
In the paper "Learning by Examples Based on Multi-level Optimization," authors Shentong Mo and Pengtao Xie propose a framework designed to bridge this gap. By formalizing the process as a three-level optimization task, the authors demonstrate that machines can effectively learn to retrieve, compare, and predict based on specific training instances.
Problem Statement
Standard supervised learning paradigms focus on training a model to map an input $x$ to a class label $y$. While this approach is highly effective for large-scale datasets, it often struggles in "few-shot" scenarios where data is scarce. Existing metric learning approaches, such as Siamese networks, attempt to learn similarity but often treat retrieval and classification as disjoint steps or rely on fixed, human-defined similarity rules (e.g., binary "same-class" or "different-class" labels).
The core challenge addressed by this research is: How can a system jointly optimize the retrieval mechanism and the prediction mechanism to maximize final accuracy? Furthermore, how can such a system remain computationally efficient enough for practical, large-scale deployment?
Methods: Three-Level Optimization
The proposed Learning By Examples (LBE) framework classifies new data by retrieving similar training examples and leveraging their labels. This is achieved through a novel three-level optimization strategy where three nested stages influence each other:
- Stage 1 (The Retriever): A Siamese network ($T$) is trained to calculate similarities between a query and training examples, aiming to match a "ground-truth" similarity matrix $A$.
- Stage 2 (The Predictor): A matching network ($S$) utilizes the examples retrieved in Stage 1 and their corresponding labels to predict the label of the query.
- Stage 3 (The Meta-Optimizer): The model updates the "ground-truth" similarity matrix $A$ by minimizing the loss on a validation set.
This structure allows the model to determine the optimal similarity between training images that enables the retriever to find the most helpful examples for the predictor's success on unseen validation data. To handle the computational complexity, the authors utilized one-step gradient approximations and introduced LBE-fast, which employs Gumbel-softmax to learn binary hash codes, enabling rapid Hamming distance comparisons.
Key Insights: Learnable Similarity
A pivotal insight of LBE is that the "ground-truth" similarity matrix $A$ is not a fixed entity but a learnable parameter. By making $A$ learnable, the model discovers that certain examples are more "exemplary" than others, even within the same class.
As shown in the evolution of the similarity matrix, the model starts with a noisy initialization and gradually learns a structured representation where relevant examples are clearly identified. This end-to-end synergy ensures that the Siamese network (retriever) learns specifically to find the types of examples that the matching network (predictor) finds most useful for classification.
Experimental Results
The authors evaluated LBE across several benchmarks, including CIFAR-10/100, ImageNet, and few-shot datasets like Omniglot and miniImageNet.
- Few-Shot Performance: LBE demonstrated significant dominance in few-shot tasks. On the miniImageNet 5-way 5-shot task, LBE achieved 81.41% accuracy, substantially outperforming the original MatchingNet (68.88%) and other strong baselines like ProtoNet.
- Robustness and Stability: In standard supervised settings, LBE achieved competitive accuracy with ResNet baselines but exhibited lower standard deviation across multiple runs, suggesting that exemplar-based learning provides a more stable training signal.
- Efficiency: The LBE-fast variant, utilizing binary hashing, increased retrieval speed by approximately 75-80% with minimal impact on accuracy, effectively addressing the "retrieval bottleneck" common in instance-based methods.
- Qualitative Precision: Retrieval analysis showed that LBE's top-10 retrieved images were almost exclusively from the correct class, whereas baseline methods frequently retrieved visually similar "look-alikes" from incorrect categories.
Conclusion
The LBE framework provides a powerful blueprint for integrating meta-learning and metric learning. By treating similarity as a learnable component within a multi-level optimization loop, the model learns to "study" its training data in a manner analogous to human students. While the current implementation focuses on computer vision, the underlying logic of exemplar-based reasoning holds significant promise for fields such as Natural Language Processing and Reinforcement Learning.
Summary updated