SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2506.03521 · AAAI · 2025

Target Semantics Clustering via Text Representations for Robust Universal Domain Adaptation

Zilei Wang, Yixin Zhang, Weinan He

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 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 6 have no contract verdict; 1 failure of our instrument; 3 no recorded run), measured 2026-11-24; 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/2506.03521.json · badge: /api/ran/2506.03521.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
Sapphire-356/TASC canonical (classifier label)
classifier basis not recorded on the link
8 ran · 3 no recorded run
FunctionStatusWhere it lives
Metric Ran
ran on a synthesized input
Sapphire-356/TASC/train_sapphire_TASC.py
code served (permissive licence) · get_code("a64a50db3a32fffe")
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 1, dtype family float, shape (2,) 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
from math import log

torch.manual_seed(0)

# S_iter: shape (1, num_classes, feature_dim) after unsqueeze
# It's indexed by r_iter which selects from dimension 1
# Then transposed and used in matrix multiply with image_features
# So S_iter should be (batch, num_classes, feature_dim)
S_iter = torch.randn(2, 5, 4)  # (batch=2, num_classes=5, feature_dim=4)

# r_iter: shape (1,) - indices into the num_classes dimension
# Used as S_iter[:, r_iter, :] so it selects from dimension 1
r_iter = torch.tensor([0, 1])  # (batch=2,) - select 2 classes

# image_features: shape (num_images, feature_dim)
# Used in @ operation with S_iter[:, r_iter, :].mT
# S_iter[:, r_iter, :] is (batch, feature_dim) after fancy indexing
# .mT makes it (feature_dim, batch)
# So image_features @ (feature_dim, batch) requires (num_images, feature_dim)
image_features = torch.randn(3, 4)  # (num_images=3, feature_dim=4)

# lambda_dict: dict mapping loss keys to scalar weights
lambda_dict = {
    'loss_t_im_ent': 1.0,
    'loss_t_im_div': 0.5
}

ARGS = {
    'S_iter': S_iter,
    'r_iter': r_iter,
    'image_features': image_features,
    'lambda_dict': lambda_dict,
    'ce_prob_temp': 0.01
}
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 1, dtype family float, shape (2,) — shape (2,) 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
NNConsistencyLoss Ran
ran on a synthesized input
Sapphire-356/TASC/sapphire/train/loss.py
code served (permissive licence) · get_code("b6022f70325a4031")
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 torch.nn as nn

torch.manual_seed(0)

# Parameters analysis:
# - indexs: used as memory_bank[indexs], so tensor of indices
# - nn_indexs: checked to be 2D, used as memory_bank[nn_indexs], so 2D tensor of indices
# - input: tensor used in operations (unsqueeze, expand, sum, mean, log)
# - memory_bank: indexed by indexs and nn_indexs, holds feature vectors
# - type: string, either 'product' or 'mse'
# - label_smooth: optional float for smoothing

# Dimensions:
# - batch_size: 2
# - feature_dim: 4
# - num_neighbors: 3
# - memory_bank_size: 5

batch_size = 2
feature_dim = 4
num_neighbors = 3
memory_bank_size = 5

# Create indexs: indices into memory_bank for the current batch
indexs = torch.tensor([0, 1], dtype=torch.long)

# Create nn_indexs: 2D tensor of neighbor indices (batch_size x num_neighbors)
nn_indexs = torch.tensor([
    [2, 3, 4],
    [1, 2, 3]
], dtype=torch.long)

# Create input: feature vectors for current batch (batch_size x feature_dim)
input = torch.randn(batch_size, feature_dim)

# Create memory_bank: stores all feature vectors (memory_bank_size x feature_dim)
memory_bank = torch.randn(memory_bank_size, feature_dim)

# Type parameter
type_param = 'product'

# Label smoothing parameter
label_smooth = 0.1

ARGS = {
    'indexs': indexs,
    'nn_indexs': nn_indexs,
    'input': input,
    'memory_bank': memory_bank,
    'type': type_param,
    'label_smooth': label_smooth
}
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, 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
aToBSheduler Ran
ran, honoured the contract we drafted
Sapphire-356/TASC/sapphire/models/utils.py
code served (permissive licence) · get_code("07e359b5e4b5c432")
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 float, 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 numpy as np

ARGS = {
    'step': 500,
    'A': 1.0,
    'B': 3.0,
    'gamma': 10,
    'max_iter': 10000
}
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 float, 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: none by the harness; any seed is in the setup block
find_folders_with_keyword Ran
ran on a synthesized input
Sapphire-356/TASC/exp_scripts/get_results.py
code served (permissive licence) · get_code("6257214ba37b90f8")
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, 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 os
import tempfile
import shutil

# Create a temporary directory structure for testing
temp_root = tempfile.mkdtemp()

# Create nested folder structure with keywords
os.makedirs(os.path.join(temp_root, "project_alpha"), exist_ok=True)
os.makedirs(os.path.join(temp_root, "project_alpha", "data_beta"), exist_ok=True)
os.makedirs(os.path.join(temp_root, "project_alpha", "data_beta", "output_gamma"), exist_ok=True)
os.makedirs(os.path.join(temp_root, "other_folder"), exist_ok=True)
os.makedirs(os.path.join(temp_root, "data_folder"), exist_ok=True)

