--- license: mit library_name: icmil tags: - multiple-instance-learning - in-context-learning - prior-data-fitted-network - tabular datasets: - bifold-pathomics/ICMIL pipeline_tag: tabular-classification --- # ICMIL — In-Context Multiple Instance Learning 📄 [Paper (arXiv:2606.06458)](https://arxiv.org/abs/2606.06458) · 💻 [Code](https://github.com/injurise/ICMIL) · 🤗 [Datasets](https://huggingface.co/datasets/bifold-pathomics/ICMIL) ICMIL is an in-context learner for bag-structured data: pretrained on synthetic MIL tasks, it labels the bags of a new task from a handful of labelled bags in a single forward pass, with no gradient updates, fine-tuning or hyper-parameter search. This repository holds the three trained model seeds behind the paper's **ICMIL (Ours)** results. The same checkpoints are committed in the code repository under [`checkpoints/`](https://github.com/injurise/ICMIL/tree/main/checkpoints). ## Files | File | Seed name | |---|---| | `icmil-c5trd795.pt` | `c5trd795` | | `icmil-ggwsqibd.pt` | `ggwsqibd` | | `icmil-k337zhz1.pt` | `k337zhz1` | Seed names are opaque run labels. Each `.pt` holds `{model_state_dict, epoch, ...provenance}`. The reported ICMIL row is the **mean ± cross-seed SEM** over the three seeds. We also provide three models that can perform predictions on datasets with up to 50 features. | File | |---| | `icmil-50dim-ldsebntm.pt` | | `icmil-50dim-sjik4hzb.pt` | | `icmil-50dim-zeqy97nm.pt` | No paper results are based on them. ## Usage ```python from icmil import load_icmil # pip install -e . from https://github.com/injurise/ICMIL model = load_icmil(seed="c5trd795", device="cuda") # X_train: (1, n_ctx_bags, bag_size, n_features), y_train: (1, n_ctx_bags) # X_test: (1, n_query_bags, bag_size, n_features) logits = model(X_train, y_train, X_test) # (1, n_query_bags, n_classes) ``` `load_icmil` reads `checkpoints/` in the repo by default; point it elsewhere with `load_icmil(source="/path/to/ckpts", seed=...)` or `ICMIL_CKPT_DIR`. Reproduce the full benchmark table with `python -m icmil.reproduce`. ## Citation ```bibtex @article{mollers2026incontext, title = {In-Context Multiple Instance Learning}, author = {M\"ollers, Alexander and Sextro, Marvin and Hense, Julius and Dernbach, Gabriel and M\"uller, Klaus-Robert}, journal = {arXiv preprint arXiv:2606.06458}, year = {2026} } ```