Elamur Research

Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generation

Paper · 2024 · Luca Beurer-Kellner, Marc Fischer and Martin Vechev

Summary

An answer can be easy for a person to read and awkward for software to use. If another program expects JSON, an extra sentence after the closing brace can make an otherwise correct answer unusable. Constrained decoding addresses that problem by checking each proposed continuation against a formal specification. The difficulty is that a large language model writes in vocabulary tokens, and a single token can contain characters that belong to several parts of the specification. A token containing both a space and an opening quotation mark, for example, can be a perfectly good way to continue a JSON object. A decoder that checks only the next grammar terminal can mistakenly rule it out. That changes the token history on which subsequent choices depend, with consequences for the answer as well as its formatting.

The authors call a decoder minimally invasive if it preserves the ability to produce any valid output that unconstrained decoding can produce from the same prompt. Their algorithm, DOMINO, applies this principle to context-free grammars. Before generation, it records how vocabulary tokens can traverse the grammar’s terminal patterns, including paths that begin or end partway through a terminal. During generation, a parser uses the current grammar state to determine which of those paths are legal. Full lookahead preserves valid tokens that cross terminal boundaries. The same infrastructure supports two speed optimizations. Opportunistic masking checks the token already proposed before building a complete mask. Speculative decoding uses past observations of grammar states to propose several upcoming tokens for verification together.

For JSON-formatted answers on GSM8K, five-shot accuracy with Mistral 7B was 41.5% without enforcement, 30.8% with naive enforcement, and 41.8% with minimally invasive decoding. The evaluation also covers named-entity recognition on CoNLL-2003 and uses Llama-2 13B as well as Mistral. Standard Guidance templates lost up to 11 percentage points of task accuracy relative to unconstrained decoding. In a separate formatting example, Guidance outputs had perplexities of 24.50–26.75, against 4.17 for unconstrained output. Perplexity measures how surprising a token sequence is to the system that scores it. The accuracy tests establish the practical cost that the perplexity example helps explain.

In the task evaluation, DOMINO reached up to 2.71× unconstrained throughput, and standard Guidance reached up to 2.02×. The speed results depended on the grammar. In the broader efficiency tests, predictable structure supported gains of up to 77% over unconstrained throughput. For free-form JSON, checking the proposed token first worked better than speculation and incurred about 4.21% overhead. The tested C grammar remained costly, with relative throughput of 0.78× for DOMINO and 0.74× for llama.cpp. These are generation-time measurements for grammars known in advance. The paper reports 1-5s of precomputation for most of its grammars and around 20s for C.

Deep dive: Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generation

DOMINO enforces output grammars while preserving valid subword tokens, helping structured generation retain task accuracy and improve throughput. · about 37 minutes to read

The problem and its context

Why a prompt leaves work for the next program

A prompt can ask for an object, an answer field, or a particular arrangement of tags. The request becomes an instruction in the same text from which the continuation is predicted. A downstream program has a different kind of requirement. It needs to know which characters will mark the beginning of a value and how the value will end. An explanatory sentence can be helpful in conversation and still break the contract between the generator and the program that receives its answer. When the format is part of that contract, checking the completed text can leave the receiving system with the work of repairing it, extracting a usable fragment, or asking again.

Constrained decoding moves the check into text generation. At each step, the decoder finds which vocabulary entries can extend the part it has already emitted. A mask marks or disables the entries that fail the check. The next token is then chosen from the available entries by the decoding rule, which might select the highest-scoring entry or sample from a distribution. As the output grows, the allowed set changes. A colon can be appropriate after an object key, for instance, and inappropriate at a position where the grammar expects the start of a value.

A syntactic constraint can preserve room for substantial choices. A JSON object might be required to contain a numerical answer, but the grammar can leave the number open. A list of tagged words can have a known structure while leaving the labels to be predicted. A regular expression may be enough for a fixed pattern. A grammar can describe nested objects or lists and distinguish a quotation mark that begins a string from one that ends it. Templates can prescribe long stretches of literal text and leave selected gaps open to generation. The paper treats these formats as ways of deciding how much structure is fixed and what the generator can still choose.

The distinction matters because task accuracy and formal validity answer different questions. When a word problem is posed as a request for JSON, there is the question of whether a recipient can read the object and the question of whether the numerical answer is correct. Hard enforcement addresses the first by restricting the available continuations. Its effect on the second depends in part on which continuations it removes. The paper asks how to make that restriction reflect the intended grammar without accidentally imposing another restriction through the vocabulary.

The same text has two kinds of boundaries

Subword tokenization divides text into pieces drawn from a vocabulary. Those pieces may be smaller than a word, or they may include a word fragment and adjacent punctuation or whitespace. The paper names byte-pair encoding as a familiar source of these vocabularies. The generator sees a sequence of vocabulary entries, and the history of those entries is the input used to score what comes next. The grammar, by comparison, describes text in terms of terminals, such as the pattern for a number or the literal characters that surround a value.

These two ways of dividing the text serve different purposes. A terminal needs to identify a recognizable piece of a formal language. A vocabulary entry needs to represent a piece of text that the generator can use in many contexts. Accordingly, a token may end inside the digits of a number, contain an entire number, or combine the end of a value with punctuation that follows it. Those possibilities arise even in familiar formats whose grammar is easy to explain. The decoder must coordinate the two divisions each time it decides whether a candidate token is legal.

The paper’s opening example shows the issue with a space and a double quotation mark. The unconstrained continuation would use a vocabulary token containing both characters. A decoder that considers only tokens corresponding to the immediately expected terminal accepts a space by itself or a quotation mark by itself, yet can overlook the combined token. In the example, the resulting choice is a tab. The tab can satisfy the specification for whitespace, so the harm is invisible to a final syntax check. It appears in the history from which the rest of the object is generated. The authors refer to vocabulary entries that span terminal boundaries as bridge tokens.

A bridge token does not deserve blanket acceptance just because each of its component characters occurs in the language. The legal interpretation depends on where generation has reached. Punctuation immediately following a completed value can have a different role from the same punctuation inside a quoted string. To preserve a valid bridge, a decoder must recognize the sequence of terminals that the token can traverse from the current position. The resulting sequence must then be checked against the enclosing structure.

The authors identify an intervention at the moment the mask would remove the token that would otherwise have been chosen. A required intervention occurs when that token would take the output outside the permitted format. In the opening example, unconstrained decoding eventually continues past the completed JSON object with text that does not belong to it. The grammar can require an end-of-sequence token there. Earlier in the object, a space joined to a quotation mark can be legal and requires no such intervention. Minimal invasiveness is the paper’s way of separating these two cases.

