Transductive Learning for Textual Few-Shot Classification in API-based Embedding Models

Pierre Colombo, Victor Pellegrain, Malik Boudiaf, Myriam Tami, Victor Storchan, Ismail Ben Ayed, Pablo Piantanida

Abstract

This paper addresses the challenges of few-shot text classification in the era of proprietary, black-box API-based models. We present a parameter-free transductive regularizer based on the Fisher-Rao distance that leverages unlabeled test data to improve classification accuracy without requiring model weight access or expensive fine-tuning. Evaluated across diverse multilingual datasets, our method consistently outperforms standard inductive approaches, offering a resource-efficient and privacy-preserving solution for real-world few-shot learning scenarios.

Introduction

As large language models (LLMs) transition into gated APIs, researchers face three major hurdles for few-shot learning (FSL): black-box constraints (no access to gradients or weights), resource efficiency requirements, and data privacy concerns. Traditional methods like In-Context Learning (ICL) scale poorly as the number of classes increases and can be prohibitively expensive. This paper introduces a framework to build high-performing classifiers using only "frozen" API embeddings and a handful of labels.

The proposed framework addresses black-box access (R1), low-resource scenarios (R2), and limited data sharing (R3) by training a local classifier on top of API embeddings.

Methodology

The core innovation is the shift from Inductive to Transductive learning. While inductive models learn a general rule from labeled examples and apply it to test samples in isolation, transductive models analyze the entire unlabeled test batch (the query set) at once. By leveraging the distribution of the test data, the model can better define decision boundaries.

The authors propose a new transductive regularizer, $R^{FR}_Q$, based on the Fisher-Rao distance. Unlike previous transductive methods that require hyperparameters to balance entropy terms, the Fisher-Rao approach is parameter-free. It measures the distance between the "soft" probability predictions of pairs of query samples, effectively forcing the model to make confident, distinct clusters in the embedding space without needing a validation set for tuning.

Experimental Setup

To move beyond simple 2–5 class benchmarks, the authors compiled a rigorous set of 8 datasets across 4 languages (English, French, German, Spanish). These include high-cardinality tasks like Banking77 (77 intent classes) and Clinc151 (151 classes), as well as sentiment and emotion classification tasks like Tweet Eval and Go Emotion.

Key Results and Insights

The transductive Fisher-Rao (FR) method significantly outperformed standard linear probing (Cross-Entropy) by an average of 3.7% across all benchmarks, with gains as high as +6.5% on the complex Banking dataset.

Performance comparison across Clinc, Banking, Tweet, and Emotions datasets, highlighting the consistent gains of the Fisher-Rao (FR) method over inductive baselines.

Key takeaways from the evaluation include:

  • Efficiency: Training one few-shot "episode" takes less than 1 second on a standard M1 CPU. Using embeddings is 60 times cheaper and 58 times faster than ICL for models like text-davinci.
  • The "Free Lunch" of Transduction: Leveraging the distribution of available test data provides a significant accuracy boost for zero additional labeling cost.
  • Inverse Scaling Law: Interestingly, within certain model families, increasing parameter counts sometimes decreased performance for this specific task, suggesting that raw embedding quality does not always scale linearly with model size.

Conclusion and Limitations

While the Fisher-Rao method provides a robust, parameter-free solution for API-based classification, it remains dependent on the quality of the underlying black-box embeddings. If the API provider changes the model or the embeddings are poor for a specific domain, performance will suffer. Future work will explore applying transductive inference to broader NLP tasks, including sequence generation and complex evaluation metrics.

Summary updated

BibTeX
@inproceedings{colombo2023transductive,
  author = {Pierre Colombo and Victor Pellegrain and Malik Boudiaf and Myriam Tami and Victor Storchan and Ismail Ben Ayed and Pablo Piantanida},
  title = {{Transductive Learning for Textual Few-Shot Classification in API-based Embedding Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.257},
}
Figure