Cognitive BASIC: An In-Model Interpreted Reasoning Language for LLMs
Oliver Kramer
TL;DR
The paper addresses the opacity of multi-step reasoning in large language models by introducing Cognitive BASIC, a minimal in-model programming language with an in-model interpreter that executes reasoning as explicit, auditable steps. It defines a compact memory schema (working, declarative, procedural, conflicts, resolution) and a small BASIC-style instruction set that deterministically updates memory and logs each step, enabling transparent reasoning traces. The approach is demonstrated via a DCR pipeline $D\rightarrow C\rightarrow R$ executed inside the model, evaluated on 25 contradictory scenarios across three LLMs, showing strong declarative extraction but model-dependent variability in conflict detection and resolution. The work highlights the potential for transparent cognitive control within LLMs and suggests directions for tool integration and hierarchical control to improve robustness and applicability.
Abstract
Cognitive BASIC is a minimal, BASIC-style prompting language and in-model interpreter that structures large language model (LLM) reasoning into explicit, stepwise execution traces. Inspired by the simplicity of retro BASIC, we repurpose numbered lines and simple commands as an interpretable cognitive control layer. Modern LLMs can reliably simulate such short programs, enabling transparent multi-step reasoning inside the model. A natural-language interpreter file specifies command semantics, memory updates, and logging behavior. Our mental-model interpreter extracts declarative and procedural knowledge, detects contradictions, and produces resolutions when necessary. A comparison across three LLMs on a benchmark of knowledge extraction, conflict detection, and reasoning tasks shows that all models can execute Cognitive BASIC programs, with overall strong but not uniform performance.
