SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.04232 · ACL · 2024

Benchmarking and Improving Compositional Generalization of Multi-aspect Controllable Text Generation

Ying Wei, Defu Lian, Linqi Song, Quan Wang, Zhendong Mao, Zhaoyi Li, Tianqi Zhong, I Comp

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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, 1 violated it and 0 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.04232.json · badge: /api/ran/2404.04232.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
tqzhong/cg4mctg canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
check_train Ran
ran, violated the contract we drafted
tqzhong/cg4mctg/meta-mctg/load_dataset.py
code served (permissive licence) · get_code("cc4e3483e9e21e24")
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 bool, 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

torch.manual_seed(0)

def check_train(datum: dict, hold_combs: list) -> bool:
    """
    return True: datum is supposed to be in train_set;
    otherwise: datum is supposed to be held out;
    """
    for i in range(len(hold_combs)):
        flag = True
        for key in hold_combs[i].keys():
            if datum[key] != hold_combs[i][key]:
                flag = False
        if flag == False:
            pass
        else:
            return False
    return True


# Example datum with some keys and values
datum = {
    "user_id": 42,
    "category": "electronics",
    "region": "north"
}

# List of combination dicts that define what should be held out
# If datum matches all keys in any hold_comb, it's held out (return False)
# Otherwise it's in train set (return True)
hold_combs = [
    {"user_id": 99, "category": "clothing"},
    {"region": "south", "category": "books"}
]

ARGS = {
    "datum": datum,
    "hold_combs": hold_combs
}
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 bool, 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
get_att_tokens_ids Ran
ran, honoured the contract we drafted
tqzhong/cg4mctg/meta-mctg/dcg_meta.py
code served (permissive licence) · get_code("2e66984a9ea41d4d")
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 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 torch
from transformers import AutoTokenizer

class MockTokenizer:
    """Mock tokenizer that returns single token IDs for attribute values"""
    def __init__(self):
        self.token_counter = 0
    
    def encode(self, text):
        # For any input text with leading space, return a list with one token ID
        if text.startswith(' '):
            token_id = 100 + self.token_counter
            self.token_counter += 1
            return [token_id]
        return [0]

# Create a mock tokenizer
tokenizer = MockTokenizer()

# Create test data: list of dicts where each dict represents attributes
# The function expects that encoding any attribute value returns exactly 1 token
combs = [
    {
        'color': 'red',
        'size': 'large',
        'material': 'cotton'
    },
    {
        'color': 'blue',
        'size': 'small',
        'material': 'wool'
    }
]

