SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.12259 · 2024

Concept Induction: Analyzing Unstructured Text with High-Level Concepts Using LLooM

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 3 have no contract verdict; 6 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/2404.12259.json · badge: /api/ran/2404.12259.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
michelle123lam/lloom canonical (classifier label)
classifier basis: census
9 ran · 0 no recorded run
FunctionStatusWhere it lives
base_api_wrapper Ran
ran; our contract draft was wrong, not the code
michelle123lam/lloom/text_lloom/src/text_lloom/llm.py
code served (permissive licence) · get_code("fa71a93b3f9cd7c0")
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 coroutine. 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)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    async def fn(self, model, cur_prompt):
        # The function calls model.fn(model, cur_prompt)
        # We need to return something valid
        return {"result": "success", "prompt": cur_prompt}

model = MockModel()
cur_prompt = "test prompt"

ARGS = {
    "cur_prompt": cur_prompt,
    "model": model
}
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 coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine 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
call_llm_fn Ran
ran on a synthesized input
michelle123lam/lloom/text_lloom/src/text_lloom/llm_openai.py
code served (permissive licence) · get_code("1b5f9a2aee2d28ed")
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 coroutine. 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 asyncio
from unittest.mock import Mock, AsyncMock, MagicMock

torch.manual_seed(0)

# Create a mock model with the required attributes and methods
model = Mock()
model.args = {}
model.name = "gpt-4"

# Create a truncate_fn that takes model, prompt, and out_token_alloc
def truncate_fn(model, prompt, out_token_alloc=1500):
    # Simple truncation function that returns the prompt as-is
    return prompt[:500]  # Return truncated version

model.truncate_fn = truncate_fn

# Create a mock client with async chat.completions.create
model.client = Mock()
model.client.chat = Mock()
model.client.chat.completions = Mock()

# Create mock response
mock_response = Mock()
mock_response.choices = [Mock()]
mock_response.choices[0].message = Mock()
mock_response.choices[0].message.content = "This is a test response from the LLM."
mock_response.usage = Mock()
mock_response.usage.prompt_tokens = 42
mock_response.usage.completion_tokens = 18

# Make the create method async and return the mock response
async def async_create(**kwargs):
    return mock_response

model.client.chat.completions.create = AsyncMock(return_value=mock_response)

# Define the prompt
prompt = "Identify the pattern in these examples: 1, 2, 3, 4, 5"

ARGS = {
    "model": model,
    "prompt": prompt
}
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 coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine 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
json_load Ran
ran; our contract draft was wrong, not the code
michelle123lam/lloom/text_lloom/src/text_lloom/concept_induction.py
code served (permissive licence) · get_code("5473633ba4bbbf1c")
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 yaml

# Test case 1: None input
s_none = None

# Test case 2: Dict input (should use top_level_key if provided)
s_dict = {
    "config": {"model": "transformer", "layers": 12},
    "data": [1, 2, 3]
}

# Test case 3: String with JSON content
s_json_string = '  { "name": "test", "value": 42 }  '

# Test case 4: String with JSON and surrounding text
s_json_with_text = 'prefix text { "key": "value" } suffix text'

# Test case 5: Invalid JSON (should catch exception and return None)
s_invalid = 'this is not json at all'

# Test case 6: Dict input with top_level_key extraction
s_dict_with_key = {
    "metadata": {"version": 1},
    "results": {"accuracy": 0.95, "loss": 0.05}
}

