Papers
Topics
Authors
Recent
Search
2000 character limit reached

Neuro-symbolic Syntactic Parsing: Shaping a Neural Network with the CYK Algorithm

Published 29 May 2026 in cs.CL, cs.AI, and cs.DS | (2605.31421v1)

Abstract: In this paper, we show the possibility of a direct injection of algorithms into neural network architecture. We focus on a complex algorithm, that is, Cocke-Youger-Kasami (CYK) for parsing context-free grammars in Chomsky Normal Form and we propose CYKNN, a simple recurrent neural network architecture for encoding the CYK algorithm in trainable matrix-vector multiplications.We experimented with a very simple grammar with 4 variations showing that our approach outperforms existing LLMs with more than 20B parameters with an in-context learning setting and smaller LLMs of the Qwen family fine-tuned with LoRA. Our attempt paves the way to a different approach to neuro-symbolic methodologies.

Summary

  • The paper introduces CYKNN, a neural architecture that directly encodes the CYK algorithm for efficient context-free parsing.
  • CYKNN uses holographic reduced representations to embed grammar rules and parse table cells, enabling holistic parallel updates.
  • Empirical results show CYKNN outperforms transformer models in F-measure, highlighting the benefits of explicit algorithmic structure.

Neuro-Symbolic Syntactic Parsing: CYKNN—Direct Algorithmic Induction via Matrix-Structured Neural Networks

Introduction and Motivation

This work addresses a foundational question at the intersection of neuro-symbolic computation and syntactic parsing: can known, discrete symbolic algorithms be directly injected into neural network architectures, leveraging their parallel linear algebraic machinery rather than relying on indirect, data-driven induction? The authors instantiate this approach for the Cocke–Younger–Kasami (CYK) algorithm, central in context-free grammar (CFG) parsing, by proposing CYKNN—a recurrent neural variant encoding CYK operations in compositional matrix-vector multiplications. This direct encoding contrasts with the current paradigm where model architectures such as Transformers attempt to recover algorithmic structure purely by pattern induction from exemplars, burdening networks with tasks well-specified symbolically and ultimately demanding broad, nontrivial algorithmic generalization.

The paper's position is motivated by empirical studies indicating that, despite claims about algorithmic capabilities emerging through pretraining or fine-tuning [mirzadeh_gsm-symbolic_2025; shojaee_illusion_2025], LLMs and related architectures routinely fail to extrapolate symbolic reasoning beyond targeted memorization and often induce fragile or partial reasoning circuits [li_grokking_2026; nanda_progress_2023].

CYKNN: Neural Instantiation of CYK Parsing

The central technical contribution is CYKNN, a neural computation designed to operate transparent, holistic updates analogous to the CYK parsing table, by encoding both grammar rules and table cells in Holographic Reduced Representations (HRRs). Each symbol, index, and rule is embedded in Rd×d\mathbb{R}^{d \times d} via circulant and permutation matrices, supporting associative and approximately invertible matrix algebra. Table entries are constructed so that, e.g., a symbol AA spanning [i,j][i, j] is encoded as $\mysc{i}\mysc{A}\mysc{j}$. This compositionality allows update steps which, instead of sequential for-loops, deploy a “holistic" signal propagation:

$\CYKmatrix{P}' = \CYKmatrix{P}\CYKmatrix{R}\CYKmatrix{P}$

with $\CYKmatrix{R}$ embedding the full set of binary rules in a form supporting distributed application.

This key perspective is captured visually in the network outline and operational module:

Figure 1

Figure 1

Figure 1

Figure 1: Learning abilities of the CYKNN model family.

The design affords direct interpretability and theoretically enables parallel computation, effectively collapsing the inherently cubic symbolic complexity of CYK into rapid, signal-driven masking and summing operations on compositional distributed structures.

Architecture and Algorithmic Modules

CYKNN is architected as a stack of specialized modules:

  • Holographic Encoder (He): Encodes token spans.
  • Unary Module (U): Applies unary productions via matrix-masked sums.
  • Binary Module (B): Performs algorithmic binary branching using distributed rule aggregation, as above.
  • Diagonal Decoder (Dd): Decodes/denoises the distributed table back to explicit span-labeled entries, also re-injecting purified signals for recursive update.

The Diagonal Decoder algorithm's mechanism is visually illustrated as follows:

Figure 2

Figure 2: Dd($\CYKmatrix{P}$, vv) module: extracts span label predictions from distributed representations on diagonal vv.

