SyntaxBench: A Statistical Diagnostic Framework for Character-Level Reasoning in Large Language Models
Organizations: Department of Computer Science, University of Nevada, Las Vegas · Department of Computer Science University of Nevada, Las Vegas
Abstract
Large language models are increasingly used 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. It contains five core 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 use paired English and character-length-matched random-string inputs. index_to_span documents share a 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 from 2B to 32B parameters across 11 reasoning-mode configurations. The framework reports exact-match and relaxed accuracy, Cohen's kappa, paired McNemar tests with odds ratios, bootstrap confidence intervals, Kendall's tau, class-conditional metrics, tokenization analysis, and multiple-comparison-corrected tests. Three findings stand out. First, tokenization shapes accuracy: random strings are more character-visible than English strings (1.892 vs. 3.169 characters per token), and character-counting accuracy falls as English words occupy more tokens. Second, reasoning mode is not uniformly helpful: Gemma4-31B is nearly unchanged across modes on the near-saturated tasks, while Qwen3.6-27B is worse with thinking on palindrome detection (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%. Character-level evaluation needs controlled inputs, paired tests, and analyses of tokenization and reasoning mode rather than aggregate accuracy alone.
Figures & tables
| Task | Description | Output | Inputs (En / Rand) |
|---|---|---|---|
| Intra-word core | |||
| count_chars | length of a string | integer | 200 / 200 |
| letter_container | does contain character ? | yes/no | 400 / 400 |
| palindrome_test | does read the same forward and backward? | yes/no | 400 / 400 |
| Inter-word core | |||
| edit_distance | Levenshtein distance between | integer | 200 / 200 |
| Rank | Model | Macro EMA [95% CI] | VRR | PER |
|---|---|---|---|---|
| 1 | GPT-OSS-20B | [0.512, 0.989] | 0.964 | 0.036 |
| 2 | Gemma4-31B | [0.388, 0.971] | 1.000 | 0.000 |
| 3 | DeepSeek-R1-32B | [0.385, 0.966] | 0.973 | 0.027 |
| 4 | Qwen3.6-27B | [0.358, 0.972] | 1.000 | 0.000 |
| 5 | Nemotron-Cascade-2-31B | [0.339, 0.919] | 0.992 | 0.008 |
| Shot | Non-thinking | Thinking | NT T | |||
|---|---|---|---|---|---|---|
| EMA | EMA | EMA | ||||
| 0-shot | 0.919 | 0.838 | 0.955 | 0.910 | ||
| 1-shot | 0.899 | 0.798 | 0.819 | 0.638 | ||
| 4-shot | 0.952 | 0.905 | 0.886 | 0.773 | ||
Appendix figures & tables29 assets
Supplementary material from the paper’s appendix.
Appendix
| count_chars | edit_distance | index_to_span | letter_container | longest_string_finder | palindrome_test | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| english | random | english | random | english | random | english | random | english | random | english | random | |
| deepseek_r1_32b | ||||||||||||
| gemma4_31b | ||||||||||||
| gpt-oss_20b | ||||||||||||
| nemotron-cascade-2 | ||||||||||||
| qwen3.6_27b | ||||||||||||
| count_chars | edit_distance | index_to_span | letter_container | longest_string_finder | palindrome_test | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| english | random | english | random | english | random | english | random | english | random | english | random | |
| deepseek_r1_32b | ||||||||||||
| gemma4_31b | ||||||||||||
| qwen3.5_27b | ||||||||||||
| qwen3.5_2b | – | |||||||||||
| qwen3.5_9b | ||||||||||||
| count_chars | edit_distance | index_to_span | letter_container | longest_string_finder | palindrome_test | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | |
| deepseek_r1_32b | 97.8 | 94.5 | 96.2 | 39.8 | 34.2 | 37.5 | 0.5 | 0.0 | 0.2 | 98.9 | 98.6 | 99.4 | 99.8 | 99.0 | 99.8 | 95.0 | 94.2 | 85.0 |
| gemma4_31b | 87.8 | 92.0 | 96.2 | 29.0 | 28.7 | 39.5 | 0.5 | 0.5 | 0.5 | 99.5 | 99.1 | 99.2 | 95.8 | 97.8 | 98.5 | 84.1 | 92.9 | 93.2 |
| gpt-oss_20b | 96.5 | 97.5 | 97.2 | 85.2 | 88.8 | 89.0 | 7.4 | 6.5 | 6.8 | 99.5 | 99.2 | 99.8 | 99.8 | 99.8 | 98.5 | 98.8 | 98.9 | 99.4 |
| nemotron-cascade-2 | 96.2 | 96.2 | 97.2 | 23.0 | 16.0 | 34.2 | 0.0 | 0.0 | 0.0 | 99.8 | 99.5 | 99.9 | 57.5 | 72.8 | 69.0 | 81.9 | 86.8 | 88.2 |
| qwen3.6_27b | 99.2 | 99.8 | 100.0 | 37.2 | 35.8 | 29.8 | 0.0 | 0.0 | 0.0 | 99.9 | 99.6 | 99.0 | 100.0 | 99.3 | 96.5 | 95.5 | 81.9 | 88.6 |
| Model | count_chars | edit_distance | letter_container | longest_string_finder | palindrome_test |
|---|---|---|---|---|---|
| deepseek_r1_32b | almost_perfect | moderate | almost_perfect | almost_perfect | substantial |
| gemma4_31b | almost_perfect | substantial | almost_perfect | almost_perfect | almost_perfect |
| gpt-oss_20b | almost_perfect | almost_perfect | almost_perfect | almost_perfect | almost_perfect |
| nemotron-cascade-2 | almost_perfect | substantial | almost_perfect | substantial | substantial |
| qwen3.6_27b | almost_perfect | moderate | almost_perfect | almost_perfect | substantial |
| deepseek_r1_32b | gemma4_31b | gpt-oss_20b | nemotron-cascade-2 | qwen3.6_27b | |
|---|---|---|---|---|---|
| deepseek_r1_32b | — | ||||
| gemma4_31b | — | ||||
| gpt-oss_20b | — | ||||
| nemotron-cascade-2 | — | ||||
| qwen3.6_27b | — |
| deepseek_r1_32b | gemma4_31b | qwen3.5_27b | qwen3.5_2b | qwen3.5_9b | qwen3.6_27b | |
|---|---|---|---|---|---|---|
| deepseek_r1_32b | — | |||||
| gemma4_31b | — | |||||
| qwen3.5_27b | — | |||||
| qwen3.5_2b | — | |||||
| qwen3.5_9b | — | |||||
| qwen3.6_27b | — |
| Model | count_chars | edit_distance | index_to_span | letter_container | longest_string_finder | palindrome_test |
|---|---|---|---|---|---|---|
| deepseek_r1_32b | valley_1shot | valley_1shot | valley_1shot | valley_1shot | valley_1shot | monotone_down |
| gemma4_31b | monotone_up | valley_1shot | – | valley_1shot | monotone_up | monotone_up |
| gpt-oss_20b | peak_1shot | monotone_up | valley_1shot | valley_1shot | monotone_down | monotone_up |
| nemotron-cascade-2 | monotone_up | valley_1shot | – | valley_1shot | peak_1shot | monotone_up |
| qwen3.6_27b | monotone_up | monotone_down | – | monotone_down | monotone_down | valley_1shot |
| count_chars | edit_distance | index_to_span | letter_container | longest_string_finder | palindrome_test | |
|---|---|---|---|---|---|---|
| deepseek_r1_32b | ||||||
| gemma4_31b | ||||||
| gpt-oss_20b | ||||||
| nemotron-cascade-2 | ||||||
| qwen3.6_27b |
| count_chars | edit_distance | index_to_span | letter_container | longest_string_finder | palindrome_test | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | 0-shot | 1-shot | 4-shot | |
| deepseek_r1_32b | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.5 ( 0.0 ; 0.5 ) | 0.2 ( 0.0 ; 0.2 ) | 0.5 ( 0.0 ; 0.5 ) | 0.2 ( 0.0 ; 0.2 ) | 0.2 ( 0.0 ; 0.2 ) | 0.5 ( 0.0 ; 0.5 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.2 ( 0.0 ; 0.2 ) | 0.0 ( 0.0 ; 0.0 ) | 0.2 ( 0.0 ; 0.2 ) | 3.5 ( 0.0 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0 ; 0.3 ) | 2.2 ( 0.0 ; 2.2 ) | 2.2 ( 0.0 ; 2.2 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 15.2 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 1.2 ( 0.0 ; 0.0 ) | 4.4 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.4 ( 0.0 ; 0.0 ) |
| qwen3.6_27b | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) | 0.0 ( 0.0 ; 0.0 ) |
| Model | Cond. | Mean Std | Median | P5 | P95 | |
|---|---|---|---|---|---|---|
| deepseek_r1_32b | english | 0.00 | 0.00 | 0.05 | 200 | |
| random | 0.00 | 0.00 | 0.00 | 200 | ||
| all | 0.00 | 0.00 | 0.00 | 400 | ||
| gemma4_31b | english | 0.00 | 0.00 | 1.00 | 200 | |
| random | 0.00 | 0.00 | 0.00 | 200 | ||
| all | 0.00 | 0.00 | 0.00 | 400 |
| Model | Cond. | Mean Std | Median | P5 | P95 | |
|---|---|---|---|---|---|---|
| deepseek_r1_32b | english | 0.00 | -2.00 | 3.00 | 199 | |
| random | 0.00 | -3.00 | 3.10 | 199 | ||
| all | 0.00 | -2.15 | 3.00 | 398 | ||
| gemma4_31b | english | 0.00 | -1.00 | 1.05 | 200 | |
| random | -1.00 | -2.00 | 0.00 | 200 | ||
| all | 0.00 | -2.00 | 1.00 | 400 |
| Task | Model | EMA | Mean tokens | EMA/token |
|---|---|---|---|---|
| count_chars | deepseek_r1_32b | 96.2% | 274 | |
| count_chars | gemma4_31b | 96.2% | 0 | – |
| count_chars | gpt-oss_20b | 97.2% | – | – |
| edit_distance | deepseek_r1_32b | 37.5% | 1555 | |
| edit_distance | gemma4_31b | 39.5% | 0 | – |
| edit_distance | gpt-oss_20b | 89.0% | 0 | – |
| Task | Model A | Model B | [95% CI] | Risk diff. | ||
|---|---|---|---|---|---|---|
| edit_distance | gpt-oss_20b | qwen3.6_27b | [1.18, 1.45] | |||
| edit_distance | gpt-oss_20b | nemotron-cascade-2 | [1.09, 1.36] | |||
| edit_distance | deepseek_r1_32b | gpt-oss_20b | [-1.29, -1.01] | |||
| edit_distance | gemma4_31b | gpt-oss_20b | [-1.25, -0.97] | |||
| longest_string_finder | deepseek_r1_32b | nemotron-cascade-2 | [0.95, 1.26] | |||
| longest_string_finder | gemma4_31b | nemotron-cascade-2 | [0.8, 1.09] |
| Rank | Model | Macro EMA [95% CI] | VRR | PER |
|---|---|---|---|---|
| 1 | gpt-oss_20b | [0.512, 0.989] | ||
| 2 | gemma4_31b | [0.388, 0.971] | ||
| 3 | deepseek_r1_32b | [0.385, 0.966] | ||
| 4 | qwen3.6_27b | [0.358, 0.972] | ||
| 5 | nemotron-cascade-2 | [0.339, 0.919] |
| Rank | Model | Macro EMA [95% CI] | VRR | PER |
|---|---|---|---|---|
| 1 | qwen3.5_27b | [0.394, 0.966] | ||
| 2 | gemma4_31b | [0.385, 0.971] | ||
| 3 | qwen3.6_27b | [0.376, 0.975] | ||
| 4 | qwen3.5_9b | [0.361, 0.915] | ||
| 5 | qwen3.5_2b | [0.419, 0.804] | ||
| 6 | deepseek_r1_32b | [0.163, 0.83] |