Byte-Level Constrained Decoding for Structured Data Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing language models struggle to accurately and efficiently generate structured data such as programs and APIs, failing to meet the requirements of fast and efficient interaction with humans.

Innovation Solution

A language model that operates at the byte-level using a context-free grammar (CFG) transformed into a byte-level CFG, with a prediction mechanism to constrain the next token and utilize a trie or minimized finite state automaton (FSA) for efficient parsing and decoding.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Manufacturing precision

If existing language models generate text token by token without constraints, then generation speed is maintained, but accuracy of structured data (programs, APIs) deteriorates

Engineering Contradiction:
Improveaccuracy of structured data generationVSAvoidgeneration speed
Core Design Contradiction:
Manufacturing precisionVSProductivity

Solution Approach 1:

The patent transforms the context-free grammar into a byte-level CFG and constructs a minimized FSA beforehand, before the actual generation process. This preliminary preparation enables the model to efficiently constrain token generation while maintaining high accuracy for structured data, resolving the contradiction between precision and productivity.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces a minimized finite state automaton (FSA) as an intermediary between the language model and the output generation. This intermediary structure efficiently represents the byte-level CFG constraints and guides token selection, enabling both high accuracy in structured data generation and maintained generation speed.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Manufacturing precision

If byte-level CFG with minimized FSA is used to constrain decoding, then manufacturing precision improves, but device complexity increases

Engineering Contradiction:
Improvedecoding accuracyVSAvoidparsing mechanism complexity
Core Design Contradiction:
Manufacturing precisionVSDevice complexity

Solution Approach 1:

The grammar transformation and FSA minimization are performed in advance, converting the complex CFG into a streamlined byte-level representation. This preliminary processing reduces the complexity of the parsing mechanism during actual generation while maintaining high decoding accuracy.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent changes the operational level from token-level to byte-level processing, and transforms the grammar representation into a minimized FSA structure. These parameter changes simplify the parsing mechanism while improving decoding accuracy for structured data.

Inventive Principle:
Principle #35Parameter changes

3Manufacturing precision

If context-free grammar is transformed to byte-level CFG, then manufacturing precision improves, but loss of time increases due to transformation process

Engineering Contradiction:
Improvestructured data generation accuracyVSAvoidgrammar transformation time
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The grammar transformation from CFG to byte-level CFG is performed as a preliminary step before generation begins. Although this transformation takes time, it enables significantly faster and more accurate constrained generation during the actual processing, reducing overall time loss.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates a byte-level representation (copy) of the original CFG that operates at the byte level rather than token level. This copied structure enables more precise control over structured data generation without requiring repeated transformations during generation.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS20250259000A1Intelligent constrained decoding
Publication Date: 2025.08.14 SCALED COGNITION INC
  • US20250259000A1 patent drawing
  • US20250259000A1 patent drawing
  • US20250259000A1 patent drawing

AI summary

A system provides a language model that utilizes an optimized parser and operates at the byte- level in a context free grammar (CFG) and a tokenizer vocabulary. The CFG is constrained and automatically transformed to a byte-level grammar. A prediction mechanism is used to predict the allowed sequences of bytes that can appear after a given prefix. In some instances, only the next token is constrained so that candidates for the next token can be intersected with tokens in the tokenizer vocabulary. To achieve this, lattice parsing is performed using a finite state automaton (FSA) that is generated and then minimized.