TL;DR
This paper introduces Wasserstein-GFN (W-GFN), a novel framework that enables smaller Large Language Models (LLMs) to effectively perform few-shot open-set classification. W-GFN decomposes the reasoning process into latent steps, allowing models to both classify known categories and reject unknown ones, even when class labels are anonymized, outperforming standard prompting methods.
What Problem Does This Paper Address?
Traditional few-shot learning with LLMs often assumes a closed-set scenario where all test classes are seen during training. However, real-world applications frequently encounter open-set scenarios, where models must not only classify known categories but also reject novel, out-of-distribution (OOD) examples. This is particularly challenging for smaller LLMs, which may rely on superficial cues or memorized patterns rather than genuine reasoning, especially when class semantics are obscured (e.g., anonymized labels). Existing methods struggle to balance fine-grained classification with robust OOD detection in this setting.
Methods
The core contribution is Wasserstein-GFN (W-GFN), a reasoning-aware decomposition approach. Instead of directly predicting a label $Y$ from input $X$, W-GFN models a latent reasoning process $Z$ and aims to approximate the posterior $P(Y|X) \propto \sum_Z P(Y|X, Z)P(Z|X)$. This is achieved using Generative Flow Networks (GFNs), which learn to sample from complex distributions by modeling generation as a sequence of actions.
Key aspects of W-GFN include:
- Latent Variable Decomposition: The model learns to generate intermediate latent "reasoning steps" ($Z$) that bridge the input ($X$) and the output label ($Y$). This encourages abstract reasoning rather than memorization.
- Amortized Inference: W-GFN is designed to be amortized, meaning it can generalize to new tasks and classes without requiring task-specific fine-tuning.
- Wasserstein Reward Offset: A novel training technique that gradually applies a negative reward offset to incorrect reasoning trajectories. This stabilizes training and prevents the GFN from collapsing too quickly onto a few reasoning paths.
- Logit Normalization Trick: A post-training calibration step that compares token-wise log-probabilities from the base LLM and the GFN to identify high-confidence mappings from latents to correct labels. This helps in distinguishing in-distribution from OOD signals.
Datasets
The authors evaluate their method on three datasets:
- MultiNERD: A Named Entity Recognition dataset, used as a structured, pattern-driven classification task.
- CLINC150: A fine-grained intent detection dataset, known for its surface-level cues and OOD domains.
- GoEmotion: A challenging fine-grained emotion classification task, noted for its linguistic diversity and annotation subjectivity.
All datasets were anonymized for evaluation to prevent reliance on semantic knowledge.
Key Insights and Ideas
- Anonymized Labels Expose Weaknesses: When class labels are anonymized, smaller LLMs significantly underperform, suggesting a strong reliance on semantic memorization rather than genuine reasoning. This highlights the importance of studying OOD detection under such conditions.
- Decomposition is Key for Robustness: Breaking down the reasoning process into latent steps, as W-GFN does, is crucial for achieving robust open-set classification, especially for smaller models. It forces the model to learn more abstract representations.
- Smaller Models Can Be Powerful: W-GFN demonstrates that even relatively small LLMs (like Llama 3.2 3B) can achieve performance comparable to much larger models (like Llama 3.3 70B) on complex tasks when equipped with appropriate reasoning-aware architectures.
- Prompt Engineering is Fragile: Chain-of-Thought (CoT) prompting, while effective, is highly sensitive to prompt design. Removing explicit hints can lead to a complete failure in OOD detection, underscoring the limitations of relying solely on prompting for robust reasoning.
Key Results
- W-GFN consistently outperforms baselines like CoT prompting and supervised fine-tuning (SFT) across all three datasets (MultiNERD, GoEmotion, CLINC150) in terms of F1-scores for both seen and unseen classes, especially under anonymized labels.
- On the challenging GoEmotion dataset, W-GFN achieves the highest scores, with 51/54 seen settings and 53/54 unseen settings.
- W-GFN (using Llama 3.2 3B) achieves up to ≥ 80% of the performance of Llama 3.3 70B on complex tasks like GoEmotion, despite being ~23 times smaller.
- The Wasserstein offset significantly stabilizes training and improves validation accuracy compared to using a constant reward.
- W-GFN runs efficiently on a single GPU with low memory usage, making it a practical alternative to extremely large models.
Limitations and Future Work
- Computational Cost of Reward Signal: Computing the log reward difference for long latent sequences can be intractable. The authors cap the latent sequence length at 15 tokens, which might limit representational capacity for highly complex domains like commonsense reasoning or coding.
- Approximating Reward Landscape: For very long sequences, the reward landscape is somewhat consistent. Future work could explore modeling this landscape with Gaussian Processes for faster computation.
- Prior Function for Latents: The current approach assumes uniform priors for latent variables. Future work could enhance performance by defining a prior function that "weighs" latents, prioritizing those more descriptive of the query.
- Probabilistic OOD Detection: The current OOD detection relies on a median centralized Z-score. This could be extended to a more probabilistic measure, potentially by training a classifier to learn a more accurate cutoff threshold.
- Hidden Variable Importance: The hidden variable $Z|X$ is crucial. Future research could focus on intelligently sampling $Z$ to maintain diversity and improve performance.
Summary updated