TL;DR
BenchCLAMP is a new benchmark designed to evaluate how well Large Language Models (LLMs) can perform "constrained parsing"—turning natural language into structured outputs like SQL, code, or parse trees. By providing standardized grammars and data splits, the authors demonstrate that when LLMs are forced to follow structural rules during generation, they can match or even exceed the performance of specialized, state-of-the-art parsing models.
What Problem Does This Paper Address?
While LLMs are incredibly versatile, they have a structural weakness: they are prone to generating outputs that look correct but are syntactically invalid. In tasks like semantic parsing (converting a question into a database query) or syntactic parsing (mapping the grammatical structure of a sentence), a single missing parenthesis or a misspelled table name makes the entire output useless.
Traditionally, researchers solved this by building custom, task-specific architectures. Recent work showed that LLMs can do this if you "constrain" their decoding—essentially giving the model a set of rules it isn't allowed to break while it generates text. However, comparing different models was difficult because there was no unified benchmark, and setting up these constraints for every new dataset was a technical nightmare. BenchCLAMP provides the infrastructure to make these comparisons fair and reproducible.
Methods
The core of the paper is the Constrained LAnguage Model Parsing (CLAMP) framework. The authors developed context-free grammars (CFGs) for nine different parsing datasets.
During the decoding phase, the framework uses these grammars to filter the model's options. If the model attempts to predict a token that would violate the grammar (like putting a semicolon where a bracket should be), the system simply blocks that choice.
The authors evaluated two main approaches:
- Fine-tuning: Training models like T5 and BART on specific parsing tasks.
- Few-shot Prompting: Giving "frozen" models like GPT-3, Codex, and Llama-2 a few examples and asking them to complete the task without further training.
Datasets
BenchCLAMP covers nine popular datasets representing seven different output formalisms, ranging from SQL to Lisp-like logical forms.
- Semantic Parsing (Text-to-Logic/Code): SMCalFlow, TreeDST, MTOP, Overnight, Spider (SQL), CoSQL (SQL), and AMR 2.0.
- Syntactic Parsing (Text-to-Tree): PTB 3 (Constituency parsing) and UD-EWT (Dependency parsing).
Crucially, the authors provide low-resource (500 examples), medium-resource (5,000 examples), and high-resource (full dataset) splits to see how models perform when data is scarce versus plentiful.
Key Insights and Ideas
- Constraints are a "Safety Net" for Low Data: Constrained decoding is most beneficial in low-resource settings. When a model hasn't seen many examples, it’s more likely to "hallucinate" invalid structures. The grammar acts as a guide that keeps it on the rails.
- Generalists can beat Specialists: A general-purpose model like T5-3B, when fine-tuned and constrained, outperformed specialized state-of-the-art models on datasets like SMCalFlow and TreeDST. This suggests that pre-training on massive amounts of text provides a better foundation for parsing than custom-built architectures.
- The Complexity of SQL: For tasks like Spider (SQL), model size was the biggest predictor of success. This is likely because the model has to reason about complex database schemas, which requires the higher "intelligence" found in larger parameter counts.
- Few-shot Fragility: For models like GPT-3 and Codex, constrained decoding isn't just a "nice-to-have"—it's essential. Without it, these models frequently fail to produce any valid output at all for complex tasks like constituency parsing.
Key Results
- New State-of-the-Art (SOTA): The fine-tuned T5-3B model achieved new SOTA results on SMCalFlow (83.7%), TreeDST (91.5%), and Overnight (66.2%).
- Constraint Gains: On average, constrained decoding provided a 2.7% performance boost in low-resource regimes. In high-resource regimes, the gain was smaller (<1%), suggesting that with enough data, models eventually "learn" the grammar on their own.
- Encoder-Decoder Superiority: Pre-trained encoder-decoder models (like T5) generally performed better or more efficiently than decoder-only models for these structured tasks.
Limitations and Future Work
- Grammar Coverage: The grammars were induced from training data. If a test case requires a combination of elements never seen in training, the grammar might actually block the correct answer (though the authors found this happened in less than 1% of cases).
- English-Centric: While some of the underlying datasets are multilingual (like MTOP), this specific study focused only on English.
- API Variance: Results for models accessed via API (like GPT-3) showed high variance because the authors could only afford to test on small subsets (100 examples) due to cost.
- Future Direction: The authors suggest that future work should explore "relaxing" constraints to allow for more flexibility while still preventing total structural failure.
Summary updated