By sequentially applying these modules across string lengths and grammar complexities, the architecture robustly computes parse charts for arbitrary context-free sentences, provided suitable initialization.

Empirical Analysis and Results

Experimental Protocol

The evaluation protocol contrasts CYKNN (with grammars either encoded or randomly initialized) against both fine-tuned and in-context-prompted transformer LLMs (Qwen2.5-1.5B-Instruct, Qwen3-8B, OpenAI’s gpt-oss-20B, and Gemma-3-27B-it), using a simple but non-trivial CNF grammar and a dataset comprising over 5,000 synthetic parse sequences. Models are scored on precision, recall, and F-measure with respect to an oracle-produced CYK parse table, both on short (“Small Test”) and long (“Full Test") string splits.

Algorithmic Performance and Comparative Analysis

CYKNN configurations initialized with the correct grammar exhibit uniformly superior F-measure over both fine-tuned LLMs and larger LLMs under in-context prompting; see the relative performance for both short and long test sets in:

Figure 3

Figure 3

Figure 3: CKYNNs versus fine-tuned and in-context large LLMs: f-measure as a function of sequence length.

Even with random initialization, CYKNN demonstrates competitive performance, but the gap with LLMs is more pronounced on shorter sequences, underscoring the crucial role of explicit, algorithmic encoding. Neither attention-based LLMs nor their fine-tuned variants can reliably compute the requisite compositional structure for CYK parsing unless presented with extreme quantities of data or massive model scaling; the “conservatism" of gpt-oss-20B reflects shallow pattern completion rather than principled parsing.

When analyzing the impact of embedding space dimensionality and grammar complexity, CYKNN exhibits predictable scaling: increasing dd improves capacity and denoising, and more complex grammars induce slower convergence but learnable structure.

Figure 4

Figure 4: CYKNN performance as a function of representation space dimensionality AA0, showing monotonic improvements up to AA1.

Figure 5

Figure 5: Effect of grammar complexity—more distractors in binary and unary rules slow learning but do not preclude ultimate convergence.

Detailed ablation shows that removal of context-free structure degrades performance, confirming that the architecture’s success is due to explicit alignment with algorithmic invariants rather than network memorization.

Theoretical and Practical Implications

CYKNN operationalizes a form of algorithmic neuro-symbolic integration with the following implications:

  • Expressivity Alignment: By directly imposing known symbolic operations in differentiable form, the network avoids vacuous memorization and collapses search spaces intractable for plain transformers.
  • Architectural Interpretability: All manipulation of distributed parses and rules remains transparent and decomposable, supporting analysis and injection of prior knowledge.
  • Algorithmic Efficiency: While the present implementation is optimized for clarity, not runtime, the “holistic” update principle points to future architectures where algorithmic bottlenecks (e.g., AA2 parsing) may be collapsed via linear algebraic batch operations.

Practically, this establishes a pathway for neural architectures that are not only trained to fit, but are constructed to implement known algorithmic procedures—enabling hybrid reasoning, debugging, and theoretical analysis previously inaccessible in black-box deep learning systems.

Limitations and Scope

The current experiments focus on relatively simple CFGs; scaling to highly ambiguous, large grammars or noisy, real-world text inputs remains challenging and will require further advances. The computational overhead for matrix-based distributed representations, particularly at high embedding dimensions, is nontrivial, and practical runtime optimization is an open engineering problem. The theoretical expressivity of such architectures for more elaborate symbolic tasks (e.g., non-context-free structures) must also be rigorously analyzed.

Future Prospects

Extension of the direct algorithmic injection methodology (as exemplified by CYKNN) suggests a generic template for neuro-symbolic computation:

  • Direct induction of stack-based, pushdown, or even Turing-complete automata as sets of trainable matrix operations.
  • Composable neuro-symbolic layers where known subroutines (e.g., arithmetic, graph traversal) are implemented directly, integrated with learned modules.
  • Interpretability and editability for neural systems in sensitive domains where “reasoning step” disclosure and formal property enforcement are critical.

Conclusion

CYKNN concretely demonstrates a new direction for neuro-symbolic integration: constructing neural architectures to instantiate known algorithmic procedures, leveraging distributed representations to collapse recursive symbolic reasoning into differentiable, parallelized computations. In the context of context-free parsing, this approach decisively outperforms generic pattern-based LLMs and points toward a broader paradigm where neural networks are not forced to “discover” well-specified algorithms from data, but are instead architected to realize them directly—blending the rigor and reliability of symbolic methods with the scalability and representation power of modern deep learning.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.