SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.13892 · 2024

Adaptable Logical Control for Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

12 of 16 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 0 have no contract verdict; 11 failures of our instrument; 4 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/2406.13892.json · badge: /api/ran/2406.13892.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
joshuacnf/Ctrl-G canonical (classifier label)
classifier basis: census
12 ran · 4 no recorded run
FunctionStatusWhere it lives
Kmeans_faiss Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/distillation/lvd_hmm.py
code served (permissive licence) · get_code("d87a362a29e90f86")
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 Kmeans. 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
import faiss

torch.manual_seed(0)

# The function expects:
# - vecs: a numpy array with shape (num_vectors, dimension)
# - K: number of clusters (int)
# - max_iterations: max iterations for kmeans (int)
# - nredo: number of redo runs (int)
# - verbose: verbosity flag (bool)

# Create a small numpy array of vectors
# Shape: (8 vectors, 4 dimensions)
vecs = np.random.randn(8, 4).astype(np.float32)

# Number of clusters
K = 2

# Max iterations
max_iterations = 100

# Number of redo runs
nredo = 1

# Verbose flag
verbose = False

ARGS = {
    "vecs": vecs,
    "K": K,
    "max_iterations": max_iterations,
    "nredo": nredo,
    "verbose": verbose
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
faiss, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Kmeans — a Kmeans output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Kmeans 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
Kmeans_faiss Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/distillation_vllm/lvd_hmm.py
code served (permissive licence) · get_code("72da812259d684ba")
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 Kmeans. 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
import faiss

torch.manual_seed(0)

# Create small test vectors
# The function expects vecs to be a 2D array with shape (num_vectors, dimension)
# We'll create 8 vectors of dimension 4
num_vectors = 8
dimension = 4
vecs = np.random.randn(num_vectors, dimension).astype(np.float32)

# Define parameters
K = 2  # number of clusters
max_iterations = 10
nredo = 1
verbose = True

ARGS = {
    'vecs': vecs,
    'K': K,
    'max_iterations': max_iterations,
    'nredo': nredo,
    'verbose': verbose
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
faiss, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Kmeans — a Kmeans output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Kmeans 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
apply_dropout Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/distillation/train_hmm.py
code served (permissive licence) · get_code("f3b4273175d620c9")
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 int, 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)

# Construct arguments for apply_dropout
input_ids = torch.randint(0, 100, (2, 4))  # batch_size=2, seq_len=4
dropout = 0.5
vocab_size = 100
eos_token_id = 50

ARGS = {
    "input_ids": input_ids,
    "dropout": dropout,
    "vocab_size": vocab_size,
    "eos_token_id": eos_token_id
}
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 int, 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
edges2G Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/ctrlg/dfa.py
code served (permissive licence) · get_code("bb87328692c74c6b")
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 edges2G function
# The function takes edges (an iterable of tuples) and reverse (bool)
# Each edge is a tuple of (u, v, transition)
# where u and v are node identifiers and transition is something with len()

edges = [
    ("node_a", "node_b", "transition_1"),
    ("node_b", "node_c", "transition_2"),
    ("node_a", "node_d", ""),
    ("node_c", "node_a", "transition_3"),
]

reverse = False

ARGS = {
    "edges": edges,
    "reverse": reverse,
}
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
edges2states Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/ctrlg/dfa.py
code served (permissive licence) · get_code("e52f469bbbb24e15")
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 set. 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

ARGS = {
    "edges": [
        (0, 1, {"weight": 0.5}),
        (1, 2, {"weight": 0.3}),
        (2, 0, {"weight": 0.7}),
    ]
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
ib_ib_bj_to_ij Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/ctrlg/hmm.py
code served (permissive licence) · get_code("d8085015685ae53f")
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 (4, 5) 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 small tensors matching the function signature
# pf: shape (i, b) - ratio numerator
# pp: shape (i, b) - log probabilities or similar
# cp: shape (b, j) - log probabilities or similar

batch_size = 2
i_dim = 4
b_dim = 3
j_dim = 5

pf = torch.randn(i_dim, b_dim)
pp = torch.randn(i_dim, b_dim)
cp = torch.randn(b_dim, j_dim)

ARGS = {
    "pf": pf,
    "pp": pp,
    "cp": cp,
}
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 (4, 5) — shape (4, 5) 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
load_examples Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/distillation/lvd_hmm.py
code served (permissive licence) · get_code("89f1bdb63107dedb")
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 tempfile
import os

torch.manual_seed(0)

# Create temporary files for sequences and embeddings
temp_dir = tempfile.mkdtemp()
sequences_file = os.path.join(temp_dir, 'sequences.pt')
embeddings_file = os.path.join(temp_dir, 'embeddings.pt')

# Create small test data
# sequences: 2 sequences, each with 3 tokens
sequences = [[0, 1, 2], [3, 4, 5]]
torch.save(torch.tensor(sequences), sequences_file)

# embeddings: shape (2, 3, 4) - 2 sequences, 3 tokens per sequence, 4-dim embeddings
embeddings = torch.randn(2, 3, 4)
torch.save(embeddings, embeddings_file)

# eos_token_id: a token ID that marks end of sequence (use 99, not in our data)
eos_token_id = 99

ARGS = {
    'sequences_file': sequences_file,
    'embeddings_file': embeddings_file,
    'eos_token_id': eos_token_id
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — 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
load_examples Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/distillation_vllm/lvd_hmm.py
code served (permissive licence) · get_code("d7065ff3317ecdf8")
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 os
import torch
import tempfile

torch.manual_seed(0)

# Create temporary directory for test files
tmpdir = tempfile.mkdtemp()

# Create sequences tensor: shape (2, 5) - 2 sequences of length 5
sequences = torch.tensor([
    [0, 1, 2, 3, 4],
    [5, 6, 3, 7, 8]
], dtype=torch.long)
sequences_file = os.path.join(tmpdir, "sequences.pt")
torch.save(sequences, sequences_file)

# Create embeddings tensor: shape (2, 5, 4) - 2 sequences, 5 tokens each, embedding dim 4
embeddings = torch.randn(2, 5, 4, dtype=torch.float32)
embeddings_file = os.path.join(tmpdir, "embeddings.pt")
torch.save(embeddings, embeddings_file)

# eos_token_id is the token that marks end of sequence
eos_token_id = 3

ARGS = {
    "sequences_file": sequences_file,
    "embeddings_file": embeddings_file,
    "eos_token_id": eos_token_id,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
safetensors, torch, tqdm — 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
matmul Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/ctrlg/hmm.py
code served (permissive licence) · get_code("28f9792482ba813f")
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, 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

torch.manual_seed(0)

# Create two small tensors for matrix multiplication
A = torch.randn(2, 4)
B = torch.randn(4, 3)

ARGS = {
    "A": A,
    "B": B,
}
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, 3) — shape (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
pad_to_len Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
joshuacnf/Ctrl-G/distillation/sample_data.py
code served (permissive licence) · get_code("8eed124e6d6f4c9b")
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 int, shape (2, 5) 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)

# Construct arguments for pad_to_len
# x: a 2D tensor (batch_size, seq_len)
# d: target length to pad to
# eos_token_id: token id to use for padding

x = torch.randint(0, 100, (2, 3), dtype=torch.long)  # batch_size=2, current_seq_len=3
d = 5  # target dimension (longer than current seq_len)
eos_token_id = 0  # common padding token

ARGS = {
    "x": x,
    "d": d,
    "eos_token_id": eos_token_id,
}
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 int, shape (2, 5) — shape (2, 5) 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
query_vllm Ran
ran, honoured the contract we drafted
joshuacnf/Ctrl-G/distillation_vllm/sample_data_instruct_vllm.py
code served (permissive licence) · get_code("9a7c043624eb97dd")
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 unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a mock client that simulates vLLM client behavior
client = Mock()

# Create mock completion choices with token_ids
choice1 = Mock()
choice1.token_ids = [101, 2054, 2003, 102]

choice2 = Mock()
choice2.token_ids = [101, 1045, 2572, 102]

# Create mock completion response
completion = Mock()
completion.choices = [choice1, choice2]

# Mock the client.completions.create method
client.completions.create = Mock(return_value=completion)

# Create args object with required attributes
args = Mock()
args.model_name_or_path = "meta-llama/Llama-2-7b"
args.max_gen_tokens = 128
args.temperature = 0.7
args.top_p = 0.9
args.top_k = 50

# Define prompts - can be a single string or list of strings
prompts = "What is the meaning of life?"

# Define stop tokens
stop_token_list = ["</s>", "[END]"]

# Define eos token id
eos_token_id = 102

ARGS = {
    "client": client,
    "prompts": prompts,
    "args": args,
    "stop_token_list": stop_token_list,
    "eos_token_id": eos_token_id
}
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 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
set2npset Ran
ran; our contract draft was wrong, not the code
joshuacnf/Ctrl-G/ctrlg/dfa.py
code served (permissive licence) · get_code("7ace1653104977b0")
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 float, shape (5,) 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 = {
    "A": [0, 2, 4, 1],
    "n": 5
}
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 float, shape (5,) — shape (5,) 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
init_client_and_tokenizer Not yet run
unverified (harvested, no recorded run)
joshuacnf/Ctrl-G/distillation_vllm/sample_data_instruct_vllm.py
code served (permissive licence) · get_code("6d7012aee1b0a90c")
How it ran

no invocation recorded.

logsumexp Not yet run
unverified (harvested, no recorded run)
joshuacnf/Ctrl-G/ctrlg/utils.py
code served (permissive licence) · get_code("d3a5928db0c06ba7")
How it ran

no invocation recorded.

matmul_log Not yet run
unverified (harvested, no recorded run)
joshuacnf/Ctrl-G/ctrlg/utils.py
code served (permissive licence) · get_code("5b8c472909c8aefc")
How it ran

no invocation recorded.

matmul_loga_b Not yet run
unverified (harvested, no recorded run)
joshuacnf/Ctrl-G/ctrlg/utils.py
code served (permissive licence) · get_code("506618569fa81eba")
How it ran

no invocation recorded.

Also present in other papers' code

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

Despite the success of Large Language Models (LLMs) on various tasks following human instructions, controlling model generation at inference time poses a persistent challenge. In this paper, we introduce Ctrl-G, an adaptable framework that facilitates tractable and flexible control of LLM generation to reliably follow logical constraints. Ctrl-G combines any production-ready LLM with a Hidden Markov Model, enabling LLM outputs to adhere to logical constraints represented as deterministic finite automata. We show that Ctrl-G, when applied to a TULU2-7B model, outperforms GPT3.5 and GPT4 on the task of interactive text editing: specifically, for the task of generating text insertions/continuations following logical constraints, Ctrl-G achieves over 30% higher satisfaction rate in human evaluation compared to GPT4. When applied to medium-size language models (e.g., GPT2-large), Ctrl-G also beats its counterparts for constrained generation by large margins on standard benchmarks. Additionally, as a proof-of-concept study, we experiment Ctrl-G on the Grade School Math benchmark to assist LLM reasoning, foreshadowing the application of Ctrl-G, as well as other constrained generation approaches, beyond traditional language generation tasks.

For agents

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

get_harvested_code_for_paper("2406.13892")
get_code_for_paper("2406.13892")
have("2406.13892")

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

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

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

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

Connect an agent — have() is free.