Manuscript Offprint

arXiv:2610.03329

SyntaxBench: A Statistical Diagnostic Framework for Character-Level Reasoning in Large Language Models

Mohsen Larni, Sobhan Ebrahimi Azar, Pouyan Nahed, Kazem Taghva

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Mohsen Larni ∗^{*}

Department of Computer Science

University of Nevada, Las Vegas

mohsen.larni [at] unlv.edu

Pouyan Nahed

Department of Computer Science

University of Nevada, Las Vegas

pouyan.nahed [at] unlv.edu

Sobhan Ebrahimi Azar ∗^{*}

Department of Computer Science

University of Nevada, Las Vegas

sobhan.ebrahimiazar [at] unlv.edu

Kazem Taghva

Department of Computer Science

University of Nevada, Las Vegas

kazem.taghva [at] unlv.edu

Abstract

Large language models are increasingly used in settings where small syntactic errors matter, yet character-level reasoning is still evaluated mostly through isolated probes and aggregate accuracy. We introduce SyntaxBench, a diagnostic benchmark and statistical evaluation framework for character-level reasoning. SyntaxBench contains five core deterministic tasks, character counting, letter containment, palindrome detection, edit distance, and longest-string selection, plus index_to_span, a harder substring-extraction stress test. The five core tasks are instantiated on paired English and character-length-matched random-string inputs. index_to_span documents are drawn from the same 200–500 word band and are not character-length matched. All six tasks use zero-, one-, and four-shot prompts.

We evaluate eight open-weight models spanning 2B–32B parameters across 11 available reasoning-mode configurations. The framework reports exact-match and relaxed accuracy together with Cohen’s κ\kappa, paired McNemar tests with odds-ratio effect sizes, bootstrap confidence intervals, Kendall’s τ\tau over shot count, class-conditional metrics, tokenization analysis, and multiple-comparison-corrected condition tests. Three findings stand out. First, tokenization strongly shapes accuracy: random strings are more character-visible than English strings (1.892 vs. 3.169 chars/token), and count_chars accuracy falls sharply as English words occupy more tokens. Second, reasoning mode is not uniformly helpful: Gemma4-31B is essentially indistinguishable across modes on the near-saturated tasks, while Qwen3.6-27B is worse with thinking enabled on palindrome_test (0.952 non-thinking vs. 0.886 thinking at four-shot). Third, index_to_span remains largely unsolved; the best four-shot exact-match accuracy is 6.75%.

SyntaxBench shows that character-level evaluation needs controlled input conditions, paired statistical tests, and analyses of tokenization and reasoning mode rather than aggregate accuracy alone. The code will be released soon.

Keywords: Large Language Models, Character-Level Reasoning, Tokenization, Chain-of-Thought, Diagnostic Benchmark, Statistical Evaluation

∗^{*}These authors contributed equally.

Preprint.

1 Introduction

Large language models (LLMs) are now used as everyday tools for writing, programming, tutoring, and analysis. In these settings, users often expect exact answers to small syntactic questions: How many characters are in a string? Does a letter appear? What is the edit distance between two strings? These operations are simple for deterministic programs, but they remain brittle for LLMs. The familiar “strawberry” counting failure [28, 1] is a visible instance of a broader problem: fluent text generation does not imply reliable character-level reasoning.

Character-level tasks are useful because they have deterministic ground truth. They also expose failure modes that semantic benchmarks can hide. A model can sound confident while being off by one character, returning the wrong binary label, or extracting the wrong substring from a long context. Standard benchmarks [32, 31, 29, 15] measure broad language understanding, but they rarely isolate these low-level operations. When character-level probes are used, results are often summarized with aggregate accuracy alone, without paired tests, effect sizes, class-conditional behavior, or controls for tokenization and input distribution.

We introduce SyntaxBench, a diagnostic benchmark and evaluation framework for this setting. The benchmark has six deterministic tasks. Five are core character-level tasks: count_chars, letter_container, palindrome_test, edit_distance, and longest_string_finder. The sixth, index_to_span, is a harder stress test that asks models to recover a substring from explicit start and end indices in a long text. The five core tasks are instantiated on paired English and length-matched random-string inputs, allowing us to separate linguistic familiarity from character-level processing. The stress-test documents are drawn from the same 200–500 word band and are not character-length matched. We evaluate zero-, one-, and four-shot prompting, and compare thinking and non-thinking modes where both are available.

SyntaxBench is organized around four research questions. RQ1 (mechanism): is the English-vs-random accuracy difference driven by tokenizer granularity (characters per token) rather than linguistic familiarity? RQ2 (reasoning mode): treated as a deployment switch, when does enabling thinking help, hurt, or leave character-level accuracy unchanged? RQ3 (short-to-long transfer): does competence on short-input character operations transfer to character-offset extraction over long documents? RQ4 (methodology): what statistical machinery is needed to make character-level benchmark claims falsifiable rather than anecdotal?

The framework is designed for benchmark interpretation, not just score reporting. In addition to exact-match and relaxed accuracy, it reports bootstrap confidence intervals, Cohen's κ\kappa, paired McNemar tests with odds-ratio effect sizes, Kendall's τ\tau over shot count, class-conditional binary metrics, tokenization-stratified accuracy, integer and string error summaries, and multiple-comparison-corrected English-vs-random tests. These diagnostics make each headline claim falsifiable: they distinguish model differences from sample noise, input-condition effects from tokenization artifacts, and accuracy gains from validity or class-bias effects.

We evaluate eight open-weight models spanning 2B–32B parameters: the Qwen3.5 family at 2B, 9B, and 27B; Qwen3.6-27B; Gemma4-31B; GPT-OSS-20B; Nemotron-Cascade-2; and DeepSeek-R1-32B. The resulting 11 available model-mode configurations show that character-level reasoning is not a single capability. Several models saturate letter_container and perform well on palindrome_test, while edit_distance remains strongly model-dependent and index_to_span is near the floor for every model. At four-shot in thinking mode, GPT-OSS-20B has the best composite score (macro EMA 0.818), but even it reaches only 6.75% exact match on index_to_span.

Three empirical patterns motivate the benchmark. First, tokenization mediates English-vs-random behavior. Across tokenizer-covered models, random strings are more character-visible than English strings: 0.542 versus 0.344 tokens per character, or 1.892 versus 3.169 characters per token (Cohen's d=2.165d = 2.165 on tokens per character). On count_chars, accuracy declines as English examples occupy more tokens, consistent with errors inside multi-character subwords. Second, reasoning mode is not uniformly helpful. DeepSeek-R1-32B benefits from thinking on several tasks, but Qwen3.6-27B is worse with thinking enabled on palindrome_test (0.952 non-thinking vs. 0.886 thinking at four-shot). Third, scale helps but does not solve the benchmark. Within Qwen3.5, four-shot count_chars improves from 0.698 to 0.880 to 0.958 across 2B, 9B, and 27B, yet the complete 9B and 27B index_to_span cells remain at 0.5%, and the 2B 4-shot cell has no random-condition responses (0/113 English).

Contributions. We make three contributions. (1) SyntaxBench: a six-task diagnostic benchmark for character-level reasoning with paired English and random inputs. The five core tasks are character-length matched. The stress test matches word count, not character length. (2) A reproducible evaluation framework: a pipeline that reports accuracy, validity, agreement, effect sizes, monotonicity, tokenization effects, class-conditional behavior, and multiple-comparison-corrected statistical tests. (3) An empirical study of open-weight LLMs: an analysis showing tokenization-mediated input effects, non-uniform reasoning-mode behavior, within-family scaling, and a persistent failure mode on positional substring extraction. The code will be released soon.

References (24)