SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2401.06877 · NAACL · 2024

Promptly Predicting Structures: The Return of Inference

Valentina Pyatkin, Vivek Srikumar, Maitrey Mehta

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 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/2401.06877.json · badge: /api/ran/2401.06877.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
utahnlp/prompts-for-structures canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
add_parser_args Ran
ran; our contract draft was wrong, not the code
utahnlp/prompts-for-structures/src/model.py
code served (permissive licence) · get_code("571a600006c3487b")
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 ArgumentParser. 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 argparse

def setup():
    parser = argparse.ArgumentParser()
    
    ARGS = {
        'parser': parser
    }
    
    return ARGS

ARGS = setup()
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 ArgumentParser — a ArgumentParser output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ArgumentParser 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
build_prompt Ran
ran; our contract draft was wrong, not the code
utahnlp/prompts-for-structures/src/tasks/srl/qasrl2/prompts.py
code served (permissive licence) · get_code("c050aaa66fbc820f")
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
import numpy as np

class Config:
    def __init__(self, model):
        self.model = model

class Row:
    def __init__(self, question, sentence):
        self.question = question
        self.sentence = sentence
    
    def __getitem__(self, key):
        if key == 'question':
            return self.question
        elif key == 'sentence':
            return self.sentence

# Test with a T5 model variant
config_t5 = Config('t5')
row_t5 = {
    'question': 'What is the capital of France?',
    'sentence': ['Paris', 'is', 'the', 'capital', 'of', 'France', 'and', 'is', 'located', 'in', 'northern', 'France'] * 30  # Create a list longer than 300 words
}

ARGS = {
    'config': config_t5,
    'row': row_t5
}
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 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
find_optimal_path Ran
ran; our contract draft was wrong, not the code
utahnlp/prompts-for-structures/src/graph.py
code served (permissive licence) · get_code("24e8e9488cb47201")
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 networkx as nx

# Create a small graph with labeled edges
gr = nx.DiGraph()

# Add edges with labels
# The function accesses gr.edges[u, v]['label']
gr.add_edge(0, 1, label='1')
gr.add_edge(1, 2, label='2')
gr.add_edge(2, 3, label='O')
gr.add_edge(3, 4, label='1')

gr.add_edge(0, 5, label='O')
gr.add_edge(5, 6, label='1')
gr.add_edge(6, 7, label='2')

# Create paths - lists of node indices
# The function iterates through paths and checks edges between consecutive nodes
paths = [
    [0, 1, 2, 3, 4],  # Path 1: labels are '1', '2', 'O', '1' -> counter = [2, 1, 0]
    [0, 5, 6, 7],     # Path 2: labels are 'O', '1', '2' -> counter = [1, 1, 0]
]

# num_ques is the number of questions/categories
# Based on the function, valid = [1] * num_ques
# The function checks if counter == valid
# So we need valid to equal one of the counters we can construct
num_ques = 3

