Constrained Few-Shot Learning: Human-Like Low Sample Complexity Learning and Non-Episodic Text Classification

Jaron Mar, Jiamou LiuarXiv 2022 · DOI

Abstract

Few-Shot Learning (FSL) aims to mimic the human ability to learn new concepts from minimal examples. However, traditional FSL models often rely on "episodic training," requiring thousands of labeled instances from background classes—a requirement that diverges from human cognitive processes. This paper introduces Constrained Few-Shot Learning (CFSL), a paradigm where training data is strictly limited to just a few instances per class ($M \le K$). We propose the Category2Vector (Cat2Vec) model, which utilizes a novel Categorical Contrastive (CC) loss to maintain natural similarities between training and test sets. Our results show that Cat2Vec-BERT outperforms standard FSL baselines by up to 17.14% in extreme low-data scenarios.

Introduction: The Gap in Few-Shot Learning

While standard FSL evaluates models on a small number of "shot" examples, the training phase typically involves massive labeled datasets to learn generalizable features. This "episodic" approach is a data hog and does not reflect how humans learn; we do not need to see 1,000 examples of various animals to identify a new species.

To address this, we define Constrained Few-Shot Learning (CFSL). In CFSL, the number of training instances per class ($M$) is constrained such that $M \le K$. This constraint makes traditional episodic training impossible, as there are insufficient samples to construct valid episodes without immediate repetition, forcing a shift back toward global classification objectives.

Methodology: Cat2Vec and Categorical Contrastive Loss

The proposed model, Category2Vector (Cat2Vec), is grounded in cognitive psychology theories such as Fuzzy Trace Theory and Prototype Theory.

Model Architecture

The architecture employs a standard encoder (Bi-LSTM or BERT) to generate document embeddings. These embeddings are compared against a "Categorical Memory"—a set of learned embeddings representing class prototypes. Classification is performed by identifying the nearest category embedding in Euclidean space.

The Cat2Vec architecture featuring a Bi-LSTM encoder, attention mechanisms, and a Categorical Memory for prototype-based classification.

Categorical Contrastive (CC) Loss

A key innovation is the Categorical Contrastive (CC) Loss. Standard contrastive losses treat all negative samples uniformly. In contrast, CC loss splits negative sampling into two distinct cases: anchors from test classes only sample negatives from other test classes, and anchors from training classes only sample negatives from other training classes. This strategy prevents the model from "un-learning" inherent similarities between training and test categories, allowing training classes to serve as more effective reference points for unseen test data.

Experimental Setup

We evaluated the model using a custom training pipeline based on Wikipedia data (Wiki500 to Wiki4000), where each page serves as a unique class with very few samples. Evaluation was conducted on four benchmarks: DBpedia, AG News, 20News, and Yahoo! Answers.

Results and Discussion

The Cat2Vec-BERT model consistently outperformed baselines across all tasks. In the most challenging 5-shot 1-tshot scenario (one training sample per class), the model improved accuracy by 4.58% to 17.14% compared to the next best baseline.

t-SNE visualization of document embeddings across different news categories, demonstrating the model's ability to cluster related topics even with minimal training data.

Key Insights

  • Information Overload: Increasing training data (e.g., from Wiki2000 to Wiki4000) sometimes decreased accuracy. This suggests that excessive irrelevant categorical information can cause "indecision," a phenomenon observed in human cognition.
  • Robustness in Extremes: The model is particularly effective when $M=1$, where traditional meta-learning methods often fail to find a meaningful signal.
  • Cognitive Alignment: By focusing on prototypes (gist representations) rather than verbatim comparisons, the model remains robust against the noise typical of tiny datasets.

Conclusion and Future Work

While Cat2Vec shows significant promise, it still struggles with high-similarity datasets like 20News, where a single example may not suffice to define a distinct prototype. Future work will focus on improving the model's adaptive capabilities to better handle distribution shifts between general training data (Wikipedia) and specific target domains.

Summary updated

Abstract

Few-shot learning (FSL) is an emergent paradigm of learning that attempts to learn to reason with low sample complexity to mimic the way humans learn, generalise and extrapolate from only a few seen examples. While FSL attempts to mimic these human characteristics, fundamentally, the task of FSL as conventionally formulated using meta-learning with episodic-based training does not in actuality align with how humans acquire and reason with knowledge. FSL with episodic training, while only requires $K$ instances of each test class, still requires a large number of labelled training instances from disjoint classes. In this paper, we introduce the novel task of constrained few-shot learning (CFSL), a special case of FSL where $M$, the number of instances of each training class is constrained such that $M \leq K$ thus applying a similar restriction during FSL training and test. We propose a method for CFSL leveraging Cat2Vec using a novel categorical contrastive loss inspired by cognitive theories such as fuzzy trace theory and prototype theory.
BibTeX
@misc{mar2022constrained,
  author = {Jaron Mar and Jiamou Liu},
  title = {{Constrained Few-Shot Learning: Human-Like Low Sample Complexity Learning and Non-Episodic Text Classification}},
  year = {2022},
  eprint = {2208.08089},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.08089},
}
Figure