Predicting a collection of items where order doesn't matter—but where items can appear multiple times—is a surprisingly difficult challenge in machine learning. Researchers from NYU and CIFAR have developed a novel loss function specifically designed for these multiset prediction tasks. By framing the problem as a sequential decision-making process guided by an "optimal oracle," their approach significantly outperforms standard sequence-based and reinforcement learning baselines on both synthetic and real-world datasets.
The Challenge of Multisets
In standard supervised learning, models typically predict a single label (classification) or an ordered string of labels (sequence generation). However, many real-world problems involve predicting a multiset: a collection of items where the order is irrelevant, but the frequency of each item matters.
Consider counting particles in a physics collision or identifying all objects in a cluttered room. If you see two apples and a banana, the order "Apple, Banana, Apple" is functionally identical to "Apple, Apple, Banana."
Existing approaches struggle with this structure:
- Classification fails because the number of possible multiset combinations grows exponentially with the vocabulary and set size.
- Ranking cannot naturally handle multiple instances of the exact same item.
- Sequence Generation (like RNNs) forces an arbitrary order on the items during training. This forced ordering can confuse the model and lead to poor generalization.
The goal is to create a loss function that is permutation-invariant (ignores order) yet capable of modeling the dependencies between items in the multiset.
Proposed Method: The Oracle Policy
The authors propose viewing multiset prediction as a sequential decision-making process. Instead of predicting the entire set at once, the model predicts one item at a time until it decides to stop.
The core innovation is the Oracle Policy ($\pi_*$). Imagine an expert who knows the ground-truth multiset. At any step $t$, the oracle looks at what has already been predicted and assigns equal probability to all remaining items in the target multiset. For example, if the target is $\{A, A, B\}$ and the model has already predicted $\{A\}$, the oracle dictates a 50% chance of picking the remaining $A$ and a 50% chance of picking $B$.
The Multiset Loss ($\mathcal{L}_{multi}$) is defined as the Kullback-Leibler (KL) divergence between this oracle policy and the model’s predicted distribution at each step. Because the oracle treats all remaining valid items equally, the loss doesn't penalize the model for picking items in a "wrong" order, effectively making the training process order-invariant. To handle multisets of varying sizes, the authors also train a simple termination policy—a binary classifier that tells the model when to stop predicting.
Key Insights
- The "Arbitrary Order" Trap: The paper demonstrates that forcing a model to learn a specific order (like "left-to-right" or "largest-to-smallest") can actually hurt performance. In their experiments, a sequence loss using a random fixed order often performed better than one using a spatial order, suggesting that forced orderings introduce harmful biases.
- Decreasing Entropy: A unique property of the oracle policy is that its entropy decreases over time. As the model picks items correctly, the "pool" of remaining valid choices shrinks, making the next choice more certain.
- Imitation over Reinforcement: While Reinforcement Learning (RL) seems like a natural fit for sequential sets, the authors found that their "learning to imitate an oracle" approach was more stable and effective than RL (e.g., REINFORCE), which suffers from high variance as the number of items increases.
Experimental Results
The researchers evaluated their method on two main benchmarks:
- MNIST Multi: A synthetic dataset where multiple handwritten digits are placed in a 100x100 image. Variants included fixed sizes (4 or 10 digits) and variable sizes (1-4 digits).
- MS COCO: A challenging real-world dataset of natural images. They created "Easy" (2 objects) and "Medium" (1-4 objects) subsets, focusing on large objects from common classes.
The proposed multiset loss ($\mathcal{L}_{multi}$) consistently achieved the highest scores across almost all metrics, specifically Exact Match (EM) and F1 score.
As seen in the results, $\mathcal{L}_{multi}$ vastly outperformed baselines. On the complex MNIST Multi (10 digits) task, it achieved an Exact Match of 0.920, compared to the RL baseline (0.665) and the sequence-based baseline (0.592). On the most difficult real-world task, MS COCO (Medium), $\mathcal{L}_{multi}$ reached an EM of 0.481, while the next best baseline (sequence prediction) trailed at 0.457. Furthermore, the method proved highly scalable; as the number of items to predict increased, the performance gap between the proposed loss and the baselines widened significantly.
Limitations and Future Work
While powerful, the method currently relies on trajectories generated by the model during training. This means the model only learns from the paths it actually takes, which might become computationally expensive for very large multisets.
Additionally, the model uses a separate termination policy to decide when to stop. Integrating the "stop" command directly into the multiset distribution or exploring more sophisticated "Learning to Search" (L2S) frameworks could be a promising next step. Finally, the authors suggest applying this framework to non-visual domains, such as high-energy physics, where multiset prediction remains a fundamental challenge.
Summary updated