What previous decoders could already do

Regular-expression constraints offer the simplest setting for inspecting the whole character string associated with a candidate. A regex recognizer can read the candidate in the same way it reads the existing prefix, including any punctuation or spaces it contains. The authors describe regex support in LMQL, Outlines, Guidance, and llama.cpp. They also point to the offline checking technique in Efficient Guided Generation for Large Language Models. If the pattern and vocabulary are known in advance, the transitions for vocabulary entries can be prepared before requests arrive.

Online parser-guided decoding extends the idea to richer grammars. The parser and scanner advance as tokens are generated, and the implementation checks which vocabulary entries can continue the output. The paper names PICARD, grammar-constrained decoding, and llama.cpp as examples of online approaches. It credits Synchromesh, in the setting of code generation, with showing that a parser-guided decoder can account for bridges. This establishes that terminal alignment is possible. It also exposes a computational problem. A system searching for every legal token online can face a vocabulary-wide check at each decoding step.

Templates take a different route to efficiency. They fix parts of the output in advance so that inference can concentrate on the open portions. In a schema-driven object, field names and their punctuation may be prescribed, while values are sampled subject to local constraints. The runtime can insert the tokens for the prescribed text directly and save forward passes. LMQL and Guidance use versions of this approach. The fixed pieces still need to be converted into vocabulary tokens, and a tokenizer operating on the template text can commit to boundaries that would have crossed into a generated portion if the system had made the choice itself.

Guidance’s token healing partly addresses this kind of boundary. In the version described by the paper, the prompt is shortened to the second-to-last token boundary and the removed text is required as a prefix of generation. The first generated token can then incorporate text on both sides of what had been a fixed boundary. That restores some opportunities to use a bridge. Many tokens in a template remain fixed, however, and the authors’ comparison of template tokenizations uses healing already. The motivation for DOMINO is to retain this flexibility throughout generation while keeping as much vocabulary analysis as possible out of the inference loop.

The method, step by step

From the output specification to the next token

DOMINO combines two ordinary components of parsing with an index over vocabulary tokens. The scanner, also called a lexer, recognizes characters that can belong to terminals. The parser tracks the productions that can account for those terminals in order. The index connects the two components to the generator’s vocabulary. It records what a token can do when started from a particular scanner position, including the terminal boundaries it can cross along the way.

Consider a grammar for simple expressions with integers, parentheses, and a plus sign. Recognizing the digit characters of an integer is a job for the scanner. Determining whether an open expression can now accept a plus sign or a closing parenthesis is a job for the parser. A vocabulary token that combines a plus sign and a digit contains evidence about both questions. The scanner can identify the transition from punctuation to a number. The parser must determine whether that transition is available in the expression currently being written. The method avoids repeating the first part of the analysis every time the same token occurs in the same scanner state.

Preparation begins with the terminal patterns. The algorithm builds a character-level scanner from them and tries the vocabulary from each scanner state. It records the possible paths in prefix trees, one tree per state. While text is generated, DOMINO advances the scanner and parser through the accepted output. It retrieves the trees for the scanner states that remain possible, follows the paths that the parser permits, and passes the associated token entries to the decoder.

How DOMINO builds and applies vocabulary masks

The steps in order.

How DOMINO builds and applies vocabulary masksStep 1: Build a scanner from grammar terminals1. Build a scanner from grammar terminalsStep 2: Trace vocabulary tokens from each scanner state2. Trace vocabulary tokens from each scanner stateStep 3: Group shared terminal paths in prefix trees3. Group shared terminal paths in prefix treesStep 4: Advance scanner and parser through generated text4. Advance scanner and parser through generated textStep 5: Check candidate paths against the parser state5. Check candidate paths against the parser stateStep 6: Allow vocabulary tokens reached by legal paths6. Allow vocabulary tokens reached by legal paths

The synchronization point is the accepted text. Precomputation learns what characters a particular vocabulary entry can contribute from a scanner state. Inference determines whether that contribution is appropriate now. If an entry could represent an identifier or a keyword, the index can retain both readings. If the current parser state allows one reading, the entry remains available. Once a token is chosen, the next check starts from the states consistent with what was actually emitted.

Describe the grammar and build the scanner

The paper starts with a formal language, a set of finite strings drawn from an alphabet. It uses L for such a set of strings and Σ for the alphabet of characters. A regular language can be expressed by a regular expression. A context-free grammar specifies a language through production rules, which describe how a named constituent can expand into terminals and other named constituents. The running example uses E for an expression and has terminals for an integer and literal punctuation.

A = α B γ

Here A is the nonterminal being expanded, and B is a nonterminal that can be expanded in turn. The terminal symbols α and γ stand for recognized pieces of the final text. The equals sign expresses the production, and adjacency gives the order of its parts. A parser tracking this rule can know that the production is in progress after α, with the expansion of B and the terminal γ still to come.

DOMINO assumes that the character pattern for each terminal can be recognized by a finite automaton. A nondeterministic finite automaton, or NFA, has a start state, a set of accepting states, and transitions. A character-labeled transition consumes the corresponding character. A transition labeled ε consumes the empty string and allows a change of state without reading a character. Because more than one transition can be possible, the scanner can keep several states active for the same text prefix. A terminal pattern accepts a character string if reading it can lead to an accepting state.

An accepting state can still permit more characters. The integer terminal in the running example recognizes positive integers without leading zeros and strings consisting of zeros. An accepted digit sequence can still be extended, subject to the branch of the pattern on which the scanner arrived. At a token boundary, then, the scanner may have reached a valid integer so far and still have to keep open the possibility that the next vocabulary entry contributes another digit to that same integer. Prematurely treating every token boundary as a terminal boundary would rule out that continuation.

The scanner combines the terminal recognizers into a single automaton. A shared start state connects to the terminal components, and a shared accepting state is reachable from their accepting states. The construction allows one terminal recognition to be followed by another and retains information about which component recognizes a span. The paper calls the common start state q₀ and the common accepting state qₐ. Each state within a component retains its association with the terminal pattern it belongs to. That association is what lets later steps describe a token’s path in terms the parser can use.

The paper formalizes the scanner’s scope with a regular expression for the available terminals, including an end marker.

rₑₒₛ = EOS

rₑₒₛ is the special pattern for the end of the output. EOS represents the end-of-sequence marker in this notation, and the equals sign identifies that marker as the pattern’s role.

r = r₁ | … | rₙ | rₑₒₛ