ARGS = {
    "root_dir": temp_root,
    "keywords": ["data"]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
find_metric_json_files Ran
ran on a synthesized input
Sapphire-356/TASC/exp_scripts/get_results.py
code served (permissive licence) · get_code("38a3330d069f724f")
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, 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 os
import tempfile
import json

# Create a temporary directory with some test JSON files
temp_dir = tempfile.mkdtemp()

# Create subdirectories
subdir1 = os.path.join(temp_dir, "subdir1")
subdir2 = os.path.join(temp_dir, "subdir2")
os.makedirs(subdir1, exist_ok=True)
os.makedirs(subdir2, exist_ok=True)

# Create metric JSON files
metric_file1 = os.path.join(temp_dir, "metric_results.json")
metric_file2 = os.path.join(subdir1, "metric_train.json")
metric_file3 = os.path.join(subdir2, "metric_test.json")

# Create non-metric JSON files (should not be found)
other_file1 = os.path.join(temp_dir, "data.json")
other_file2 = os.path.join(subdir1, "config.json")

# Write dummy JSON content
for filepath in [metric_file1, metric_file2, metric_file3, other_file1, other_file2]:
    with open(filepath, 'w') as f:
        json.dump({"dummy": "data"}, f)

ARGS = {
    "folder": temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
flatten_json_fields Ran
ran on a synthesized input
Sapphire-356/TASC/exp_scripts/get_results.py
code served (permissive licence) · get_code("62b8c7b3100d78c8")
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

# Construct test data for flatten_json_fields
# The function expects a dictionary where values can be either dicts or scalars
# It flattens two-level nested dicts into single-level dicts with merged keys

data = {
    "user": {
        "name": "Alice",
        "age": 30,
        "email": "alice@example.com"
    },
    "settings": {
        "theme": "dark",
        "notifications": True,
        "language": "en"
    },
    "status": "active"
}

ARGS = {
    "data": data
}
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
get_entropy Ran
ran on a synthesized input
Sapphire-356/TASC/train_sapphire_TASCBase.py
code served (permissive licence) · get_code("2904c1a5e4c8fd97")
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 1, dtype family float, shape (2,) 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 as nn

torch.manual_seed(0)

# Create features tensor: shape (batch_size, feature_dim) = (2, 4)
features = torch.randn(2, 4)

# Create anchors tensor: shape (num_anchors, feature_dim) = (3, 4)
# This will be used as anchors.T in the function, so we need it to have
# feature_dim as the last dimension
anchors = torch.randn(3, 4)

# temp parameter - a float controlling temperature scaling
temp = 0.01

# normalized parameter - a boolean flag
normalized = True

ARGS = {
    "features": features,
    "anchors": anchors,
    "temp": temp,
    "normalized": normalized,
}
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 1, dtype family float, shape (2,) — shape (2,) 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
unravel_indices Ran
ran; our contract draft was wrong, not the code
Sapphire-356/TASC/train_sapphire_TASCBase.py
code served (permissive licence) · get_code("203cd9f4f03efdfd")
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 int, shape (2, 4, 2) 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)

# Create flat indices tensor with shape (2, 4) - batch size 2, 4 indices each
indices = torch.tensor([
    [0, 5, 10, 15],
    [3, 7, 12, 20]
], dtype=torch.long)

# Define target shape as a tuple (3, 7) - 3D shape with dimensions 3 and 7
shape = (3, 7)

ARGS = {
    "indices": indices,
    "shape": shape,
}
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 3, dtype family int, shape (2, 4, 2) — shape (2, 4, 2) 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
LoRA_ViT Not yet run
unverified (harvested, no recorded run)
Sapphire-356/TASC/sapphire/models/LoRA_layer.py
code served (permissive licence) · get_code("511c1d694621e88c")
How it ran

no invocation recorded.

get_prototypes Not yet run
unverified (harvested, no recorded run)
Sapphire-356/TASC/train_sapphire_TASCBase.py
code served (permissive licence) · get_code("4f30a84e99b847d7")
How it ran

no invocation recorded.

gmm_threshold Not yet run
unverified (harvested, no recorded run)
Sapphire-356/TASC/train_sapphire_TASC.py
code served (permissive licence) · get_code("45ced87c694743dd")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
aToBSheduler 1 other paper
1 dated earlier
2208.04610 (2022-08)
LAMDA-SSL: Semi-Supervised Learning in Python
unravel_indices 1 other paper
1 dated earlier
2110.13878 (2021-10)
Deep Explicit Duration Switching Models for Time Series

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

Repositories linked to this paper

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

Abstract

Universal Domain Adaptation (UniDA) focuses on transferring source domain knowledge to the target domain under both domain shift and unknown category shift. Its main challenge lies in identifying common class samples and aligning them. Current methods typically obtain target domain semantics centers from an unconstrained continuous image representation space. Due to domain shift and the unknown number of clusters, these centers often result in complex and less robust alignment algorithm. In this paper, based on visionlanguage models, we search for semantic centers in a semantically meaningful and discrete text representation space. The constrained space ensures almost no domain bias and appropriate semantic granularity for these centers, enabling a simple and robust adaptation algorithm. Specifically, we propose TArget Semantics Clustering (TASC) via Text Representations, which leverages information maximization as a unified objective and involves two stages. First, with the frozen encoders, a greedy search-based framework is used to search for an optimal set of text embeddings to represent target semantics. Second, with the search results fixed, encoders are refined based on gradient descent, simultaneously achieving robust domain alignment and private class clustering. Additionally, we propose Universal Maximum Similarity (UniMS), a scoring function tailored for detecting open-set samples in UniDA. Experimentally, we evaluate the universality of UniDA algorithms under four category shift scenarios. Extensive experiments on four benchmarks demonstrate the effectiveness and robustness of our method, which has achieved state-of-the-art performance.

For agents

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

get_harvested_code_for_paper("2506.03521")
get_code_for_paper("2506.03521")
have("2506.03521")

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

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

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

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

Connect an agent — have() is free.