Manuscript Offprint

arXiv:2609.01815

Induction and Inquiry via Probabilistic Reasoning over Language and Code

Wasu Top Piriyakulkij, Sam Acquaviva, Cassidy Langenfeld, Joshua Tenenbaum, Kevin Ellis

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

Abstract

How humans grow and maintain abstract knowledge from the sparse, streaming noisy data of experience is a longstanding challenge in cognitive science. Any computational account must satisfy at least three desiderata: It must be (1) data-efficient and compute-efficient, (2) capture gradations of uncertainty to support intelligent inquiry and information gathering, and (3) be flexible enough to mentally represent the endless range of concepts people can learn and think about. Here we introduce a computational model that captures these three properties, by encoding symbolic knowledge as mental programs that combine natural language with source code, and sequentially inferring mental programs using LLM-guided Bayesian learning algorithms. Across a range of behavioral studies this model successfully reproduces quantitative signatures of human inductive learning and active inquiry, such as anchoring, garden-pathing, and other effects. In contrast, pure LLMs and classic Bayesian models either fail at the underlying task, or do not reproduce human behavior, or succeed only at exorbitant computational cost. These results suggest that one way humans continually grow their knowledge is by mentally representing many hypotheses spanning language-like and program-like representations, then revising those hypotheses to approximate Bayesian updates, while a bottom-up neural mechanism (an LLM) makes inference both tractable and learnable.

1 Introduction

Inductive reasoning is a cornerstone of general intelligence: Learning new concepts from few examples, and revising those concepts in light of new evidence. Limited data is inherently ambiguous, motivating an inquiry process of asking questions or doing experiments to resolve uncertainty. This induction-inquiry cycle unfolds sequentially over time, with new data streaming in, because inquiry is an active process of asking questions and getting answers. Modeling human induction and inquiry is a longstanding challenge because such models must handle uncertainty, have a flexible hypothesis class covering much of what humans can think of, and support efficient online computation. These objectives interact: A flexible, open-ended hypothesis class yields more uncertainty, because there are now more competing explanations for the evidence. But this causes reasoning to be computationally expensive. Decades of research [1, 2, 3] suggest human inductive reasoning approximates probabilistic Bayesian belief updates, but we still cannot truly model what people seem to do: Efficient online induction and inquiry over flexible open-ended hypothesis spaces. This is the challenge we take on.

We start with the Bayesian cognitive modeling paradigm, which imposes probabilistic norms for calculating how credible a belief should be, but as a paradigm, does not say what people can believe in the first place—how they can efficiently reason about an endlessly open-ended range of concepts. Prior models of inductive reasoning [4, 5] further posit an inner Language of Thought, whether formal logic, symbolic schemas or Bayes net templates, or probabilistic programs, which formalize and delineate what hypotheses are representable, and therefore learnable. The literature on intuitive theories and cognitive development has also proposed natural language as a representation of hypotheses [6, 7, 8], but this has never been made formal.

Figure

Figure 1: a) - d) show sequential inference problems that we study in this work and illustrate how, in each problem, Bayesian beliefs may change upon seeing new observations over time.

Here we find that human behavior across a range of induction and inquiry setups is best explained by sequential probabilistic reasoning over mental programs, which we treat as a mix of natural language and computer source code (fig. 1). Although the idea of an inner Language of Thought is an old one, its past computational instantiations assumed rigid logical forms that are less malleable than natural language, and less practical than actual programming languages.

Why represent knowledge as a mix of natural language and source code? Language and code are generic representations for communicating and formalizing human knowledge, but only recently have they become tractable targets of inference, owing primarily to Large Language Models (LLMs). Our models equip LLMs with sequential probabilistic reasoning. The resulting models reproduce sequential phenomena such as garden-pathing and anchoring; capture gradations of uncertainty; and scale to more complex concepts, because of the powerful combination of the expressivity of language and the top-down feedback of code. Furthermore, we show how these models can perform human-like active inquiry, closing the sequential learning loop which a)

Traditional

Bayesian Inference

Figure

b)

Vanilla LLM

Inference

Inconsistent Beliefs

Figure

Suboptimal Experiment

Figure

c)

LLM-based

Bayesian Inference

Consistent Beliefs

Figure

♦ Optimal Experiment

Figure 2: a) - c) show three types of inference methods: traditional Bayesian, vanilla LLM, and LLM-based Bayesian (ours). LLM-based Bayesian inference in language/code hypothesis space is the only method that is tractable while maintaining consistent beliefs and optimal experiments.

alternates between induction and inquiry. Speculatively, our model suggests mental representations that lie on a continuum between logic and language, and shows how this representation works with Bayesian reasoning.

References (35)

  • Rational use of cognitive resources: Levels of analysis between the computational and the algorithmic
  • Bayesian Models of Cognition: Reverse Engineering the Mind
  • The best game in town: The reemergence of the language-of-thought hypothesis across the cognitive sciences
  • Piantadosi
  • Sequential monte carlo steering of large language models using probabilistic programs
  • Probabilistic inference in language models via twisted sequential monte carlo (opens arXiv in a new tab)
  • Doing experiments and revising rules with natural language and probabilistic reasoning
  • The logical primitives of thought: Empirical foundations for compositional cognitive models
  • Dreamcoder: Bootstrapping inductive program synthesis with wake-sleep library learning
  • OpenAI o1 System Card
  • DeepSeek-R1 incentivizes reasoning in LLMs through reinforcement learning
  • People infer recursive visual concepts from just a few examples
  • A model of conceptual bootstrapping in human cognition
  • Can humans teach machines to code?, 2025
  • The copycat project: A model of mental fluidity and analogy-making
  • Symbolic metaprogram search improves learning efficiency and explains rule learning in humans
  • Online learning of symbolic concepts
  • Grounding compositional hypothesis generation in specific instances
  • Detecting blickets: How young children use information about novel causal powers in categorization and induction
  • Where science starts: Spontaneous experiments in preschoolers' exploratory play
  • Acre: Abstract causal reasoning beyond covariation
  • Active object localization in visual situations, 2016
  • Human-level concept learning through probabilistic program induction
  • A rational analysis of rule-based concept learning
  • The language of geometry: Fast comprehension of geometrical primitives and rules in human adults and preschoolers
  • Synthesizing theories of human language with bayesian program induction
  • From sensory signals to modality-independent conceptual representations: A probabilistic language of thought approach
  • Visual sequence primitives in humans
  • Learning abstract structure for drawing by efficient motor program induction
  • Bayesian synthesis of probabilistic programs for automatic data modeling
  • Human-like systematic generalization through a meta-learning neural network
  • An explanation of in-context learning as implicit bayesian inference
  • Recasting gradient-based meta-learning as hierarchical bayes
  • Model-agnostic meta-learning for fast adaptation of deep networks
  • Nature, pages 1–8, 2025