r is the combined terminal pattern. r₁ through rₙ are the regular expressions for the ordinary terminals of the grammar, with n denoting their number and the ellipsis standing for the intervening expressions. rₑₒₛ is the end pattern. Each vertical bar marks an alternative, and the equals sign defines r as their union.

R = r+

R is the pattern for a nonempty sequence of terminal matches. r is the union of terminal patterns, and + is the regular-expression operation that repeats the preceding pattern one or more times. The equals sign defines R. The preference for one terminal over another in a particular syntactic position is still to be determined by the parser.

L_G ⊆ L_R

G is the context-free grammar, and L_G is the language it describes. R is the regular expression for the sequence of terminal matches, and L_R is the language of strings matched by that expression. The subset sign ⊆ expresses that a legal output in the paper’s construction can be recognized as a sequence of these terminals.

L_R ⊈ L_G

L_R again denotes the scanner language, and L_G denotes the language of the grammar. ⊈ means that some strings accepted as terminal sequences can fall outside the grammar. This is the situation the algorithm handles when the grammar imposes ordering or nesting beyond the terminal patterns. For example, a scanner can recognize punctuation simply because it has a recognizer for that punctuation. The parser gives it a role in a complete expression. The paper presents the construction for nonempty terminal sequences, with an explicit end marker.

Record incomplete terminals and bridges

To connect this scanner to the vocabulary, DOMINO starts at each scanner state and tries reading each token’s characters. It records the different ways that reading can proceed, paying particular attention to when it enters or completes a terminal. The record is called a subterminal sequence. A subterminal describes progress through a terminal recognizer. It need not be a vocabulary token or an independently meaningful string.

The paper distinguishes four situations. A full terminal is traversed from its beginning to an accepting state. If that state also admits additional characters, the scanner can still keep open the possibility of extending the terminal. A start subterminal enters a terminal and stops at a viable position before acceptance. An end subterminal starts inside a terminal and reaches acceptance. A continuation subterminal advances within the terminal and stops at another nonaccepting position. These distinctions let the algorithm describe what happens when a token begins in one terminal and ends in another, as well as when a long terminal is spread across several tokens.

The vocabulary entry being analyzed is written as τ below. This is also the token symbol used for the speculation and retokenization explanations.

τ ∈ V

τ is a single vocabulary entry. V is the entire vocabulary, and ∈ means that the entry belongs to that vocabulary. During preparation, DOMINO performs the scanner analysis for each such entry from each relevant state.

{(α₁ʲ, …, αₘⱼʲ)}ⱼ

This notation represents the possible subterminal sequences for a token from a scanner state. The braces collect the paths, and j indexes an alternative path. The sequence for that path starts with α₁ʲ and ends with αₘⱼʲ, where mⱼ is the number of subterminal steps along path j. The ellipsis stands for steps between the first and last entries. Each α with indices describes one position in the terminal analysis of that path. No sequence is added for an entry that cannot be read from the state in question.

A token can have several paths when the terminal patterns overlap. In the paper’s C-like example, characters that form a keyword may also match the pattern for an identifier. The scanner can preserve these readings until the parser determines which one can occur. The same principle applies when a terminal can either finish now or extend into more characters. A scanner state therefore helps describe a particular point in a character-level analysis even when the generated prefix as a whole has several active states.

DOMINO organizes the sequences from a state into a prefix tree. A prefix tree shares a branch among paths that start with the same steps. Where a path accounts for an entire vocabulary entry, the corresponding node stores that entry. Distinct entries can be associated with paths that share an initial subterminal sequence. This lets the parser test a shared beginning once when searching for allowed tokens. If the grammar excludes that beginning, the whole branch can be pruned.

T_q

T designates a prefix tree, and the subscript q identifies the scanner state from which its paths were built. Inference looks up the tree for each active q. The association with a specific state is essential because the same vocabulary entry might finish a number from one state and start a new terminal from another. The tree contains the reusable analyses, while the parser contributes the context that changes from one output position to the next.

Apply the parser and choose the depth of the check

At inference time, the scanner and parser have read the generated prefix. The scanner can have several active states, each corresponding to a possible reading of those characters. The parser represents grammar productions that can account for the output so far. DOMINO retrieves the relevant trees and walks their branches in consultation with the parser. A branch remains available if its subterminal steps can legally continue the partial parse. A vocabulary entry can be kept if any of its reachable paths qualifies. The combined set from all the active scanner states forms the mask.

The paper uses the prefix (12 to illustrate the traversal. The digits have been read as part of an integer within a parenthesized expression. The scanner alone can recognize an opening parenthesis or the end marker among the available character patterns. The parser can reject those options in the current context. It can allow extensions of the integer and recognize a plus sign or closing parenthesis where appropriate. The same check can proceed farther through the tree to assess a vocabulary entry that spans a longer sequence of terminal steps.

k = 0

k is the lookahead parameter. The equals sign assigns its setting, and 0 is the setting that the paper illustrates by inspecting the first level of the tree. In the expression example, this level already admits the illustrated number tokens and the individual + and ) options. It limits which longer token paths can be reached.

k = 1

k again denotes lookahead. The equals sign sets it to 1, the deeper setting at which the paper’s tree example makes +1 available. The example is about finding a single vocabulary entry by checking the successive grammar steps represented within it.

k = 2

