SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.12347 · 2021

A Principled Approach to Failure Analysis and Model Repairment: Demonstration in Medical Imaging

arXiv · PDF · Open in the Atlas

Code that ran

9 of 9 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 9 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2109.12347.json · badge: /api/ran/2109.12347.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
Rokken-lab6/Failure-Analysis-and-Model-Repairment canonical (classifier label)
classifier basis: census
9 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_generalizability_score Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/compute_cluster_metrics_bounded.py
code served (permissive licence) · get_code("eef521946c2bdf94")
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 float64, ndim 0, 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 numpy as np

# Construct valid arguments for compute_generalizability_score
# The function takes two scalar values (train_val and test_val)
# and computes a generalizability score based on them

# Create test values that satisfy the function's expectations
train_val = 0.8  # A value between 0 and 1
test_val = 0.5   # A value between 0 and 1, less than train_val

ARGS = {
    "train_val": train_val,
    "test_val": test_val,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
compute_inter_metric Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/compute_cluster_metrics_bounded.py
code served (permissive licence) · get_code("077a5f705ad200dc")
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

# Construct the metrics dictionary with the required structure
metrics = {
    'test': {
        '0': {
            'cluster_0': {'accuracy': 0.85},
            'eval_group_1': {'accuracy': 0.65},
            'eval_group_2': {'accuracy': 0.70},
        },
        '1': {
            'cluster_1': {'accuracy': 0.80},
            'eval_group_0': {'accuracy': 0.60},
            'eval_group_2': {'accuracy': 0.75},
        },
        '2': {
            'cluster_2': {'accuracy': 0.90},
            'eval_group_0': {'accuracy': 0.62},
            'eval_group_1': {'accuracy': 0.68},
        },
    }
}

# Define finetuning groups - these should be digit strings
finetuning_groups = ['0', '1', '2', 'invalid_group']

# Define eval groups - format is 'eval_group_<id>'
eval_groups = ['eval_group_0', 'eval_group_1', 'eval_group_2']

# Define the metric key to compute
metric_key = 'accuracy'

ARGS = {
    'metrics': metrics,
    'finetuning_groups': finetuning_groups,
    'eval_groups': eval_groups,
    'metric_key': metric_key,
}
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
compute_intra_metrics Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/compute_cluster_metrics_bounded.py
code served (permissive licence) · get_code("bcea2dec08574dd1")
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 numpy as np

# Construct the metrics dictionary structure
# The function accesses: metrics['train'][finetuning_group][f'cluster_{finetuning_group}'][metric_key]
#                   and: metrics['test'][finetuning_group][f'cluster_{finetuning_group}'][metric_key]

metrics = {
    'train': {
        '0': {
            'cluster_0': {
                'accuracy': 0.85
            }
        },
        '1': {
            'cluster_1': {
                'accuracy': 0.90
            }
        },
        '2': {
            'cluster_2': {
                'accuracy': 0.75
            }
        },
        'invalid_group': {
            'cluster_invalid': {
                'accuracy': 0.80
            }
        }
    },
    'test': {
        '0': {
            'cluster_0': {
                'accuracy': 0.78
            }
        },
        '1': {
            'cluster_1': {
                'accuracy': 0.88
            }
        },
        '2': {
            'cluster_2': {
                'accuracy': 0.70
            }
        },
        'invalid_group': {
            'cluster_invalid': {
                'accuracy': 0.75
            }
        }
    }
}

# finetuning_groups should be iterable with digit and non-digit strings
finetuning_groups = ['0', '1', '2', 'invalid_group', '-1']

# eval_groups is not used in the function body, so any iterable works
eval_groups = ['eval_0', 'eval_1']

# metric_key is used to index into the cluster dictionary
metric_key = 'accuracy'

ARGS = {
    'metrics': metrics,
    'finetuning_groups': finetuning_groups,
    'eval_groups': eval_groups,
    'metric_key': metric_key
}
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 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
do_clustering Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/cluster.py
code served (permissive licence) · get_code("9d586db1c3b89519")
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 numpy as np

# Create embedded data: 10 samples, 4 dimensions
np.random.seed(0)
embedded_nd = np.random.randn(10, 4)

# Create config dict with required keys
cfg = {
    'min_clusters': 2,
    'max_clusters': 5,
    'algorithm': 'k-means'
}

ARGS = {
    'embedded_nd': embedded_nd,
    'cfg': cfg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
get_all_grads Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/extract_checkpoint.py
code served (permissive licence) · get_code("7a7cc54579861c0a")
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 list. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import numpy as np

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

dummy_input = torch.randn(2, 4)
output = model(dummy_input)
loss = output.sum()
loss.backward()

ARGS = {
    "model": model,
    "get_info": False,
    "max_dim": None
}
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 list — a list 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
get_data Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/embed.py
code served (permissive licence) · get_code("88b9adf1c13fa3c4")
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 ndarray, ndim 2, dtype family float, shape (2, 12) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from unittest.mock import MagicMock

# Create a mock z_file object that behaves like a dictionary with nested keys
z_file = MagicMock()

# Set up the mock to return arrays when accessed with key patterns like "my_key/0", "my_key/1", etc.
# We'll create 3 levels of data
key = "my_key"
level_0 = np.random.randn(2, 4)  # shape (2, 4)
level_1 = np.random.randn(2, 5)  # shape (2, 5)
level_2 = np.random.randn(2, 3)  # shape (2, 3)

# Configure the mock to return appropriate values
def mock_getitem(path):
    if path == f"{key}/0":
        return level_0
    elif path == f"{key}/1":
        return level_1
    elif path == f"{key}/2":
        return level_2
    else:
        raise KeyError(f"Path {path} not found")

z_file.__getitem__.side_effect = mock_getitem

# Define layers_ids - can be None or a list of indices
layers_ids = [0, 1, 2]

ARGS = {
    "z_file": z_file,
    "layers_ids": layers_ids,
    "key": key
}
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 ndarray, ndim 2, dtype family float, shape (2, 12) — shape (2, 12) as a later run recorded it
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
get_info_df Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/finetune_on_cluster_ewc.py
code served (permissive licence) · get_code("627f97ec7477a29c")
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 pandas as pd
import numpy as np

# Create a sample DataFrame with the required columns
np.random.seed(0)
n_rows = 20

objs_info_old = pd.DataFrame({
    'cluster': np.random.randint(-1, 5, n_rows),
    'split_id': np.random.randint(0, 3, n_rows)
})

# Ensure we have some rows for each condition
objs_info_old.loc[0:4, 'cluster'] = -2  # negative cluster (for 'correct' case)
objs_info_old.loc[5:9, 'cluster'] = 1   # positive cluster (for int case)
objs_info_old.loc[10:14, 'cluster'] = 0 # cluster 0 (for int case)
objs_info_old.loc[15:19, 'cluster'] = -1 # cluster -1 (filtered in 'all' case)

# Ensure we have different split_ids
objs_info_old.loc[0:6, 'split_id'] = 0
objs_info_old.loc[7:13, 'split_id'] = 1
objs_info_old.loc[14:19, 'split_id'] = 2

ARGS = {
    'objs_info_old': objs_info_old,
    'cluster_id': 'all'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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
get_n_levels Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model_repair/tasks/embed.py
code served (permissive licence) · get_code("97c8df471f827a3c")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 h5py
import tempfile
import os

# Create a temporary HDF5 file to use as z_file
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.h5")

# Create an HDF5 file with nested groups and datasets
with h5py.File(temp_file, 'w') as f:
    key = 'test_key'
    # Create groups at key/0, key/1, key/2 with some data
    for i in range(3):
        group = f.create_group(f'{key}/{i}')
        group.create_dataset('data', data=[1, 2, 3])

# Open the file for reading
z_file = h5py.File(temp_file, 'r')

ARGS = {
    'z_file': z_file,
    'key': 'test_key'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
h5py, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
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
make_layers Ran
ran on a synthesized input
Rokken-lab6/Failure-Analysis-and-Model-Repairment/model/model_vgg.py
code served (permissive licence) · get_code("84276219016f75da")
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 Sequential. 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

torch.manual_seed(0)

# Define arguments for make_layers function
cfg = [64, 'M', 128, 128, 'M', 256, 256, 'M']
batch_norm = True
in_channels = 3

ARGS = {
    'cfg': cfg,
    'batch_norm': batch_norm,
    'in_channels': in_channels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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-22.

Repositories linked to this paper

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

Abstract

Machine learning models commonly exhibit unexpected failures post-deployment due to either data shifts or uncommon situations in the training environment. Domain experts typically go through the tedious process of inspecting the failure cases manually, identifying failure modes and then attempting to fix the model. In this work, we aim to standardise and bring principles to this process through answering two critical questions: (i) how do we know that we have identified meaningful and distinct failure types?; (ii) how can we validate that a model has, indeed, been repaired? We suggest that the quality of the identified failure types can be validated through measuring the intra- and inter-type generalisation after fine-tuning and introduce metrics to compare different subtyping methods. Furthermore, we argue that a model can be considered repaired if it achieves high accuracy on the failure types while retaining performance on the previously correct data. We combine these two ideas into a principled framework for evaluating the quality of both the identified failure subtypes and model repairment. We evaluate its utility on a classification and an object detection tasks. Our code is available at https://github.com/Rokken-lab6/Failure-Analysis-and-Model-Repairment

For agents

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

get_harvested_code_for_paper("2109.12347")
get_code_for_paper("2109.12347")
have("2109.12347")

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

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

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

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

Connect an agent — have() is free.