ARGS = {
    'paths': paths,
    'gr': gr,
    'num_ques': num_ques,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — 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
get_few_shot Ran
ran; our contract draft was wrong, not the code
utahnlp/prompts-for-structures/src/tasks/srl/qasrl2/prompts.py
code served (permissive licence) · get_code("53b61dce974746e1")
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 pandas as pd
from itertools import permutations

class Config:
    def __init__(self):
        self.model = 't5'
        self.shot_type = 'same'
        self.num_shots = 3
        self.shot_seed = 42
        self.order_num = 1

few_shot_data = {
    'sentence': [
        ['The', 'cat', 'sat', 'on', 'the', 'mat'],
        ['Dogs', 'are', 'loyal', 'animals'],
        ['Birds', 'can', 'fly', 'high', 'in', 'the', 'sky'],
        ['Fish', 'swim', 'in', 'water'],
        ['Elephants', 'are', 'large', 'mammals']
    ],
    'question': [
        'What did the cat do?',
        'What are dogs?',
        'What can birds do?',
        'Where do fish live?',
        'What are elephants?'
    ],
    'answer': [
        'The cat sat on the mat.',
        'Dogs are loyal animals.',
        'Birds can fly high.',
        'Fish live in water.',
        'Elephants are large mammals.'
    ]
}

few_shot_df = pd.DataFrame(few_shot_data)

config = Config()

ARGS = {
    'few_shot_df': few_shot_df,
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
subseq_match Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
utahnlp/prompts-for-structures/src/graph.py
code served (permissive licence) · get_code("9102856265c82533")
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

torch.manual_seed(0)

# The function subseq_match takes two parameters:
# - subseq: a sequence to search for (appears to be a list)
# - sent: a sentence/sequence to search in (appears to be a list)
# The function checks if subseq appears as a contiguous subsequence in sent

ARGS = {
    "subseq": [1, 2, 3],
    "sent": [0, 1, 2, 3, 4, 1, 2, 3, 5]
}
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 — 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
yens_ksp Ran
ran; our contract draft was wrong, not the code
utahnlp/prompts-for-structures/src/graph.py
code served (permissive licence) · get_code("6209c23f197fcf2c")
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.

from copy import deepcopy

class Node:
    def __init__(self, node_id):
        self.id = node_id
    
    def __eq__(self, other):
        if isinstance(other, Node):
            return self.id == other.id
        return False
    
    def __hash__(self):
        return hash(self.id)
    
    def __repr__(self):
        return f"Node({self.id})"
    
    def __getitem__(self, index):
        if index == 0:
            return self.id
        raise IndexError("Node only supports index 0")

class Graph:
    def __init__(self, edges, weights):
        self.edges = edges
        self.weights = weights
        self.nodes = set()
        for u, v in edges:
            self.nodes.add(u)
            self.nodes.add(v)
    
    def shortestpath(self, source):
        visited = set()
        distances = {node: float('inf') for node in self.nodes}
        distances[source] = 0
        parent = {node: None for node in self.nodes}
        
        for _ in range(len(self.nodes)):
            current = min((n for n in self.nodes if n not in visited), 
                         key=lambda n: distances[n], default=None)
            if current is None or distances[current] == float('inf'):
                break
            visited.add(current)
            
            for i, (u, v) in enumerate(self.edges):
                if u == current and v not in visited:
                    new_dist = distances[current] + self.weights[i]
                    if new_dist < distances[v]:
                        distances[v] = new_dist
                        parent[v] = current
        
        destination = max(self.nodes, key=lambda n: distances[n])
        if distances[destination] == float('inf'):
            return None, float('inf')
        
        path = []
        current = destination
        while current is not None:
            path.append(current)
            current = parent[current]
        path.reverse()
        
        return path, distances[destination]
    
    def calc_dist(self, path):
        if len(path) <= 1:
            return 0
        total = 0
        for i in range(len(path) - 1):
            for j, (u, v) in enumerate(self.edges):
                if u == path[i] and v == path[i + 1]:
                    total += self.weights[j]
                    break
        return total
    
    def remove_edge(self, u, v):
        self.edges = [(a, b) for a, b in self.edges if not (a == u and b == v)]
        self.weights = [w for (a, b), w in zip(self.edges, self.weights) 
                       if not (a == u and b == v)]
    
    def remove_node(self, node):
        self.edges = [(u, v) for u, v in self.edges if u != node and v != node]
        self.weights = [w for (u, v), w in zip(self.edges, self.weights) 
                       if u != node and v != node]
        self.nodes.discard(node)

n0 = Node(0)
n1 = Node(1)
n2 = Node(2)
n3 = Node(3)

edges = [(n0, n1), (n1, n2), (n2, n3), (n0, n2), (n1, n3)]
weights = [1.0, 2.0, 1.5, 3.0, 2.5]

g = Graph(edges, weights)

ARGS = {
    'g': g,
    'source': n0,
    'dest': n3,
    'K': 3
}
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 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

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, 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 6 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

Prompt-based methods have been used extensively across NLP to build zero-and few-shot label predictors. Many NLP tasks are naturally structured: that is, their outputs consist of multiple labels which constrain each other. Annotating data for such tasks can be cumbersome. Can the promise of the prompt-based paradigm be extended to such structured outputs? In this paper, we present a framework for constructing zero-and few-shot linguistic structure predictors. Our key insight is that we can use structural constraints-and combinatorial inference derived from them-to filter out inconsistent structures predicted by large language models. We instantiated this framework on two structured prediction tasks, and five datasets. Across all cases, our results show that enforcing consistency not only constructs structurally valid outputs, but also improves performance over the unconstrained variants.

For agents

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

get_harvested_code_for_paper("2401.06877")
get_code_for_paper("2401.06877")
have("2401.06877")

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

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

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

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

Connect an agent — have() is free.