SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.00524 · 2023

Large Language Models Enable Few-Shot Clustering

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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 6 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/2307.00524.json · badge: /api/ran/2307.00524.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
viswavi/few-shot-clustering canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
cluster_acc Ran
ran on a synthesized input
viswavi/few-shot-clustering/few_shot_clustering/eval_utils.py
code served (permissive licence) · get_code("4faa67ba46a4ff24")
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

# Create simple test data for cluster_acc
# y_true: ground truth cluster labels
# y_pred: predicted cluster labels
# Both should be 1D arrays of integers

y_true = np.array([0, 0, 1, 1, 2, 2], dtype=np.int64)
y_pred = np.array([0, 0, 1, 2, 2, 1], dtype=np.int64)

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
preprocess_20_newsgroups Ran
ran on a synthesized input
viswavi/few-shot-clustering/few_shot_clustering/dataloaders.py
code served (permissive licence) · get_code("652ec486bb71141b")
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 2, 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 random
from unittest.mock import MagicMock, patch

# Mock the sklearn datasets.fetch_20newsgroups to avoid network calls
mock_newsgroups_data = {
    'target': [0, 1, 0, 1, 2, 2, 1, 0],
    'data': [
        'text about topic 0 sample 1',
        'text about topic 1 sample 1',
        'text about topic 0 sample 2',
        'text about topic 1 sample 2',
        'text about topic 2 sample 1',
        'text about topic 2 sample 2',
        'text about topic 1 sample 3',
        'text about topic 0 sample 3',
    ],
    'target_names': ['topic_0', 'topic_1', 'topic_2', 'topic_3']
}

# Patch the fetch_20newsgroups function
import sklearn.datasets
original_fetch = sklearn.datasets.fetch_20newsgroups

def mock_fetch_20newsgroups(subset='all'):
    return mock_newsgroups_data

sklearn.datasets.fetch_20newsgroups = mock_fetch_20newsgroups

# Now define the arguments
ARGS = {
    'per_topic_samples': 2,
    'shuffle': True,
    'topics': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
reorder_labels Ran
ran on a synthesized input
viswavi/few-shot-clustering/few_shot_clustering/dataloaders.py
code served (permissive licence) · get_code("67ecc6851e709fb1")
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 int; 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

# Analyze the function:
# - Takes label_array as input
# - Calls set(label_array) to get unique labels
# - Iterates over enumerate(list(set(label_array)))
# - Uses labels as dictionary keys
# - Indexes into label_array with a for loop
# The function works with any array-like of hashable elements

# Create a simple label array with mixed labels
label_array = [0, 1, 2, 0, 1, 3, 2, 1]

ARGS = {
    "label_array": label_array
}
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 list, ndim 1, dtype family int — 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
sample_cluster_seeds Ran
ran on a synthesized input
viswavi/few-shot-clustering/few_shot_clustering/active_clustering.py
code served (permissive licence) · get_code("a6f19c4780d0753c")
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 1, dtype family int, shape (10,) 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
import random

random.seed(0)
np.random.seed(0)

# Create sample data
num_samples = 10
feature_dim = 4
num_clusters = 3

# Generate features as a list of numpy arrays or similar
features = [np.random.randn(feature_dim) for _ in range(num_samples)]

# Generate labels - cluster assignments (0, 1, 2)
labels = [i % num_clusters for i in range(num_samples)]

# Define ARGS
ARGS = {
    'features': features,
    'labels': labels,
    'max_feedback_given': 6,
    'aggregate': 'mean'
}
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 1, dtype family int, shape (10,) — shape (10,) 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
sample_square_points Ran
ran on a synthesized input
viswavi/few-shot-clustering/few_shot_clustering/dataloaders.py
code served (permissive licence) · get_code("405576572de6c854")
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 2, 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

# Analyze the function:
# - lower_left_corner: tuple/list with 2 elements (x, y coordinates)
# - upper_right_corner: tuple/list with 2 elements (x, y coordinates)
# - n_points: int, number of points to sample
# - corner_offset: float, offset from corners
# - seed: int, random seed

ARGS = {
    "lower_left_corner": (0.0, 0.0),
    "upper_right_corner": (10.0, 10.0),
    "n_points": 10,
    "corner_offset": 1.0,
    "seed": 0
}
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 list, ndim 2, 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
summarize_results Ran
ran on a synthesized input
viswavi/few-shot-clustering/few_shot_clustering/experiment_utils.py
code served (permissive licence) · get_code("da013cfc1f0225a9")
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 valid arguments for summarize_results
# The function expects all_seeds_results: dict[algo_name -> list of metric dicts]

# Create sample results for multiple seeds
algo1_results = [
    {'accuracy': 0.85, 'loss': 0.15, 'f1': 0.82},
    {'accuracy': 0.87, 'loss': 0.13, 'f1': 0.84},
    {'accuracy': 0.86, 'loss': 0.14, 'f1': 0.83},
]

algo2_results = [
    {'accuracy': 0.90, 'loss': 0.10, 'f1': 0.88},
    {'accuracy': 0.91, 'loss': 0.09, 'f1': 0.89},
    {'accuracy': 0.89, 'loss': 0.11, 'f1': 0.87},
]

algo3_results = [
    {'accuracy': 0.78, 'loss': 0.22},
    {'accuracy': 0.80, 'loss': 0.20},
]

all_seeds_results = {
    'algorithm_a': algo1_results,
    'algorithm_b': algo2_results,
    'algorithm_c': algo3_results,
}

ARGS = {
    'all_seeds_results': all_seeds_results,
}
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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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
cluster_acc 1 other paper
1 dated earlier
2110.08552 (2021-10)
Virtual Augmentation Supported Contrastive Learning of Sentence Representations

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

Unlike traditional unsupervised clustering, semi-supervised clustering allows users to provide meaningful structure to the data, which helps the clustering algorithm to match the user's intent. Existing approaches to semi-supervised clustering require a significant amount of feedback from an expert to improve the clusters. In this paper, we ask whether a large language model can amplify an expert's guidance to enable query-efficient, few-shot semi-supervised text clustering. We show that LLMs are surprisingly effective at improving clustering. We explore three stages where LLMs can be incorporated into clustering: before clustering (improving input features), during clustering (by providing constraints to the clusterer), and after clustering (using LLMs post-correction). We find incorporating LLMs in the first two stages can routinely provide significant improvements in cluster quality, and that LLMs enable a user to make trade-offs between cost and accuracy to produce desired clusters. We release our code and LLM prompts for the public to use.

For agents

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

get_harvested_code_for_paper("2307.00524")
get_code_for_paper("2307.00524")
have("2307.00524")

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

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

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

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

Connect an agent — have() is free.