Here the same parameter is set to 2. The paper uses the illustrated token 1( to show an entry reached at this depth. The values describe depth in the subterminal tree. They do not measure characters in an entry or forward passes through the generator.

k = ∞

k still denotes lookahead, and the equals sign assigns it the value ∞, meaning that traversal is unrestricted by a depth cutoff. A finite setting that reaches every relevant path has the same role in this argument. With full traversal, every legal vocabulary entry represented by the scanner and parser becomes available to the decoder.

The authors argue that the shallow setting is already enough to enforce the grammar on a completed output. The risk of shallow traversal is exclusion of valid tokens. This separates soundness of the constraint from full coverage of the vocabulary. A mask may require that all its entries be legal and still omit a legal bridge. Such an omission can matter in spite of the availability of another way to spell the characters. The alternative spelling changes the sequence on which subsequent predictions are conditioned.

The guarantee for full traversal is about preserving a valid decoding path for the same prompt. If an unconstrained sequence would stay within the grammar and end legally, its next entry can be retained at each step along that path. When the unconstrained decoder wants to continue outside a completed object, enforcement can select a legal stop. The argument uses the same grammar state and the same vocabulary prefix to explain exactly where an intervention is required. Task accuracy and throughput are then separate empirical questions.

Check a likely token before constructing the whole mask

Ordinary masking computes the valid set before choosing a token. DOMINO can instead let the underlying decoder propose an entry and test that entry first. The authors call this opportunistic masking and credit llama.cpp with already using the idea in its online approach. When the proposed token is legal, DOMINO can accept it without computing the rest of the set. If it fails, the algorithm falls back to a complete mask for the decoding decision.

The tree index supports this test in the opposite direction to a full search. The algorithm looks up the nodes linked to the proposed token. It asks whether any of those nodes can be reached from the root along a path permitted by the current parser state. Should the token have several lexical readings, any valid reading suffices. The cost depends on the paths relevant to the proposal instead of all the vocabulary entries that might otherwise be considered.

This mode is controlled at runtime. Its advantage depends on how frequently the unmasked proposal is already grammatical and on the expense of building the complete mask. A format can have enough open choices to make future tokens hard to forecast while still being familiar enough that most individual proposals are acceptable. Opportunistic masking addresses that situation. It does not require a forecast several tokens into the future.

The paper also describes how token healing could handle the first boundary between prompt and generated text. The prompt can be cut back to a token boundary, with the removed text imposed by modifying the start of the grammar. Under this scheme, the resulting grammar has to be compiled for the current instance, which can limit reuse of its precomputation. The authors regard this as a smaller issue for DOMINO because the ordinary scanner and parser already account for cross-terminal tokens inside the generated portion.

Predict several tokens from the grammar state

The second optimization uses structured output to anticipate what comes next. In the earlier speculative sampling described by the paper, a smaller predictor proposes several tokens. A larger one evaluates them together, taking advantage of the parallelism of the Transformer. The verification can retain proposals that agree with the intended decoding behavior and discard rejected ones. DOMINO draws its guesses from a simpler source. It counts which tokens were selected at recurring scanner and parser states.

The scanner feature is largely determined by the most recently read subterminal. If the scanner has multiple active readings, the feature can reflect multiple subterminals. The parser feature is some summary of its state, such as the production currently in use. A frequently recurring pair of states can have a concentrated set of successors. A schema that repeatedly expects a known field can provide that kind of regularity, including when the precise characters are represented as a bridge.

P(τ ∣ α, β) = #{selections of τ at (α, β)} / #{visits to (α, β)}

P is the estimated conditional probability. τ is the proposed vocabulary entry, α is the scanner feature, and β is the parser feature. The vertical bar means “given,” and the comma groups the two conditioning features. The parentheses around α, β denote the joint state used in counting. # denotes a count, and the braces identify the observations being counted. The numerator counts visits at which τ was selected. The denominator counts all visits to the joint state. The slash divides the first count by the second, and the equals sign defines the estimate.

The estimate is fitted from generated examples. An entry can receive a high estimated probability because it occurred frequently in that state. The paper proposes predicting up to s tokens at a time, where s is the speculative block length, when the estimated probability is sufficiently high. The generator verifies the proposals in a forward pass. A missed prediction can be discarded. Speculation reduces work when the proposal stage correctly anticipates selections that would otherwise require separate decoding steps.

The grammar-based predictor learns from tokens chosen in constrained states. Its association between a token and a state thus comes from observed legal generation. The count table supplies candidates for verification, while scanner and parser checks still govern grammar acceptance. The paper also notes that this form of speculation can be combined with conventional speculation applied to the underlying generator. The evaluation isolates the grammar-based mechanism and uses warmup examples to form its counts, then freezes them during measurement.

Recover a preferred tokenization for comparison

The authors use a separate procedure to study fixed templates. They start with a target string, a tokenized prompt, and the next-token predictor. They mask the vocabulary to retain tokens that continue along the target text. From those entries, they greedily choose the one with the highest score, extend the token history, and repeat. This procedure keeps the characters of the target fixed while allowing the predictor to choose how to encode the remaining text at each step.

argmax

argmax is the operation that selects the argument with the greatest score. In this procedure, the argument is the next vocabulary entry among those compatible with the target text. The paper names s as the target string in this discussion, x as the tokenized prompt, f as the predictor, V as its vocabulary, and o as the resulting token sequence. The s used for the target string is local to the retokenization procedure. In speculative decoding, s denotes the number of tokens to propose.

The procedure gives a preferred segmentation in the sense of greedy decoding conditioned on the original prompt and restricted to generating the target. It measures the effect of changing the encoding while holding the character sequence fixed. Restoring the preferred encoding of a fixed template during ordinary inference would require scoring its tokens as they are generated. That would consume the forward passes that direct template insertion was designed to save. The diagnostic and the fast template runtime therefore have different computational requirements.

Experiments and results

Accuracy with structured answers

The evaluation asks whether a decoder can preserve downstream accuracy while making its output usable by software. GSM8K tests mathematical reasoning on word problems. CoNLL-2003 tests recognition and tagging of named entities. Both are adapted to require JSON answers. The task-accuracy table describes an evaluation on 400 test samples, with 5-shot prompting. For each dataset, the authors manually prepared JSON answers for demonstrations drawn from the training split. The prompts alternate a task input with its example answer before presenting the item to be completed.

The few-shot learning setup matters because the examples already communicate the desired format. The unconstrained run gets the same prompt and can imitate the JSON voluntarily. This baseline represents the result a practitioner could obtain from prompting alone, with the same inference backend. Turning on a hard constraint changes the way the continuation is selected. It does not add information to the input problem or change how the demonstrations were written.

The GSM8K grammar calls for an object with a thoughts list and a numerical answer. Each list entry has a description of a step, a textual calculation, and a numerical result. The list can include successive entries, so punctuation between objects is part of the route by which the generator can express a longer solution. For CoNLL-2003, the paper illustrates a tokens list whose objects pair the source token with a tag. The first setup tests structured answers that can contain intermediate calculations. The second tests a repeated record structure used to return a labeling decision.

The paper’s accuracy assessment considers both the validity of the JSON and the correctness of the response. An answer can lose credit because its structure fails or because the result read from it is wrong. The authors also measure perplexity and throughput. Perplexity describes the score given to the generated sequence, so the template example uses it to compare how expected different tokenizations and texts are. Accuracy asks whether the final response succeeds on the task. Throughput measures the rate of token generation and is also reported relative to the rate achieved without the constraint.

The comparisons use Mistral 7B and Llama-2 13B. The authors run experiments with the transformers and llama.cpp backends, on NVIDIA A100 40GB or H100 80GB GPUs. The baselines include unconstrained generation, conventional Guidance templates, whitespace-flexible Guidance variants, and the online EBNF grammar implementation in llama.cpp. The Guidance variants give a comparison between supplying fixed text and allowing more formatting to be generated. The online grammar implementation gives a comparison with an approach that performs its parser work during inference.

JSON-formatted GSM8K test accuracy with five-shot Mistral 7B

DOMINO preserves unconstrained accuracy, while naive enforcement lowers it.

JSON-formatted GSM8K test accuracy with five-shot Mistral 7BUnconstrained generation: 41.5Unconstrained generation41.5Naive constrained decoding: 30.8Naive constrained decoding30.8DOMINO, minimally invasive (this paper): 41.8DOMINO, minimally invasive (this paper)41.8
The numbers
System or settingaccuracy %
Unconstrained generation41.5
Naive constrained decoding30.8
DOMINO, minimally invasive (this paper)41.8

The GSM8K comparison is particularly informative because the format is already encouraged in the unconstrained prompt. On the five-shot task with Mistral 7B, naive enforcement yielded 30.8% accuracy against 41.5% without a hard constraint. Minimally invasive decoding reached 41.8%. The paper’s broader task results have the same overall direction for DOMINO. It reports the best accuracy among the evaluated decoders on both tasks, with scores matching or exceeding the corresponding unconstrained runs.

Standard Guidance showed a cost of up to 11 percentage points of task accuracy relative to unconstrained generation across the task comparisons. Its template acceleration still raised throughput, with a reported maximum of 2.02× the unconstrained rate. DOMINO reached up to 2.71× in that evaluation while retaining accuracy. These maxima describe the task comparisons and depend on their configurations. They need not identify the same task, grammar, or acceleration mechanism.

Whitespace-flexible Guidance restored part of the accuracy lost by fixed templates. Its relative throughput dropped to about 0.8×. Online parsing in llama.cpp also ran at about 0.8× in the task evaluation. The authors describe smaller signs of impaired accuracy there than in standard Guidance, with some effects still visible. Together these runs show why the evaluation has to include the syntax, the task result, and the time spent generating it. A faster checker can save time at the cost of changing the token sequence, and a more permissive treatment of formatting can give back some accuracy while requiring more generation work.

Throughput across grammars

The throughput study uses a wider range of output specifications than the task-accuracy study. It includes free-form JSON, JSON with a schema, XML with a schema, a grammar for a subset of C, and static layouts with restricted fields and values. The plain JSON prompts generally ask for an object describing a person. The XML workload uses a prescribed person structure with nested information, including a provision for friends. The fixed-template workload asks for a game character record. In the C workload, the prompts solicit small programs or functions.

What qualifies as free form depends on the workload. In the plain JSON grammar, the object can contain a variety of values and nested structures without a pre-defined list of keys. In the schema-driven cases, recognizable fields and punctuation recur in an expected order. The C subset has its own forms for declarations, statements, expressions, and comments. These all admit syntactically valid continuations, but the next-token choices can be much more predictable in some parts of a schema than in a piece of program text.

The authors describe 100 repetitions per efficiency configuration. In each run, they sample one of 5 prompts for the workload and generate up to 128 tokens at a temperature of 1.0. Temperature is the setting that shapes how sharply the vocabulary probabilities favor high-scoring entries before sampling. The prompts encourage text of the relevant kind even in the unconstrained run. The sampling setup lets that output vary across runs while keeping the comparison within a recognizable output distribution.

The efficiency measurements follow 10 warmup repetitions. These let the speculative component gather observations before timing starts. Its priors remain fixed during the timed runs. The paper normalizes throughput against unconstrained generation with the same underlying predictor and inference backend. For the accelerated DOMINO entry, it reports whichever of speculative decoding and opportunistic masking performs better for that workload. This comparison evaluates the practical choice of acceleration mode for a grammar.

Predictable, schema-driven structure is the favorable case for speculation. In the efficiency comparisons, the authors report gains up to 77% over the unconstrained rate. Producing a set sequence of delimiters and fields makes it more likely that several proposals will survive verification. In freer structures, the method can still benefit by checking the proposed token before doing the rest of the masking work. The paper treats the throughput improvements as results of those separate mechanisms, with different workload properties making each one effective.

Relative throughput for the tested C grammar

DOMINO with opportunistic masking has higher throughput than online grammar checking.

Relative throughput for the tested C grammarllama.cpp online parsing: 0.74llama.cpp online parsing0.74DOMINO opportunistic masking (this paper): 0.78DOMINO opportunistic masking (thispaper)0.78
The numbers
System or setting× unconstrained throughput
llama.cpp online parsing0.74
DOMINO opportunistic masking (this paper)0.78

The tested C grammar imposed the largest overhead in the efficiency comparison. The count-based predictor gave no benefit on that workload. With opportunistic masking, DOMINO ran at 0.78× the unconstrained throughput. Online grammar checking with llama.cpp ran at 0.74×. This gives a case where DOMINO reduces the relative cost of enforcing the grammar and generation remains slower than unconstrained decoding.

The construction cost sits outside these throughput measurements. The reported precomputation time is 1-5s for most tested grammars and around 20s for C. The experiments assume grammars are known before inference and reused across requests. The throughput numbers therefore describe the generation stage after the scanner and trees are available. For a workload that repeatedly invokes the same format, the separate preparation and runtime measurements show where the work is paid.

What the ablations show

A shallow mask can produce valid syntax and worse answers

The lookahead study varies the depth used to check candidate paths while retaining the GSM8K evaluation setup. This is a direct test of the proposed mechanism. The grammar expresses the same desired JSON structure throughout, but low lookahead makes some otherwise legal token paths unreachable. The authors report substantial task degradation at low settings and recovery at k = ∞. Full traversal slightly exceeds unconstrained accuracy in the reported comparison.

The authors inspected what changed in the outputs. Whitespace patterns became irregular when bridge tokens were unavailable. A vocabulary entry such as }, can complete one object and supply the separator that makes another object possible. Once the relevant bridges were removed, none of the Llama-2 outputs the study examined could list more than one object. This is a failure of the generation path seen in the experiment. The grammar still describes lists with multiple objects. The example shows how the restriction can change whether those structures are actually reached.

