Saved in:
Bibliographic Details
Main Authors: Li, Hanqi, Chen, Lu, Yu, Kai
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2604.20811
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910157665992704
author Li, Hanqi
Chen, Lu
Yu, Kai
author_facet Li, Hanqi
Chen, Lu
Yu, Kai
contents As LLMs are increasingly integrated into agentic systems, they must adhere to dynamically defined, machine-interpretable interfaces. We evaluate LLMs as in-context interpreters: given a novel context-free grammar, can LLMs generate syntactically valid, behaviorally functional, and semantically faithful outputs? We introduce RoboGrid, a framework that disentangles syntax, behavior, and semantics through controlled stress-tests of recursion depth, expression complexity, and surface styles. Our experiments reveal a consistent hierarchical degradation: LLMs often maintain surface syntax but fail to preserve structural semantics. Despite the partial mitigation provided by CoT reasoning, performance collapses under structural density, specifically deep recursion and high branching, with semantic alignment vanishing at extreme depths. Furthermore, "Alien" lexicons reveal that LLMs rely on semantic bootstrapping from keywords rather than pure symbolic induction. These findings pinpoint critical gaps in hierarchical state-tracking required for reliable, grammar-agnostic agents.
format Preprint
id arxiv_https___arxiv_org_abs_2604_20811
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Diagnosing CFG Interpretation in LLMs
Li, Hanqi
Chen, Lu
Yu, Kai
Artificial Intelligence
As LLMs are increasingly integrated into agentic systems, they must adhere to dynamically defined, machine-interpretable interfaces. We evaluate LLMs as in-context interpreters: given a novel context-free grammar, can LLMs generate syntactically valid, behaviorally functional, and semantically faithful outputs? We introduce RoboGrid, a framework that disentangles syntax, behavior, and semantics through controlled stress-tests of recursion depth, expression complexity, and surface styles. Our experiments reveal a consistent hierarchical degradation: LLMs often maintain surface syntax but fail to preserve structural semantics. Despite the partial mitigation provided by CoT reasoning, performance collapses under structural density, specifically deep recursion and high branching, with semantic alignment vanishing at extreme depths. Furthermore, "Alien" lexicons reveal that LLMs rely on semantic bootstrapping from keywords rather than pure symbolic induction. These findings pinpoint critical gaps in hierarchical state-tracking required for reliable, grammar-agnostic agents.
title Diagnosing CFG Interpretation in LLMs
topic Artificial Intelligence
url https://arxiv.org/abs/2604.20811