ARGS = {
    'combs': combs,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — 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 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
get_support_combs Ran
ran; our contract draft was wrong, not the code
tqzhong/cg4mctg/meta-mctg/contrastive_prefix_meta.py
code served (permissive licence) · get_code("27e90bbc00602ee5")
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 itertools

# Analyze the function:
# - current_combs: list of dicts with keys from label_keys
# - seen_combs: list of dicts with keys from label_keys
# - label_keys: list of strings (keys to extract from dicts)
# The function extracts unique values per key from current_combs,
# creates all combinations, filters to remove current_combs,
# then filters to keep only items in seen_combs.

# Create realistic test data
label_keys = ["color", "size"]

# current_combs: some existing combinations
current_combs = [
    {"color": "red", "size": "small"},
    {"color": "blue", "size": "large"},
]

# seen_combs: a superset containing various combinations we've seen before
seen_combs = [
    {"color": "red", "size": "small"},
    {"color": "red", "size": "large"},
    {"color": "blue", "size": "small"},
    {"color": "blue", "size": "large"},
    {"color": "green", "size": "small"},
    {"color": "green", "size": "large"},
]

ARGS = {
    "current_combs": current_combs,
    "seen_combs": seen_combs,
    "label_keys": label_keys,
}
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
padding_fuse_fn Ran
ran; our contract draft was wrong, not the code
tqzhong/cg4mctg/meta-mctg/contrastive_prefix_meta.py
code served (permissive licence) · get_code("bb747457b90d9661")
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

torch.manual_seed(0)

# Construct valid arguments for padding_fuse_fn
# The function expects a list of dictionaries with keys: 'text', 'comb', and other label keys

data_list = [
    {
        'text': [101, 2054, 2003, 1045],  # 4 tokens
        'comb': 'comb_a',
        'label_1': 0,
        'label_2': 1,
    },
    {
        'text': [101, 2054],  # 2 tokens
        'comb': 'comb_b',
        'label_1': 1,
        'label_2': 0,
    },
]

ARGS = {
    'data_list': data_list,
}
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
padding_fuse_fn Ran
ran; our contract draft was wrong, not the code
tqzhong/cg4mctg/meta-mctg/dcg_meta.py
code served (permissive licence) · get_code("a7934fa0e86ec35f")
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

torch.manual_seed(0)

# Construct data_list - a list of dictionaries with required structure
# Each item needs: 'text' (list of token ids), 'comb' (some value), and other label keys

data_item_1 = {
    'text': [100, 200, 300],  # sequence of 3 tokens
    'comb': 'comb_a',
    'label_1': 0,
    'label_2': 5,
}

data_item_2 = {
    'text': [101, 102],  # sequence of 2 tokens (shorter)
    'comb': 'comb_b',
    'label_1': 1,
    'label_2': 7,
}

data_list = [data_item_1, data_item_2]

ARGS = {
    'data_list': data_list,
}
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
tokenize Ran
ran; our contract draft was wrong, not the code
tqzhong/cg4mctg/meta-mctg/contrastive_prefix_meta.py
code served (permissive licence) · get_code("9dbd25c2cddac479")
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 torch
import numpy as np
from unittest.mock import Mock

torch.manual_seed(0)

# Create a mock tokenizer that has an encode method
class MockTokenizer:
    def encode(self, text, max_length=None, truncation=False):
        # Return a list of token IDs
        return [101, 2054, 2003, 1045, 102]

tokenizer = MockTokenizer()

# Create sample dataset with review and other attributes
dataset_path = [
    {
        'review': 'This is a great product',
        'rating': 5,
        'helpful': True
    },
    {
        'review': 'Not satisfied with this item',
        'rating': 2,
        'helpful': False
    }
]

ARGS = {
    'dataset_path': dataset_path,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — 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
tokenize Ran
ran; our contract draft was wrong, not the code
tqzhong/cg4mctg/meta-mctg/ctrl_meta.py
code served (permissive licence) · get_code("59ac6441acc40e2e")
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 torch
from transformers import AutoTokenizer

# Create a mock tokenizer that has the encode method
class MockTokenizer:
    def encode(self, text, max_length=None, truncation=False):
        # Return a simple list of token IDs
        words = text.split()
        tokens = [101] + [i % 1000 for i in range(len(words))] + [102]
        if max_length and truncation:
            tokens = tokens[:max_length]
        return tokens

# Create sample dataset with review and attribute keys
dataset_path = [
    {
        'review': 'This product is amazing and works great',
        'rating': '5',
        'sentiment': 'positive'
    },
    {
        'review': 'Not satisfied with the quality',
        'rating': '2',
        'sentiment': 'negative'
    }
]

tokenizer = MockTokenizer()

ARGS = {
    'dataset_path': dataset_path,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm, transformers — 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
tokenize Ran
ran; our contract draft was wrong, not the code
tqzhong/cg4mctg/meta-mctg/dcg_meta.py
code served (permissive licence) · get_code("6c3ca0db0954ed64")
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 torch
from transformers import AutoTokenizer

# Create a minimal tokenizer stand-in that implements the required methods
class MockTokenizer:
    def encode(self, text, max_length=None, truncation=False):
        # Return a list of token IDs
        # Simulate tokenization by returning a small list of integers
        tokens = [101, 2054, 2003, 1045, 102]  # Simulated token IDs
        if max_length and len(tokens) > max_length:
            tokens = tokens[:max_length]
        return tokens

# Create sample dataset
dataset_path = [
    {
        "review": "This product is great and I love it",
        "sentiment": "positive",
        "pronoun": "singular",
        "tense": "past"
    },
    {
        "review": "Not happy with this purchase at all",
        "sentiment": "negative",
        "pronoun": "singular",
        "tense": "present"
    }
]

tokenizer = MockTokenizer()

ARGS = {
    "dataset_path": dataset_path,
    "tokenizer": tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm, transformers — 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

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 7 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 7 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

Compositional generalization, representing the model's ability to generate text with new attribute combinations obtained by recombining single attributes from the training data, is a crucial property for multi-aspect controllable text generation (MCTG) methods. Nonetheless, a comprehensive compositional generalization evaluation benchmark of MCTG is still lacking. We propose CompMCTG, a benchmark encompassing diverse multi-aspect labeled datasets and a crafted three-dimensional evaluation protocol, to holistically evaluate the compositional generalization of MCTG approaches. We observe that existing MCTG works generally confront a noticeable performance drop in compositional testing. To mitigate this issue, we introduce Meta-MCTG, a training framework incorporating meta-learning, where we enable models to learn how to generalize by simulating compositional generalization scenarios in the training phase. We demonstrate the effectiveness of Meta-MCTG through achieving obvious improvement (by at most 3.64%) for compositional testing performance in 94.4% cases 1 .

For agents

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

get_harvested_code_for_paper("2404.04232")
get_code_for_paper("2404.04232")
have("2404.04232")

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

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

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

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

Connect an agent — have() is free.