ARGS = {
    "s": s_json_string,
    "top_level_key": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
multi_query_gpt Ran
ran on a synthesized input
michelle123lam/lloom/text_lloom/src/text_lloom/llm.py
code served (permissive licence) · get_code("36827757b54457c0")
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 coroutine. 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 asyncio
import torch
import torch.nn as nn

torch.manual_seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    async def fn(self, model, prompt):
        # Simulate async API call
        await asyncio.sleep(0.01)
        return ("success", {"response": "test_response"})

model = MockModel()

prompt_template = "Hello {name}, you are {age} years old"

arg_dict = {
    "name": "Alice",
    "age": "25"
}

batch_num = 1

wait_time = 0.01

debug = False

ARGS = {
    "model": model,
    "prompt_template": prompt_template,
    "arg_dict": arg_dict,
    "batch_num": batch_num,
    "wait_time": wait_time,
    "debug": debug
}
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 coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine 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
multi_query_gpt_wrapper Ran
ran on a synthesized input
michelle123lam/lloom/text_lloom/src/text_lloom/llm.py
code served (permissive licence) · get_code("d0db655db88778ad")
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 coroutine. 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 asyncio
import numpy as np

class MockModel:
    def __init__(self, name="test_model", rate_limit=None):
        self.name = name
        self.rate_limit = rate_limit
    
    async def fn(self, model, prompt):
        # Simulate API response with (text, tokens) tuple
        # tokens is (input_tokens, output_tokens)
        return ("mock response", (10, 5))

async def setup_and_verify():
    prompt_template = "Question: {question}, Answer: {answer}"
    
    arg_dicts = [
        {"question": "What is 2+2?", "answer": "4"},
        {"question": "What is 3+3?", "answer": "6"},
        {"question": "What is 4+4?", "answer": "8"},
    ]
    
    model = MockModel(name="test_gpt", rate_limit=(2, 0.1))
    
    return prompt_template, arg_dicts, model

prompt_template, arg_dicts, model = asyncio.run(setup_and_verify())

ARGS = {
    "prompt_template": prompt_template,
    "arg_dicts": arg_dicts,
    "model": model,
    "batch_num": None,
    "batched": True,
    "debug": False,
}
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 coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine 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
pretty_print_dict Ran
ran; our contract draft was wrong, not the code
michelle123lam/lloom/text_lloom/src/text_lloom/concept_induction.py
code served (permissive licence) · get_code("006c9246a8fd9b35")
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 str. 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

torch.manual_seed(0)

# Analyze the function: pretty_print_dict(d)
# The function takes a dict 'd' and iterates over its items (k, v pairs)
# It formats each as 'k: v' and joins with newlines and tabs
# So we need a dict with string keys and values that can be formatted as strings

ARGS = {
    'd': {
        'learning_rate': 0.001,
        'batch_size': 32,
        'epochs': 10,
        'model_type': 'transformer',
        'hidden_dim': 256
    }
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
pretty_print_dict_list Ran
ran; our contract draft was wrong, not the code
michelle123lam/lloom/text_lloom/src/text_lloom/concept_induction.py
code served (permissive licence) · get_code("8b30d23c7d2d2145")
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 str. 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

torch.manual_seed(0)

# Analyze the function:
# pretty_print_dict_list takes d_list as parameter
# It iterates over d_list calling pretty_print_dict on each element
# pretty_print_dict takes a dict d and iterates over d.items()
# So d_list should be a list of dicts

# Create a list of dictionaries with varying sizes
d_list = [
    {'model': 'bert', 'layers': 12, 'hidden_size': 768},
    {'batch_size': 32, 'learning_rate': 0.001, 'epochs': 10},
    {'loss': 0.523, 'accuracy': 0.95}
]

ARGS = {
    'd_list': d_list
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
setup_embed_fn Ran
ran; our contract draft was wrong, not the code
michelle123lam/lloom/text_lloom/src/text_lloom/llm_openai.py
code served (permissive licence) · get_code("42f160b127b653ce")
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 MockOpenAI. 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 os

# Mock the OpenAI client since we can't make actual network calls
class MockOpenAI:
    def __init__(self, api_key):
        self.api_key = api_key

# We need to mock the openai module before the function is called
import sys
from unittest.mock import MagicMock

# Create a mock openai module
mock_openai = MagicMock()
mock_openai.OpenAI = MockOpenAI
sys.modules['openai'] = mock_openai

# Now define the setup function with our mock in place
def setup_embed_fn(api_key):
    from openai import OpenAI
    embed_client = OpenAI(api_key=api_key)
    return embed_client

# Define arguments
ARGS = {
    'api_key': 'test-api-key-12345'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockOpenAI — a MockOpenAI output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockOpenAI 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
setup_llm_fn Ran
ran; our contract draft was wrong, not the code
michelle123lam/lloom/text_lloom/src/text_lloom/llm_openai.py
code served (permissive licence) · get_code("42e216402aeed245")
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 AsyncOpenAI. 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 os

ARGS = {
    "api_key": os.environ.get("OPENAI_API_KEY", "sk-test-dummy-key-for-setup")
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AsyncOpenAI — a AsyncOpenAI output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AsyncOpenAI 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 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

Data analysts have long sought to turn unstructured text data into meaningful concepts. Though common, topic modeling and clustering focus on lower-level keywords and require significant interpretative work. We introduce concept induction, a computational process that instead produces high-level concepts, defined by explicit inclusion criteria, from unstructured text. For a dataset of toxic online comments, where a state-of-the-art BERTopic model outputs "women, power, female," concept induction produces high-level concepts such as "Criticism of traditional gender roles" and "Dismissal of women's concerns." We present LLooM, a concept induction algorithm that leverages large language models to iteratively synthesize sampled text and propose human-interpretable concepts of increasing generality. We then instantiate LLooM in a mixed-initiative text analysis tool, enabling analysts to shift their attention from interpreting topics to engaging in theory-driven analysis. Through technical evaluations and four analysis scenarios ranging from literature review to content moderation, we find that LLooM's concepts improve upon the prior art of topic models in terms of quality and data coverage. In expert case studies, LLooM helped researchers to uncover new insights even from familiar datasets, for example by suggesting a previously unnoticed concept of attacks on out-party stances in a political social media dataset.

For agents

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

get_harvested_code_for_paper("2404.12259")
get_code_for_paper("2404.12259")
have("2404.12259")

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

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

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

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

Connect an agent — have() is free.