That distinction matters for the math task because the format has a place for multiple steps. A generator that takes a different path through the representation can provide a shorter or different solution, even though its final object is parseable. The authors’ observations supply a more specific explanation than a drop in the aggregate score alone. A grammar whose intended function is to organize the reasoning can, under an incomplete vocabulary mask, interfere with the token paths used to express successive steps.

The study compares different lookahead settings inside DOMINO, whereas the broader experiments compare different decoders. This within-method comparison helps tie the effect to bridge coverage. Increasing lookahead changes which valid multi-terminal token paths can be discovered. It preserves the task specification and the underlying vocabulary. The empirical recovery is consistent with the algorithm’s guarantee that full traversal can retain valid entries from the original decoding path.

Fixed text changes more than the amount of formatting work

The template analysis examines formatting in a complementary way. The authors compare standard Guidance outputs with alternatives that vary the presentation of a JSON template. They show that details such as whitespace can lead to different generated content. They also let the predictor generate the template’s prescribed text under the retokenization procedure. This isolates a choice often made outside the decoding loop, namely which vocabulary entries will represent a fixed span.

In the paper’s Mistral example, template-based outputs had perplexities in the range 24.50–26.75. The output from unconstrained generation had perplexity 4.17. Retokenizing the full template-based result under the predictor’s preferred segmentation produced perplexity 49.39. That last test keeps the final text and asks how the system would greedily tokenize it if restricted to those characters. The high value is compatible with the authors’ explanation that early forced tokens influence later choices, leaving a completed text that is surprising when approached through a different token history.

