---
title: Neuro-Symbolic Concept Learner
url: https://www.emergentmind.com/topics/neuro-symbolic-concept-learner-ns-cl
type: topic
---

# Neuro-Symbolic Concept Learner

The Neuro-Symbolic Concept Learner (NS-CL) is a unified model for jointly inducing object-level visual concepts, word representations, and a semantic parser that maps natural language to symbolic reasoning programs—using only natural supervision from paired images, questions, and answers. NS-CL constructs an explicit object-centric scene representation, composes a symbolic program in a restricted domain-specific language (DSL) for each input question, and executes that program in a differentiable neuro-symbolic reasoning module to produce answers. The entire system is trained end-to-end; all supervision is derived from final answers, with no annotation for concept labels or programs and no entailed explicit mapping between objects and words [1904.12584].

## 1. System Architecture

NS-CL consists of three interconnected modules:

1. **Perception module** ($f_\mathrm{img}$): Maps an input image $I$ to object-centric deep features $\{o_1, \ldots, o_n\}$ and attribute-specific features $\{z_1, \ldots, z_n\}$. Mask R-CNN proposes bounding boxes, and each crop is RoI-aligned and processed by ResNet-34, concatenated with a global image feature, giving $o_i \in \mathbb{R}^d$.

2. **Semantic parsing module** ($\pi_\mathrm{lang}$): Converts a question $Q$ into a distribution over symbolic programs $P$ in a compact DSL. Architecture includes a bi-directional GRU encoder and a recursive, sequence-to-tree decoder emitting program operators and concept parameters, producing compositional trees with nodes such as Filter, Relate, Count, Query.

3. **Neuro-symbolic reasoning module** (EXEC): Executes programs $p$ on sets of object representations $\{o_i, z_i\}$ to return an answer $\hat{y}$. Execution is implemented as a deterministic interpreter using differentiable functional operations, enabling joint training of upstream modules via answer-level loss gradients and reinforcement or off-policy updates for the parser.

All modules are optimized end-to-end, with answer cross-entropy gradients flowing into the perception stack and REINFORCE or off-policy search driving the parser [1904.12584].

## 2. Perception and Concept Quantization

NS-CL forms an explicit object-based scene structure, supporting composable concept learning:

