Composed-Program Induction with Latent Program Lattice
Abstract
Compositional reasoning requires learning structure, inferring programs, and discovering refined primitives. Existing approaches either lack explicit decomposition mechanisms or rely on hand-crafted primitives. We propose the Program Lattice Auto Encoder (PLAE), which learns compositional transformations in a structured latent program space. PLAE trains an encoder where program effects correspond to integer linear combinations of program bases, forming a discrete program lattice. Program induction reduces to solving the Closest Vector Problem (CVP), enabling two complementary inference modes: fast System-1 reasoning via CVP and deliberate System-2 reasoning through stepwise lattice walks with intermediate verification. The framework supports abstraction discovery through lattice reduction, which refines primitive bases to uncover more fundamental components. This work connects neural and symbolic reasoning by providing a mathematically principled framework for compositional domains.
Introduction
Compositional reasoning is the process of solving new problems by systematically composing primitive operations into complex transformations. This ability hinges on three key components:
- learning the compositional structure that governs how primitives interact
- inference using this learned structure to generalize from limited examples, and
- abstraction discovery that compresses and refines primitives to accelerate future reasoning.
As the Kaleidoscope Hypothesis (Chollet, 2024) suggests, we focus on realizing the symmetric structure beneath apparent complexity. Building on this view, we propose the Program Lattice Auto Encoder(PLAE). The central idea is to endow the model with a structured latent program space that respects the compositional structure. Drawing on category theory, we design the encoder to be trained to mimic a functor that maps input–output pairs and their transformations into a latent space while preserving their compositional structure. In this space, primitive operations correspond to each latent program basis, and composed programs emerge as integer linear combinations of these bases, forming a latent program lattice. Program induction then reduces to solving a Closest Vector Problem (CVP) (Micciancio and Goldwasser, 2002) which find a vector such that minimize the distance where is arbitrary target vector in lattice . Moreover, abstraction discovery is achieved through lattice reduction (W¨ubben et al., 2011), which refines non-atomic programs into shorter, more orthogonal primitives spanning the same lattice. Lattice program space naturally supports dual-process reasoning (Frankish, 2010). For System-1 inference, PLAE encodes observed input–output pairs, takes their difference as a latent program effect, adds this effect to a new input’s embedding, and decodes—fast, intuitive, approximate. For System-2 inference, PLAE factorizes the same effect into a sequence of basis and executes them stepwise—repeatedly decoding/encoding in a guided “lattice walk” that verifies and refines intermediate states. Both modes arise from the same latent structure, with System-2 improving the basis via lattice reduction and thereby strengthening future System-1 inferences. In this way, PLAE integrates learning, inference, and abstraction into a unified framework for compositional reasoning.
Program Lattice Auto Encoder (PLAE)
Task
Consider a set of m example input-output pairs where the output object is generated by applying a consistent program on the corresponding input object . For a new input , the model should predict the corresponding output that would be generated by applying the same consistent program . The program for each task is a composition of programs from a set of primitive programs .
Learning the Compositional Structure (Training)
From given input-output pairs , the model can only observe the apparent effect of applying the underlying consistent program. PLAE models this as latent program effect by embedding each input and output into vectors with an encoder , and averaging (pair permutation invariant aggregation) the difference vectors.
The underlying programs for the first tasks are treated as the initial set of primitive programs, and the latent program effects from a latent program basis matrix where .
Modeling program composition as an integer linear combination of latent program basis, the latent program basis spans a latent program lattice whose lattice points corresponds to the latent program effects of valid discrete composition of primitive programs.
As a result, an integer vector corresponding to a lattice point on this latent program lattice represents how many of each primitive program are composed in the corresponding program.
Since vector addition is commutative while program composition is not, we introduce small perturbations for each basis at position . These perturbations, bounded by the lattice packing radius, preserve CVP solutions while encoding operation order.
The encoder is parameterized and trained to model the compositional structure as a discrete lattice by minimizing the deviance from the additive structure in latent program space:
Poster
![[Poster]Composed-Program-Induction-with-Latent-Program-Lattice.pdf](/api/media/file/%5BPoster%5DComposed-Program-Inuduction-with-Latent-Program-Lattice.png)