Semantic Content Determines Algorithmic Performance
Martiño Ríos-García, Nawaf Alampara, Kevin Maik Jablonka
TL;DR
WhatCounts investigates whether algorithmic primitives in LLMs are truly invariant to the semantic class of their inputs. The authors introduce WhatCounts, an atomic counting benchmark using unambiguous, delimited lists to isolate semantic content from tokenization and multi-step reasoning, and quantify the semantic gap with $\Delta_{\mathrm{sem}}(m) = \max_{e \in \mathcal{E}} \mathrm{Acc}(m,e) - \min_{e \in \mathcal{E}} \mathrm{Acc}(m,e)$. They demonstrate that frontier LLMs exhibit over 40 percentage points variation across semantic classes under identical conditions, and that surface ablations (tokenization, separators, or explicit structure) do not eliminate the gap. Training data and fine-tuning produce unstable, dataset-dependent shifts in both accuracy and the semantic gap, indicating that LLMs approximate algorithms in a content-dependent way. The findings imply practical risks for production and agentic pipelines where content-conditioned behavior can cascade through tool use and decision making, challenging the premise of prompt programming as a robust solution. WhatCounts highlights the need for semantic-aware models and benchmarks to ensure reliable, invariant computation in real-world AI systems.
Abstract
Counting should not depend on what is being counted; more generally, any algorithm's behavior should be invariant to the semantic content of its arguments. We introduce WhatCounts to test this property in isolation. Unlike prior work that conflates semantic sensitivity with reasoning complexity or prompt variation, WhatCounts is atomic: count items in an unambiguous, delimited list with no duplicates, distractors, or reasoning steps for different semantic types. Frontier LLMs show over 40% accuracy variation depending solely on what is being counted - cities versus chemicals, names versus symbols. Controlled ablations rule out confounds. The gap is semantic, and it shifts unpredictably with small amounts of unrelated fine-tuning. LLMs do not implement algorithms; they approximate them, and the approximation is argument-dependent. As we show with an agentic example, this has implications beyond counting: any LLM function may carry hidden dependencies on the meaning of its inputs.
