Introduction
Multi-instance Learning (MIL) shifts the focus from individual data points to "bags" of instances. While supervised MIL for classification is well-studied, unsupervised MIL—clustering bags based on internal structure—remains a significant challenge. This paper evaluates three loss functions—Contrastive Predictive Coding (CPC), Triplet Loss, and Magnet Loss—to learn bag-level embeddings that facilitate effective clustering.
Methodology and Loss Functions
The authors employ an embedded-space paradigm where instances are transformed and aggregated into a single bag vector. Three distinct loss functions are compared:
- Contrastive Predictive Coding (CPC): An unsupervised approach using a "split-bag" heuristic. It posits that two halves of the same bag should have similar representations.
- Triplet Loss: A supervised metric learning approach that minimizes the distance between an anchor and a positive sample while maximizing the distance to a negative sample.
- Magnet Loss: A supervised method that maintains a global view of class distributions to ensure local separation of clusters.
Hierarchical MIL in Network Security
A key application of this framework is in network security, specifically analyzing HTTP traffic. The data is inherently hierarchical: a user session is a bag of domains, a domain is a bag of URLs, and a URL is a bag of tokens. This structure allows the model to "explain" its decisions by identifying specific malicious tokens within a complex request.
Experimental Evaluation
The methods were tested on 18 public benchmarks (e.g., Musk, Elephant, Web) and a large-scale proprietary security dataset from Cisco.
Performance Dynamics
The evaluation revealed a trade-off between classification utility and cluster quality. While supervised methods like Magnet Loss often achieve higher accuracy, Triplet Loss frequently produces better-separated clusters as measured by the Silhouette coefficient (Ratio). As expected, the unsupervised CPC approach generally serves as the baseline, though it remains the most innovative for label-free discovery.
Key Results and Insights
- Unsupervised Potential: Although CPC generally underperformed compared to supervised methods, its label-free nature makes it highly promising for massive-scale unlabeled datasets where human labeling is impractical.
- Security Efficacy: On the Cisco security dataset, Magnet Loss achieved up to 93% accuracy in distinguishing malicious from legitimate traffic, demonstrating the practical utility of MIL clustering in identifying compromised users based on behavioral patterns.
- No Single Winner: The choice of loss function depends on the objective. Magnet Loss is superior for classification accuracy, whereas Triplet Loss is often better for creating dense, well-separated clusters.
Conclusion
The study demonstrates that while supervised losses currently lead in performance, unsupervised approaches like CPC offer a promising path for discovering structure in complex, hierarchical data. Future work will focus on reducing hyper-parameter sensitivity in Magnet Loss and improving the pre-training capabilities of unsupervised MIL models to better handle the "holy grail" of massive-scale network security applications.
Summary updated