SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.17982 · NeurIPS · 2025

Few-Shot Learning from Gigapixel Images via Hierarchical Vision-Language Alignment and Modeling

Kaist, Huazhu Fu, Bryan Wong, Jong Woo Kim, Mun Yi, A Star, Final Logits

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 2 failures of our instrument; 3 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2505.17982.json · badge: /api/ran/2505.17982.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
bryanwong17/HiVE-MIL canonical (classifier label)
classifier basis not recorded on the link
9 ran · 3 no recorded run
FunctionStatusWhere it lives
default_transforms Ran
ran on a synthesized input
bryanwong17/HiVE-MIL/dataset_model/wsi_dataset.py
code served (permissive licence) · get_code("6ff5f05369cfc01e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Compose. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torchvision import transforms

torch.manual_seed(0)

# The function takes mean and std as parameters
# These are tuples used by transforms.Normalize
# We'll provide both default and custom values

ARGS = {
    "mean": (0.485, 0.456, 0.406),
    "std": (0.229, 0.224, 0.225),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
eval_transforms Ran
ran; our contract draft was wrong, not the code
bryanwong17/HiVE-MIL/dataset_model/dataset_h5.py
code served (permissive licence) · get_code("ec1ccb5565df7999")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Compose. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torchvision.transforms as transforms

torch.manual_seed(0)

ARGS = {
    "pretrained": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
eval_transforms_clip Ran
ran on a synthesized input
bryanwong17/HiVE-MIL/dataset_model/dataset_generic.py
code served (permissive licence) · get_code("d8f69470991004a1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Compose. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torchvision.transforms as transforms
from PIL import Image
import numpy as np

torch.manual_seed(0)

# The function eval_transforms_clip takes one parameter: pretrained (bool)
# It returns a transforms.Compose object
# We need to test it with different values of pretrained

ARGS = {
    "pretrained": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
filter_high_mag_coords Ran
ran on a synthesized input
bryanwong17/HiVE-MIL/create_hierarchical_features.py
code served (permissive licence) · get_code("da376fbeb99f6bea")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct arguments for filter_high_mag_coords
# The function takes:
# 1. high_mag_coords: list of (x_high, y_high) tuples
# 2. low_mag_coords: list of (x_low, y_low) tuples
# 3. low_mag_original_size: int (default 2048)

high_mag_coords = [
    (100, 150),
    (200, 250),
    (2100, 2150),
    (1500, 1800),
    (50, 50),
]

low_mag_coords = [
    (0, 0),
    (1024, 1024),
]

low_mag_original_size = 2048

ARGS = {
    "high_mag_coords": high_mag_coords,
    "low_mag_coords": low_mag_coords,
    "low_mag_original_size": low_mag_original_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
filter_high_mag_coords Ran
ran on a synthesized input
bryanwong17/HiVE-MIL/create_hierarchical_features.py
code served (permissive licence) · get_code("f3f04c63a2f4aa10")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create sample high_mag_coords and low_mag_coords
# high_mag_coords should be a list/array of [x, y] coordinate pairs
# low_mag_coords should be a list/array of [x, y] coordinate pairs representing origins

high_mag_coords = [
    [100, 150],
    [200, 250],
    [500, 600],
    [1500, 1700],
    [2500, 2800],
    [150, 200],
    [2100, 2200],
]

low_mag_coords = [
    [0, 0],
    [500, 500],
    [2000, 2000],
]

low_mag_original_size = 2048

ARGS = {
    "high_mag_coords": high_mag_coords,
    "low_mag_coords": low_mag_coords,
    "low_mag_original_size": low_mag_original_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_missing_coords Ran
ran on a synthesized input
bryanwong17/HiVE-MIL/check_hierarchical_consistency.py
code served (permissive licence) · get_code("704f42dc0aeca54d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned set. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create sample coordinate data
# high_mag_coords: array of shape (N, 2) representing high magnification coordinates
# low_mag_coords: array of shape (M, 2) representing low magnification coordinates

high_mag_coords = np.array([
    [100, 150],
    [200, 250],
    [500, 600],
    [1500, 1700],
    [2100, 2200],
    [50, 50],
], dtype=np.int32)

low_mag_coords = np.array([
    [0, 0],      # Should contain [100, 150], [50, 50]
    [0, 2048],   # Empty - no high_mag coords in this region
    [2048, 0],   # Should contain [2100, 2200]
], dtype=np.int32)

low_mag_original_size = 2048

ARGS = {
    "high_mag_coords": high_mag_coords,
    "low_mag_coords": low_mag_coords,
    "low_mag_original_size": low_mag_original_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_features_and_coords_from_h5 Ran
ran on a synthesized input
bryanwong17/HiVE-MIL/check_hierarchical_consistency.py
code served (permissive licence) · get_code("4d7c551965148a3d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import h5py
import tempfile
import numpy as np

# Create a temporary HDF5 file with the required datasets
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.h5')
temp_file.close()

# Write test data to the HDF5 file
with h5py.File(temp_file.name, 'w') as f:
    features_data = np.random.randn(2, 4).astype(np.float32)
    coords_data = np.random.randn(2, 3).astype(np.float32)
    f.create_dataset('features', data=features_data)
    f.create_dataset('coords', data=coords_data)

ARGS = {
    'h5_file': temp_file.name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
h5py, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
patching Ran
ran on a synthesized input
bryanwong17/HiVE-MIL/create_patches_fp.py
code served (permissive licence) · get_code("88d96f0bf9d56484")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a mock WSI object with the required structure
class MockWSI:
    def __init__(self):
        self.properties = {
            'aperio.AppMag': '20'
        }

class MockWSIObject:
    def __init__(self):
        self.wsi = MockWSI()
    
    def process_contours(self, **kwargs):
        # This method is called with mag in kwargs
        # Return a simple file path string
        return "/mock/output/patches.h5"

# Create the WSI_object instance
wsi_object = MockWSIObject()

# Define kwargs that will be passed to process_contours
kwargs = {
    'level': 0,
    'patch_size': 256
}

ARGS = {
    'WSI_object': wsi_object,
    'kwargs': kwargs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
segment Ran
ran; our contract draft was wrong, not the code
bryanwong17/HiVE-MIL/create_patches_fp.py
code served (permissive licence) · get_code("a63b7288bd08c89e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from unittest.mock import Mock

torch.manual_seed(0)

class MockWSIObject:
    """Mock WSI (Whole Slide Image) object with segmentTissue method"""
    def __init__(self):
        self.tissue_mask = None
        self.segmented = False
    
    def segmentTissue(self, **kwargs):
        """Mock segmentTissue method that accepts seg_params and filter_params"""
        seg_params = {k: v for k, v in kwargs.items() if k != 'filter_params'}
        filter_params = kwargs.get('filter_params', {})
        
        # Simulate some processing
        self.tissue_mask = np.random.rand(256, 256)
        self.segmented = True
        self.seg_params = seg_params
        self.filter_params = filter_params

# Create WSI object
wsi_object = MockWSIObject()

# Define segmentation parameters
seg_params = {
    'threshold': 0.5,
    'min_size': 100,
    'max_size': 10000,
    'use_otsu': True
}

# Define filter parameters
filter_params = {
    'kernel_size': 5,
    'iterations': 2,
    'filter_type': 'median'
}

ARGS = {
    'WSI_object': wsi_object,
    'seg_params': seg_params,
    'filter_params': filter_params
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_model Not yet run
unverified (harvested, no recorded run)
bryanwong17/HiVE-MIL/clip/model.py
code served (permissive licence) · get_code("39e6b23b55f376ea")
How it ran

no invocation recorded.

load_pretrained_model Not yet run
unverified (harvested, no recorded run)
bryanwong17/HiVE-MIL/models/hivemil.py
code served (permissive licence) · get_code("3154e7c0f7f1fd64")
How it ran

no invocation recorded.

process_slide Not yet run
unverified (harvested, no recorded run)
bryanwong17/HiVE-MIL/check_hierarchical_consistency.py
code served (permissive licence) · get_code("085127777951a712")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 3 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
build_model 53 other papers
42 dated earlier, 6 later, 5 same year, order not determinable
2107.06383 (2021-07)
How Much Can CLIP Benefit Vision-and-Language Tasks?
2210.01115 (2022-10)
LASP: Text-to-Text Optimization for Language-Aware Soft Prompting of Vision & Language Models
2211.09552 (2022-11)
UniFormerV2: Spatiotemporal Learning by Arming Image ViTs with Video UniFormer
and 50 more not named here
segment 3 other papers
2 dated earlier, 1 later
2311.07125 (2023-11)
Attention-Challenging Multiple Instance Learning for Whole Slide Image Classification
2406.15303 (2024-06)
AEM: Attention Entropy Maximization for Multiple Instance Learning based Whole Slide Image Classification
2602.01951 (2026-02)
Enabling Progressive Whole-slide Image Analysis with Multi-scale Pyramidal Network
eval_transforms 1 other paper
1 later
2602.01951 (2026-02)
Enabling Progressive Whole-slide Image Analysis with Multi-scale Pyramidal Network

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Vision-language models (VLMs) have recently been integrated into multiple instance learning (MIL) frameworks to address the challenge of few-shot, weakly supervised classification of whole slide images (WSIs). A key trend involves leveraging multi-scale information to better represent hierarchical tissue structures. However, existing methods often face two key limitations: (1) insufficient modeling of interactions within the same modalities across scales (e.g., 5× and 20×) and (2) inadequate alignment between visual and textual modalities on the same scale. To address these gaps, we propose HiVE-MIL, a hierarchical vision-language framework that constructs a unified graph consisting of (1) parent-child links between coarse (5×) and fine (20×) visual/textual nodes to capture hierarchical relationships, and (2) heterogeneous intra-scale edges linking visual and textual nodes on the same scale. To further enhance semantic consistency, HiVE-MIL incorporates a two-stage, text-guided dynamic filtering mechanism that removes weakly correlated patch-text pairs, and introduces a hierarchical contrastive loss to align textual semantics across scales. Extensive experiments on TCGA breast, lung, and kidney cancer datasets demonstrate that HiVE-MIL consistently outperforms both traditional MIL and recent VLM-based MIL approaches, achieving gains of up to 4.1% in macro F1 under 16-shot settings. Our results demonstrate the value of jointly modeling hierarchical structure and multimodal alignment for efficient and scalable learning from limited pathology data. The code is available at https://github.com/bryanwong17/HiVE-MIL.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2505.17982")
get_code_for_paper("2505.17982")
have("2505.17982")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2505.17982.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2505.17982.svg)](https://syntology.ai/paper/2505.17982)

Connect an agent — have() is free.