File size: 2,406 Bytes
8d4bb4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b619334
 
 
 
 
 
 
 
 
 
8d4bb4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
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}
}
```