cs.LGMay 27, 2026

Learning the Error Patterns of Language Models

Authors: Jinwoo KimTaylor Berg-KirkPatrickLoris D'Antoni

Abstract

When generating outputs for domains with specific validity constraints (e.g., a program should compile), LLMs often fail in a small number of focused ways: for example, by using Python function names when generating TypeScript. We observe that these error patterns can be represented using a small number of constraints that can be learned in practice. We propose \emph{prefix filters}, which are per-domain-and-LLM symbolic functions, as objects to capture the error patterns, Palla as an algorithm to learn prefix filters efficiently in practice, and implement Palla. Prefix filters learned by Palla i) help us quantitatively analyze the error patterns of LLMs, and ii) can be used to constrain the outputs of a model via constrained sampling algorithms. For example, Palla boosts compile rates for Qwen2.5-1.5B on TypeScript generation, by over 60%, allowing Qwen2.5-1.5B to achieve similar performance to Llama3.1-8B unconstrained.

Explore similar work

CardsList
  1. The Alignment Problem in Constrained Code Generation

    Jun 19, 2026Matteo Biagiola, Jahrim Gabriele Cesario, Luca Di Grazia +2Code GenerationLarge Language Model Performance

  2. Syntax Without Semantics: Teaching Large Language Models to Code in an Unseen Language

    May 15, 2026Vinayshekhar Bannihatti Kumar, Disha Makhija, Manoj Ghuhan Arivazhagan +1Code Generation