The comparison tests complementary aspects of the same process. Holding the template’s text fixed while allowing the generator to encode it probes the token boundaries imposed by external insertion. Retokenizing the entire output probes the interaction between those boundaries and the content that was ultimately generated. This gives the perplexity measurements an interpretive role. Task correctness still comes from the separate benchmark tests, where a wrong result has a concrete definition.

The whitespace-flexible programs provide another intervention on the template. They replace fixed spacing with clauses that let the system emit spaces or newlines in the specified positions. Field layout and restrictions on values can still be prescribed. In the accuracy evaluation, this change restored some of the loss incurred by standard Guidance. The runtime also had to generate the whitespace itself, which reduced the number of tokens that could be inserted without a forward pass. The comparison links the gain from faster template execution to the particular decisions the runtime takes away from generation.

Token healing was already present in the template comparison. Healing can reopen a boundary between a fixed span and the next generated span. The observed differences in content and perplexity show why that local repair leaves room for improvement. The encoding of the rest of the template can still be fixed, and the generated history includes those tokens. DOMINO addresses the issue at each terminal boundary through scanner paths and grammar checks.

Speculation and proposal checking favor different workloads

The speculation study uses Mistral 7B with the transformers backend. It compares schema-driven JSON and free-form JSON, varying how many tokens are proposed at a time. The authors form the priors on 10 random samples, then measure the mean over 100 generated outputs per configuration. The counts are held fixed during those measurements. This tests the utility of prior observations for new outputs without the benefit of continually adding the timed requests to the predictor.

s ∈ {6, 8, 10}

s is the number of speculative tokens the decoder can propose together. ∈ means that the tested setting belongs to the set delimited by braces. The values 6, 8, and 10 are the settings singled out for the schema-driven JSON workload. The commas separate the tested settings.

In that parameter study, the paper reports throughput of 1.7x unconstrained generation for the effective schema-driven settings. The more general efficiency study separately reports gains of up to 77% on predictable grammars. The parameter comparison gives the direct evidence for selecting a speculative block length on the JSON workload. The wider comparison shows how the accelerated decoder performs across its set of grammar workloads.

Speculation was ineffective for free-form JSON. Opportunistic masking was preferable there, with about 4.21% overhead relative to unconstrained generation in the parameter study. Free-form structure lets the generator choose keys and values with greater variety. Even when a proposed token is individually legal, the parser and scanner features may convey too little about the next several choices for a count-based predictor to guess them. Testing the actual proposal exploits individual legality without demanding that longer token sequences be predictable.

The C result reinforces the distinction. The terminal and parser information is sufficient to check legal continuations in a relatively complex grammar, yet the simple conditional counts do not predict useful blocks of code for the prompts tested. Opportunistic masking can still reduce the work compared with a fully online grammar check. Across the ablations, preserving token paths is the part of the method associated with keeping accuracy. The acceleration available once those paths are preserved depends on how easy it is to accept an immediate proposal or anticipate subsequent ones.

Limitations

Limits stated by the authors

The paper evaluates DOMINO with grammars available before inference and stable across requests. Vocabulary scanning and tree construction happen ahead of the throughput measurements. The reported precomputation times show that this can be a small preparation step for some grammars and a larger one for the tested C subset. If requests arrive with different specifications, the paper’s offline throughput results do not establish the resulting end-to-end performance. The authors also describe token healing at the prompt boundary as a case that may require a fresh compilation.

Full vocabulary coverage depends on traversing the relevant trees completely. The authors give the guarantee for unrestricted lookahead or a sufficient finite depth. They distinguish that condition from the shallower setting that suffices for grammaticality. The lookahead study therefore also marks a qualification on the accuracy claims. A run that excludes valid bridges uses a different set of decoding choices and can be substantially more invasive even while enforcing the same formal language.

The authors explicitly distinguish perplexity and differences in wording from task quality. In the template analysis, surprising text is evidence about how much the generation path changed. It does not by itself say whether the answer is better or worse. The GSM8K and CoNLL-2003 experiments supply the task-specific evidence. Similarly, the speed of speculation depends on the predictability of the grammar state. The paper reports that free-form JSON favors opportunistic masking and that speculation does not help on the tested C grammar.

What the design leaves open

Minimal invasiveness is formulated around valid outputs available from the same prompt, and the construction preserves legal vocabulary paths. This guarantee should be read at that level. In stochastic generation, masking can change the probabilities of the remaining entries even when every legal entry is retained. During a run, a rejected proposal can produce a different subsequent history from the unconstrained one. As a consequence, the existence of an undisturbed valid path does not establish equality between the distributions of complete constrained and unconstrained responses.

The task results concern the tested prompts, vocabularies, grammars, and datasets. An observed increase from 41.5% to 41.8% on the five-shot Mistral 7B GSM8K comparison supports recovery of accuracy in that setting. The size of that increase alone does not establish that grammar enforcement strengthens mathematical reasoning. The task assessment includes format as well as correctness. A decoder can make an answer count by expressing it in readable JSON, and changes in the output trajectory can also affect the answer. The headline result combines those routes to success.

The intermediate steps in the math grammar are structurally specified. Each record can contain a description, a calculation, and a numerical result, and the response has a numerical answer field. Those structural conditions leave open whether the calculation is valid or whether its result supports the final answer. The C comparison likewise evaluates throughput under the particular syntax in the appendix. The grammar covers a subset of the language, and the speed results do not establish correctness of generated programs. This follows from the role of the checker, which uses terminal patterns and productions to accept text in a specified language.

