SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.07246 · ICLR · 2023

FreeMatch: Self-adaptive Thresholding for Semi-supervised Learning

Bernt Schiele, Jindong Wang, Hao Chen, Marios Savvides, Xing Xie, Bhiksha Raj, Yidong Wang, Wenxin Hou, Takahiro Shinozaki, Qiang Heng, Yue Fan, Zhen Wu

arXiv · PDF · Open in the Atlas

Code that ran

9 of 14 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; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 4 failures of our instrument; 5 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/2205.07246.json · badge: /api/ran/2205.07246.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
microsoft/semi-supervised-learning canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
siyi-wind/STiL community (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
shreejalt/freematch-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 1 no recorded run
torchssl/torchssl marked official in Papers with Code
Papers with Code archive
1 ran · 1 no recorded run
abbaasalif/freematch-improved community
Papers with Code archive
0 ran · 2 no recorded run
FunctionStatusWhere it lives
ConsistencyLoss Ran
ran on a synthesized input
shreejalt/freematch-pytorch/utils/losses.py
code served (permissive licence) · get_code("8837096520e4398d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 0, dtype family float, 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 torch.nn.functional as F

class ConsistencyLoss:

    def __call__(self, logits, targets, mask=None):
        preds = F.log_softmax(logits, dim=-1)
        loss = F.nll_loss(preds, targets, reduction='none')
        if mask is not None:
            masked_loss = loss * mask.float()
            return masked_loss.mean()
        return loss.mean()


INIT_ARGS = {}

ARGS = {
    'logits': torch.randn(2, 4),
    'targets': torch.randint(0, 4, (2,)),
    'mask': torch.ones(2)
}

METHOD = '__call__'

if __name__ == '__main__':
    consistency_loss = ConsistencyLoss(**INIT_ARGS)
    result = consistency_loss(**ARGS)
    print(f"Loss result: {result}")
    print(f"Result shape: {result.shape}")
    print(f"Result type: {type(result)}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
consistency_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
torchssl/torchssl/models/freematch/freematch.py
code served (permissive licence) · get_code("8d4e503501f8115a")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Build arguments for consistency_loss function
batch_size = 2
num_classes = 4

# logits_s: student logits [batch_size, num_classes]
logits_s = torch.randn(batch_size, num_classes)

# logits_w: weak/teacher logits [batch_size, num_classes]
logits_w = torch.randn(batch_size, num_classes)

# time_p: temporal probability schedule (scalar)
time_p = 0.75

# p_model: model confidence per class [num_classes]
p_model = torch.ones(num_classes) * 0.5

# dataset: string identifier
dataset = 'cifar10'

# name: loss type
name = 'ce'

# use_hard_labels: boolean flag
use_hard_labels = True

ARGS = {
    'dataset': dataset,
    'logits_s': logits_s,
    'logits_w': logits_w,
    'time_p': time_p,
    'p_model': p_model,
    'name': name,
    'use_hard_labels': use_hard_labels,
}
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 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
conv1x1 Ran
ran; our contract draft was wrong, not the code
siyi-wind/STiL/models/resnets.py
code served (permissive licence) · get_code("7487c583dca6a842")
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 Conv2d. 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
from torch import nn

torch.manual_seed(0)

ARGS = {
    "in_planes": 3,
    "out_planes": 64,
    "stride": 1,
}
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 Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
siyi-wind/STiL/models/resnets.py
code served (permissive licence) · get_code("c5e915e62a479bd7")
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 Conv2d. 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
from torch import nn

torch.manual_seed(0)

ARGS = {
    "in_planes": 3,
    "out_planes": 64,
    "stride": 1,
    "groups": 1,
    "dilation": 1,
}
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 Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
convert_to_float Ran
ran on a synthesized input
siyi-wind/STiL/datasets/ContrastiveImagingAndTabularDataset.py
code served (permissive licence) · get_code("b45ebdf32841b261")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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

torch.manual_seed(0)

# The function convert_to_float takes a single parameter x
# and calls x.float() on it, so x must be a torch.Tensor
# (or something with a .float() method)

x = torch.tensor([[1, 2, 3, 4],
                   [5, 6, 7, 8]], dtype=torch.int32)

ARGS = {
    "x": x
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
convert_to_ts Ran
ran on a synthesized input
siyi-wind/STiL/datasets/ContrastiveImagingAndTabularDataset.py
code served (permissive licence) · get_code("4e0f862bc1278ba0")
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 Tensor, ndim 3, dtype family float, shape (2, 4, 3) 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 numpy as np

torch.manual_seed(0)

# Analyze the function:
# - Takes parameter 'x' and '**kwargs'
# - x is clipped to [0, 255] range, so it should be a numpy array with values in that range
# - x is divided by 255, so it becomes float in [0, 1]
# - x is converted to torch tensor and cast to float
# - x is permuted with (2, 0, 1), meaning x must have 3 dimensions
#   The permutation suggests: (H, W, C) -> (C, H, W)
#   So x should be a numpy array of shape (height, width, channels)

# Create a small stand-in numpy array with shape (4, 3, 2)
# representing (height=4, width=3, channels=2) with values in [0, 255]
x = np.random.randint(0, 256, size=(4, 3, 2), dtype=np.uint8).astype(np.float32)

ARGS = {
    "x": x
}
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 Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) 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
convert_to_ts_01 Ran
ran on a synthesized input
siyi-wind/STiL/datasets/ContrastiveImagingAndTabularDataset.py
code served (permissive licence) · get_code("4369fbda3bd2eef3")
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 Tensor, ndim 3, dtype family float, shape (4, 2, 3) 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 numpy as np

torch.manual_seed(0)

# Construct a small numpy array with shape (height, width, channels)
# Using distinct sizes: 2 (height), 3 (width), 4 (channels)
x = np.random.randn(2, 3, 4).astype(np.float32)

ARGS = {
    'x': x
}
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 Tensor, ndim 3, dtype family float, shape (4, 2, 3) — shape (4, 2, 3) 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
entropy_loss Ran
ran; our contract draft was wrong, not the code
microsoft/semi-supervised-learning/semilearn/algorithms/freematch/freematch.py
code served (permissive licence) · get_code("e4d38b3bf55a8430")
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

torch.manual_seed(0)

# Create a mask tensor - shape (6,) with some True and False values
mask = torch.tensor([True, False, True, True, False, True])

# Create logits_s tensor - shape (6, 4) for 6 samples and 4 classes
logits_s = torch.randn(6, 4)

# Create prob_model tensor - shape (4,) representing class probabilities
prob_model = torch.tensor([0.25, 0.25, 0.25, 0.25])

# Create label_hist tensor - shape (4,) representing label histogram
# Use non-zero values to avoid division by zero issues
label_hist = torch.tensor([10.0, 20.0, 15.0, 5.0])

ARGS = {
    "mask": mask,
    "logits_s": logits_s,
    "prob_model": prob_model,
    "label_hist": label_hist,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
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
replace_inf_to_zero Ran
ran, honoured the contract we drafted
microsoft/semi-supervised-learning/semilearn/algorithms/freematch/freematch.py
code served (permissive licence) · get_code("c5976b5c715825f6")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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 numpy as np

torch.manual_seed(0)

# The function takes a single parameter 'val' which should support:
# - indexing with boolean masks (val[val == float('inf')])
# - assignment (val[...] = 0.0)
# - comparison with float('inf')
# This works with numpy arrays and torch tensors

# Create a tensor with some inf values
val = torch.tensor([
    [1.0, float('inf'), 3.0, 4.0],
    [float('inf'), 2.0, 5.0, 6.0]
], dtype=torch.float32)

ARGS = {
    "val": val
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
ConsistencyLoss Not yet run
unverified (harvested, no recorded run)
abbaasalif/freematch-improved/utils/losses.py
pointer only (licence: NONE) · get_code("26ae35625bab2b43")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, abbaasalif/freematch-improved when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

FreeMatch Not yet run
unverified (harvested, no recorded run)
torchssl/torchssl/models/freematch/freematch.py
code served (permissive licence) · get_code("68352b4ace632b5c")
How it ran

no invocation recorded.

SelfAdaptiveThresholdLoss Not yet run
unverified (harvested, no recorded run)
abbaasalif/freematch-improved/utils/losses.py
pointer only (licence: NONE) · get_code("ad8a877057eed809")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, abbaasalif/freematch-improved when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

SelfAdaptiveThresholdLoss Not yet run
unverified (harvested, no recorded run)
shreejalt/freematch-pytorch/utils/losses.py
code served (permissive licence) · get_code("a169b5b35ae13821")
How it ran

no invocation recorded.

resnet18 Not yet run
unverified (harvested, no recorded run)
siyi-wind/STiL/models/resnets.py
code served (permissive licence) · get_code("cec899f733d5acb7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 2 the same month, 3 later) and 11 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
conv1x1 431 other papers
189 dated earlier, 2 the same month, 228 later, 11 same year, order not determinable, 1 undated · 38 only as an assembly brick
1409.1556 (2014-09)
Very Deep Convolutional Networks for Large-Scale Image Recognition
1506.01186 (2015-06)
Cyclical Learning Rates for Training Neural Networks
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
and 428 more not named here
conv3x3 312 other papers
119 dated earlier, 1 the same month, 182 later, 9 same year, order not determinable, 1 undated · 31 only as an assembly brick
1409.1556 (2014-09)
Very Deep Convolutional Networks for Large-Scale Image Recognition
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
and 309 more not named here
replace_inf_to_zero 1 other paper
1 later
2310.18910 (2023-10)
InstanT: Semi-supervised Learning with Instance-dependent Thresholds

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

Semi-supervised Learning (SSL) has witnessed great success owing to the impressive performances brought by various methods based on pseudo labeling and consistency regularization. However, we argue that existing methods might fail to utilize the unlabeled data more effectively since they either use a pre-defined / fixed threshold or an ad-hoc threshold adjusting scheme, resulting in inferior performance and slow convergence. We first analyze a motivating example to obtain intuitions on the relationship between the desirable threshold and model's learning status. Based on the analysis, we hence propose FreeMatch to adjust the confidence threshold in a self-adaptive manner according to the model's learning status. We further introduce a self-adaptive class fairness regularization penalty to encourage the model for diverse predictions during the early training stage. Extensive experiments indicate the superiority of FreeMatch especially when the labeled data are extremely rare. FreeMatch achieves 5.78%, 13.59%, and 1.28% error rate reduction over the latest state-of-the-art method FlexMatch on CIFAR-10 with 1 label per class, STL-10 with 4 labels per class, and Im-ageNet with 100 labels per class, respectively. Moreover, FreeMatch can also boost the performance of imbalanced SSL. The codes can be found at https: //github.com/microsoft/Semi-supervised-learning. 1

For agents

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

get_harvested_code_for_paper("2205.07246")
get_code_for_paper("2205.07246")
have("2205.07246")

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

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

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

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

Connect an agent — have() is free.