- **Object proposals:** Mask R-CNN generates candidate bounding boxes. Each is RoI-aligned, processed by ResNet-34, and concatenated with a global image feature for the object vector $o_i$.
- **Attribute operators:** For each attribute $a \in \{\text{Color, Shape, Material, Size}, \ldots\}$, a dedicated MLP $u^a: \mathbb{R}^d \rightarrow \mathbb{R}^{d'}$ maps to attribute subspace. Each category concept $oc$ (e.g., "Red," "Cube," "LeftOf") is represented by a learned vector $v^\mathrm{oc}$ in the attribute space.
- **Concept quantization:** For object $o_i$ and concept $oc$ of attribute $a$, the probability is computed:
  $$
  p(oc|o_i) = \sigma\left(\frac{\langle u^a(o_i), v^{oc} \rangle - \gamma}{\tau}\right)
  $$
  where $\sigma$ is the sigmoid, $\langle\cdot, \cdot\rangle$ is cosine similarity. For relations (e.g., LeftOf), concatenated object pairs $o_i \oplus o_j$ are similarly scored.
- **Supervision:** No attribute labels are available; all supervision comes via the cross-entropy loss on generated answers, implicitly sculpting the concept embeddings during curriculum-based training.

This structure allows learning both attribute and relation concepts and grounding language directly in perception without explicit annotation [1904.12584].

## 3. Semantic Parsing and Program Induction

The semantic parsing module grounds questions into symbolic programs using weak supervision:

- **Encoding:** A 2-layer bi-GRU encodes $Q$ to final state $f_0 \in \mathbb{R}^H$.
- **Decoding:** A recursive, sequence-to-tree decoder (composed of an operator decoder, a concept decoder, and small per-node RNNs) emits operator–concept pairs forming the parse tree $P$.
- **Domain-specific language (DSL):** Programs are constructed from operators over sets and objects:
  - Scene() $\rightarrow$ ObjectSet
  - Filter(ObjectSet, ObjConcept) $\rightarrow$ ObjectSet
  - Relate(Object, RelConcept) $\rightarrow$ ObjectSet
  - Intersection, Union, Query, Exist, Count, and various attribute and relational queries

- **Learning:** Programs are not directly supervised. Instead, REINFORCE or off-policy search optimize the expected reward:
  $$
  R(\Theta_s) = \mathbb{E}_{P\sim\pi_\mathrm{lang}(Q; \Theta_s)}[r(P)]
  $$
  with $r(P) = 1$ if EXEC$(P,$ Perception$(I; \Theta_v)) = A$, else 0. Variance is reduced by enumerating all correct-answer-producing small programs and maximizing their aggregate probability.

This approach entangles semantic parsing with perceptual grounding and compositional reasoning, all from answer-level signals [1904.12584].

## 4. Neuro-Symbolic Reasoning and Execution

The reasoning module interprets induced programs over the soft, object-centric scene graph:

- **Data structures:** Sets and objects are represented as "soft masks" $\mu \in [0,1]^n$, with $\mu_i$ the probability that object $i$ is present. Singletons are masked via softmax for sharpness.
- **Operators:** The DSL is executed via differentiable operators, e.g.,
  - Filter$(\mu, oc): \mu'_i = \min(\mu_i, p(oc|o_i))$
  - Relate$(\mu, rc): \mu'_i = \sum_j \mu_j \cdot p(rc|o_j, o_i)$
  - Count$(\mu) = \sum_i \mu_i$
  - Query$(\mu, a):$ For each concept $oc$ of attribute $a$,
    $$
    \text{Pr}(oc) = \frac{\sum_i \mu_i \cdot p(oc|o_i)}{\sum_{oc'} \sum_i \mu_i p(oc'|o_i)}
    $$
- **Differentiability:** All operations (min, sum, sigmoid, softmax) are differentiable in $o_i$. Thus, answer losses backpropagate through execution to perceptual and concept parameters.

This hybrid interpreter guarantees deterministic, fully differentiable neuro-symbolic reasoning with transparent execution traces [1904.12584].

## 5. Staged Learning and Optimization

NS-CL uses curriculum learning and end-to-end optimization:

- **Curriculum phases:**
  - Stage 1 ("Object concepts"): Few ($\leq$3) objects per scene, only basic attribute or counting questions; builds initial concept space.
  - Stage 2 ("Relational concepts"): Adds relational and compositional queries (e.g., "cube to the left of the sphere"); perception module frozen.
  - Stage 3 ("Full complexity"): All CLEVR questions, up to 10-object scenes, arbitrary program depth; after a period of fixed parser and executor, joint fine-tuning is performed.
- **Optimization objective:** The joint loss is
  $$
  L(\Theta_v, \Theta_s) = \mathbb{E}_{(I, Q, A)}[-\log \Pr(A \mid \text{EXEC}(\pi_\mathrm{lang}(Q; \Theta_s), \text{Perception}(I; \Theta_v)))]
  $$
  This obviates the need for separated concept or parse losses, relying solely on end-to-end QA supervision.

The curriculum strategy aligns with human-like concept acquisition, facilitating efficient and stable training [1904.12584].

## 6. Empirical Performance and Generalization

NS-CL achieves state-of-the-art results on visual question answering, compositional generalization, and transfer:

| Task / Domain                        | NS-CL Performance      | Comparative Baselines         |
|--------------------------------------|------------------------|------------------------------|
| CLEVR val (Color/Shape/Mat./Size)    | ≈99% classification    | –                            |
| CLEVR VQA, 10% training data         | 98.9% accuracy         | FiLM, MAC, TbD: 55–68%       |
| CLEVR VQA, full training (no programs)| 98.9% accuracy        | TbD (w/ 700k programs): 99.1%|
| CLEVR Compositional splits           | ≈99% in all 4 splits   | Implicit models degrade 4–8% |
| CLEVR-CoGenT (novel combos)          | 98.8/98.9% (A/B)       | –                            |
| Incremental concept: "Purple"        | 93.9% (vs IEP: 89.3%)  | TbD: 87.8%                   |
| Cross-DSL image–caption retrieval    | 97%                    | CNN-LSTM: 68.9%              |
| Minecraft domain (no program labels) | 93.3%                  | NS-VQA: 87.7%                |
| Real-image VQA (VQS)                 | 44.3%                  | MLP: 43.9%, MAC: 46.2%       |

NS-CL demonstrates robust generalization to novel attribute compositions (CoGenT), compositional scene splits (scene size, program depth), new domains (image–caption retrieval, Minecraft), and rapid incremental learning of new concepts ("Purple") from minimal supervision. The model yields transparent execution traces via the neuro-symbolic interpreter, aiding interpretability—a property not generally available in purely neural baselines [1904.12584].

## 7. Implementation and System Parameters

- **Framework:** PyTorch, publicly available.
- **Optimization:** Adam optimizer; learning rate annealed from $1 \times 10^{-4}$ to $5 \times 10^{-5}$, batch size ≈32.
- **Perceptual backbone:** Mask R-CNN (pretrained on 4k CLEVR bounding boxes), ResNet-34 (ImageNet-pretrained).
- **Parser architecture:** 2-layer bi-GRU (hidden 512), word embedding (256 + DPOS 128), decoding via 2-layer MLPs (OpDecoder and ConceptDecoder).
- **Curriculum control:** Data loader switches and task replay between stages.
- **Semantic parsing:** Beam/off-policy search, beam size ≈5; all small programs yielding correct answer are aggregated for parser updates.

NS-CL is engineered for modularity and compositionality, leveraging established vision and language models with novel neuro-symbolic integration and supervision exclusively via QA signals [1904.12584].

Source: https://www.emergentmind.com/topics/neuro-symbolic-concept-learner-ns-cl