The speed benchmarks measure token throughput with selected prompts and output-length limits. In a practical task, the effort per finished answer also depends on how the decoder segments the output and where it stops. Two decoders can differ in tokens per second and in the number of tokens required to finish an answer. The paper’s relative throughput numbers address the generation rate under its setup. They leave request-level latency, cold starts, and the time to prepare changing grammars as separate measurements.

Finally, the speculation results reflect short warmup procedures followed by fixed counts. They show that recurring state transitions in selected schema workloads can be exploited with little preparation beyond running examples. They leave open how a count table would behave when the mix of requests changes or when a grammar admits many states that the warmup seldom visits. Opportunistic masking also depends on the distribution of proposed tokens. A prompt that already elicits the target format can produce many cheap successful checks. A different prompt can make the fallback to full masking more frequent.

What came after

The later citations connect DOMINO to inference-time algorithms, evaluation, reasoning, instruction following, and structured language tasks. The titles establish the focus of these works, and the citation links establish their connection to DOMINO. The specific implementation role of DOMINO, if any, is unspecified in these entries. Their relationship to the paper can be described through the questions their topics share with grammar-constrained decoding.

The closest connection is with the survey From Decoding to Meta-Generation. Its subject is inference-time algorithms, the stage at which DOMINO changes generation. DOMINO provides an example of how much can be changed at that stage alone. A parser can remove vocabulary choices, precomputation can make the removal economical, and several steps can be proposed together when the output is predictable. Those are distinct decisions about producing an answer from the same predictor, which makes the paper relevant to a survey that takes inference-time generation as its subject.

A Survey on LLM-as-a-Judge brings the connection into evaluation. A judging system has to express a decision in a form the surrounding evaluation can interpret. DOMINO’s results clarify two properties of such an interface. A grammar can secure the presentation of a response, and the way the grammar is enforced can influence the response itself. The citation connects constrained generation to this evaluation setting. The paper’s accuracy tests concern math and tagging, so the effect on judgments is a separate question.

Formal Mathematical Reasoning cites DOMINO from the perspective of formal reasoning. The original math experiment demonstrates that precise requirements for representation can affect how a solution unfolds. Its rules check JSON structure and permitted value types. Formal mathematical reasoning raises a further question about checking the content expressed in a representation. The connection places DOMINO’s contribution at the stage of producing a syntactically acceptable object that another process can examine.

JustLogic takes up the evaluation of deductive reasoning. Its connection to DOMINO is most easily seen through the design of a test. In the original experiments, asking for a structured response creates a way to extract the answer, while enforcing the structure can alter earlier choices. A deductive benchmark similarly has to interpret the response it receives before assessing its reasoning. The citation links the two at the boundary between how an answer is produced and how it becomes measurable.

Spotlight Your Instructions studies instruction following through dynamic attention steering. Its title identifies a different point of intervention in generation. DOMINO operates on legal vocabulary continuations under a grammar. Attention steering addresses the influence of instructions while the response is being produced. A formal specification and a natural-language instruction both express constraints on what a user wants, while the mechanisms act on different aspects of the generation process.

German Aspect-based Sentiment Analysis in the Wild cites the work in a study of sentiment analysis, dataset creation, and evaluation across domains. The closest original experiment is CoNLL-2003, where decisions about text are returned as structured records. This gives the citation an application-level connection. Constraining the representation of a prediction and assessing which prediction is correct are separate parts of a pipeline, and the tag results illustrate why the choice of representation can have consequences for both.

Orthographic Constraint Satisfaction and Human Difficulty Alignment brings the link back to characters and vocabulary boundaries. Orthographic constraints concern the visible form of a string. DOMINO’s starting observation is that a constraint at that level must be translated into choices over vocabulary entries, whose boundaries can fall elsewhere. The later work’s focus on human difficulty adds a different question about how satisfying such requirements is measured. The citation connects that question to the distinction between a requirement on the final text and the token-by-token path used to meet it.

Cite

Cite as Luca Beurer-Kellner, Marc Fischer and Martin Vechev. 2024. Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generation. arXiv:2403.06988.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2403.06988 · arXiv 2403.06988

@misc{beurerkellner2024guiding,
  title = {{Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generation}},
  author = {Luca Beurer-Kellner, Marc Fischer and Martin Vechev},
  year = {2024},
  doi = {10.48550/arxiv.2403.06988},
  eprint = {2403.06988},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2403.06988}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/beurer-2024-kellner-guiding-llms-right-way-fast/

References

