wikillm

Concept · 1 paper · updated 2026-10-18

Constrained conditional models

Structured prediction by training several simple local classifiers independently and combining their scores at inference time, under hard constraints on the output (e.g. a positive answer, an integer answer) enforced by a beam search. Needs little jointly annotated data; the trade-offs are a heuristic search and a constraint check that can silently fall back to an infeasible-looking output.

structured-predictionconstrained-inferencebeam-searchmath-word-problems

Markdown4 min read

AI-compiled overview, updated 2026-10-18, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

Overview

Some outputs are structures made of parts that depend on each other, such as an expression tree built from numbers in a text. Training one model for the whole structure needs jointly annotated data, which is expensive. Constrained conditional models (CCMs) take a different route: several simple components are learned independently, and the structure is chosen at inference time by combining their scores while respecting constraints on the output. The paper under this page uses the "L+I" scheme of CCMs, which learns independent local components and combines them at inference 1608.01413 §2. The authors cite the general CCM framework to Chang et al. (2012); no card exists for that paper, so this page draws only on the 1608.01413 card.

The invariant the variants share is that the final output must satisfy the constraints, and that the local scores are summed over the parts of that output. The paper's objective is a weighted sum of relevance scores for unused quantities and pairwise scores for used quantities, maximised over the expressions that pass the constraints 1608.01413 §4.1 eq. 3.

Variants

Independent local classifiers with a beam search (1608.01413)

Two classifiers are trained separately on gold annotations: a binary SVM that scores whether each quantity is needed, and a multiclass SVM that scores the operation at the lowest common ancestor of each quantity pair 1608.01413 §4.3 1608.01413 §4.4. Inference is a bottom-up beam search with beam size k = 200 that keeps the top candidates at each step and returns the best tree passing the constraints [arxiv:1608.01413 §4.1]. Card: Solving General Arithmetic Word Problems.

The paper's constraints are a positive answer and, for "how many" questions, an integral answer 1608.01413 §4.1. The paper reports accuracy for each constraint on its own and for both together, on three datasets:

SettingAI2ILCommoncoreSource
No constraint77.771.929.6tab. 6
Positive constraint only78.072.536.5tab. 6
Integral constraint only71.873.439.0tab. 6
Both constraints72.073.945.2tab. 6

These are the authors' numbers, on their own dataset versions [arxiv:1608.01413 §5.1]. The table shows that the effect of a constraint depends on the dataset.

When to use which

The only variant in the wiki so far is the one above, so the choice here is about whether the CCM pattern fits your problem. The constraints that the paper actually used are the ones you can check directly on a candidate output. Use this pattern when:

SituationUseWhy
Few jointly annotated structures, but per-part labels existIndependent local classifiers combined at inferenceThe paper trains each component on its own gold labels and uses no joint training 1608.01413 §4
Output must obey simple, checkable rules (sign, integrality)Hard constraints checked during searchConstraints lifted the full system above the no-constraint baseline on IL and Commoncore tab. 6
Candidate space is small enough for a beamBeam search with a fixed kThe paper uses k = 200 over expression trees 1608.01413 §4.1
Constraints are not known to help on your dataMeasure each constraint separatelyOn AI2 the integral constraint lowered accuracy from 77.7 to 71.8, and the full system scored 72.0 tab. 6
Parts strongly depend on each otherNot covered by this cardThe paper's score sums local terms over parts; it reports no test of strong dependence between them 1608.01413 §4.1

Do not expect the pattern to remove the need for good features. The paper's error analysis attributes most errors to the quantity-schema extraction step, which feeds the classifiers 1608.01413 §5.5.

Implementation sketch

Language-agnostic pseudocode of the common core. The paper's variant uses SVMs and an expression tree; the other parts are generic.

Pseudocode
# Train each local component on its own gold labels  [arxiv:1608.01413 §4]
relevance_model = train_binary(quantities, gold_relevance)
pair_model = train_multiclass(quantity_pairs, gold_lca_label)

# At inference, score every part of a candidate structure  [arxiv:1608.01413 §4.1]
def score(candidate):
    # Sum local scores over the parts of the candidate  [eq. 3]
    return (w_rel * sum(relevance_model.score(q) for q in unused(candidate))
            + sum(pair_model.score(p) for p in pairs(candidate)))

# Hard constraints, checked on the candidate  [arxiv:1608.01413 §4.1]
def feasible(candidate):
    # Positive answer
    if candidate.value < 0:
        return False
    # Integral answer, only when the question asks "how many"
    if is_how_many(question) and not is_integer(candidate.value):
        return False
    return True

# Beam search over partial structures, keeping the top k  [arxiv:1608.01413 §4.1]
beam = [empty_structure()]
while not all(s.is_complete() for s in beam):
    expanded = [t for s in beam for t in s.extensions()]
    beam = top_k(expanded, k=200, key=score)

# Return the best feasible structure; if none is feasible, the paper
# falls back to the top of the beam  [arxiv:1608.01413 §4.1]
feasible_ones = [s for s in beam if feasible(s)]
best = max(feasible_ones, key=score) if feasible_ones else beam[0]

Where variants differ: the scoring of partial structures inside the beam is not stated in the paper, so the top_k key above is a choice you must make 1608.01413 §4.1.

Contradictions

None known across the cards: only one card currently cites this concept. Within the single paper, the constraints do not help on every dataset: on AI2 the no-constraint baseline (77.7) is above the full system (72.0), while on IL and Commoncore the full system is the best result tab. 6. The authors report the AI2 gain for the positive constraint alone (78.0) as the best AI2 number, not the full system 1608.01413 §5.4.

Papers

Source and license

Compiled from the papers listed on this page, all published under CC BY, CC BY-SA or CC0, with citations. See each paper's page for its authors and license.