27 references, from the paper's own bibliography.

  1. Anil, R., Borgeaud, S., Wu, Y., Alayrac, J., Yu, J., Soricut, R., Schalkwyk, J., Dai, A. M., Hauth, A., Millican, K., Silver, D., Petrov, S., Johnson, M., Antonoglou, I., Schrittwieser, J., Glaese, A., Chen, J., Pitler, E., Lillicrap, T. P., Lazaridou, A., Firat, O., Molloy, J., Isard, M., Barham, P. R., Hennigan, T., Lee, B., Viola, F., Reynolds, M., Xu, Y., Doherty, R., Collins, E., Meyer, C., Rutherford, E., Moreira, E., Ayoub, K., Goel, M., Tucker, G., Piqueras, E., Krikun, M., Barr, I., Savinov, N., Danihelka, I., Roelofs, B., White, A., Andreassen, A., von Glehn, T., Yagati, L., Kazemi, M., Gonzalez, L., Khalman, M., Sygnowski, J., and et al. Gemini: A family of highly capable multimodal models. ArXiv preprint, 2023. URL https://arxiv.org/abs/2312.11805. our card
  2. Beurer-Kellner, L., Fischer, M., and Vechev, M. T. Prompting is programming: A query language for large language models. Proc. ACM Program. Lang., 0 (PLDI), 2023. OpenAlex ↗ · Scholar ↗
  3. Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. our card
  4. Chen, C., Borgeaud, S., Irving, G., Lespiau, J., Sifre, L., and Jumper, J. Accelerating large language model decoding with speculative sampling. ArXiv preprint, 2023. OpenAlex ↗ · Scholar ↗
  5. Chen, M., Tworek, J., Jun, H., Yuan, Q., de Oliveira Pinto, H. P., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., Ray, A., Puri, R., Krueger, G., Petrov, M., Khlaaf, H., Sastry, G., Mishkin, P., Chan, B., Gray, S., Ryder, N., Pavlov, M., Power, A., Kaiser, L., Bavarian, M., Winter, C., Tillet, P., Such, F. P., Cummings, D., Plappert, M., Chantzis, F., Barnes, E., Herbert-Voss, A., Guss, W. H., Nichol, A., Paino, A., Tezak, N., Tang, J., Babuschkin, I., Balaji, S., Jain, S., Saunders, W., Hesse, C., Carr, A. N., Leike, J., Achiam, J., Misra, V., Morikawa, E., Radford, A., Knight, M., Brundage, M., Murati, M., Mayer, K., Welinder, P., McGrew, B., Amodei, D., McCandlish, S., Sutskever, I., and Zaremba, W. Evaluating large language models trained on code. ArXiv preprint, 2021. our card
  6. Cobbe, K., Kosaraju, V., Bavarian, M., Chen, M., Jun, H., Kaiser, L., Plappert, M., Tworek, J., Hilton, J., Nakano, R., et al. Training verifiers to solve math word problems. ArXiv preprint, 2021. our card
  7. Geng, S., Josifoski, M., Peyrard, M., and West, R. Grammar-constrained decoding for structured NLP tasks without finetuning. In EMNLP, 2023a. OpenAlex ↗ · Scholar ↗
  8. Geng, S., Josifoski, M., Peyrard, M., and West, R. Grammar-constrained decoding for structured nlp tasks without finetuning. In Proc. of EMNLP, 2023b. OpenAlex ↗ · Scholar ↗
  9. Gerganov, G. and et. al. llama.cpp: Port of facebook's llama model in c/c++. URL https://github.com/guidance-ai/guidance. OpenAlex ↗ · Scholar ↗
  10. Jiang, A. Q., Sablayrolles, A., Mensch, A., Bamford, C., Chaplot, D. S., Casas, D. d. l., Bressand, F., Lengyel, G., Lample, G., Saulnier, L., et al. Mistral 7b. ArXiv preprint, 2023. OpenAlex ↗ · Scholar ↗
  11. Jiang, A. Q., Sablayrolles, A., Roux, A., Mensch, A., Savary, B., Bamford, C., Chaplot, D. S., de Las Casas, D., Hanna, E. B., Bressand, F., Lengyel, G., Bour, G., Lample, G., Lavaud, L. R., Saulnier, L., Lachaux, M., Stock, P., Subramanian, S., Yang, S., Antoniak, S., Scao, T. L., Gervet, T., Lavril, T., Wang, T., Lacroix, T., and Sayed, W. E. Mixtral of experts. ArXiv preprint, 2024. OpenAlex ↗ · Scholar ↗
  12. Kudo, T. and Richardson, J. SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proc. of EMNLP, 2018. our card
  13. Lundberg, S. and Ribeiro, M. T. A. p. The Art of Prompt Design: Prompt Boundaries and Token Healing. OpenAlex ↗ · Scholar ↗
  14. Lundberg, S., Ribeiro, M. T. A. p., and et. al. Guidance-ai/guidance: A guidance language for controlling large language models. URL https://github.com/guidance-ai/guidance. OpenAlex ↗ · Scholar ↗
  15. McNaughton, R. and Yamada, H. Regular expressions and state graphs for automata. IRE Trans. Electron. Comput., 0 (1), 1960. OpenAlex ↗ · Scholar ↗
  16. OpenAI. GPT-4 technical report. ArXiv preprint, 2023. our card
  17. Poesia, G., Polozov, A., Le, V., Tiwari, A., Soares, G., Meek, C., and Gulwani, S. Synchromesh: Reliable code generation from pre-trained language models. In Proc. of ICLR, 2022. OpenAlex ↗ · Scholar ↗
  18. Scholak, T., Schucher, N., and Bahdanau, D. PICARD: Parsing incrementally for constrained auto-regressive decoding from language models. In Proc. of EMNLP, 2021. OpenAlex ↗ · Scholar ↗
  19. Sennrich, R., Haddow, B., and Birch, A. Neural machine translation of rare words with subword units. In Proc. of ACL, 2016. our card
  20. Thompson, K. Regular expression search algorithm. Commun. ACM, 0 (6), 1968. OpenAlex ↗ · Scholar ↗
  21. Tjong Kim Sang, E. F. Introduction to the CoNLL-2002 shared task: Language-independent named entity recognition. In COLING-02: The 6th Conference on Natural Language Learning 2002 (CoNLL-2002), 2002. our card
  22. Touvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., Azhar, F., Rodriguez, A., Joulin, A., Grave, E., and Lample, G. Llama: Open and efficient foundation language models. ArXiv preprint, 2023a. our card
  23. Touvron, H., Martin, L., Stone, K., Albert, P., Almahairi, A., Babaei, Y., Bashlykov, N., Batra, S., Bhargava, P., Bhosale, S., Bikel, D., Blecher, L., Canton-Ferrer, C., Chen, M., Cucurull, G., Esiobu, D., Fernandes, J., Fu, J., Fu, W., Fuller, B., Gao, C., Goswami, V., Goyal, N., Hartshorn, A., Hosseini, S., Hou, R., Inan, H., Kardas, M., Kerkez, V., Khabsa, M., Kloumann, I., Korenev, A., Koura, P. S., Lachaux, M., Lavril, T., Lee, J., Liskovich, D., Lu, Y., Mao, Y., Martinet, X., Mihaylov, T., Mishra, P., Molybog, I., Nie, Y., Poulton, A., Reizenstein, J., Rungta, R., Saladi, K., Schelten, A., Silva, R., Smith, E. M., Subramanian, R., Tan, X. E., Tang, B., Taylor, R., Williams, A., Kuan, J. X., Xu, P., Yan, Z., Zarov, I., Zhang, Y., Fan, A., Kambadur, M., Narang, S., Rodriguez, A., Stojnic, R., Edunov, S., and Scialom, T. Llama 2: Open foundation and fine-tuned chat models. ArXiv preprint, 2023b. our card
  24. Touvron, H., Martin, L., Stone, K., Albert, P., Almahairi, A., Babaei, Y., Bashlykov, N., Batra, S., Bhargava, P., Bhosale, S., et al. Llama 2: Open foundation and fine-tuned chat models. ArXiv preprint, 2023c. our card
  25. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, 2017. our card
  26. Willard, B. T. and Louf, R. Efficient guided generation for large language models. ArXiv preprint, 2023. our card
  27. Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., et al. Huggingface's transformers: State-of-the-art natural language processing. ArXiv preprint, 2019. our card