// symbolic policy study

ISRE
KAN versus MLP

ISRE is an experimental system for simplifying algebraic expressions. It breaks an expression into a tree, lists the legal simplification moves, and asks a small neural policy to choose the next move. The core question is simple: can a KAN policy do this job with fewer parameters, less wasted compute, and more interpretability than an MLP?

ISRE search tree over legal algebraic rewrites A real v7 expression branches into every legal next expression. Each surviving state branches again. Greedy keeps one path, beam search keeps five, and breadth-first search supplies the shortest-path reference. STATE / DEPTH 0 CURRENT EXPRESSION (1 + 5) * x LEGAL NEXT STATES / DEPTH 1 ONE RECORDED V7 STATE EXPOSES 22 CANDIDATES EXPAND @ NODE 0 (x * 1) + (x * 5) SORT_COMMUTATIVE @ NODE 0 x * (1 + 5) FOLD_CONST @ NODE 1 6 * x SELECTED / GOAL REACHED IN 1 STEP EXPAND EVERY SURVIVING STATE / DEPTH 2 COMBINE_COEFF 6 * x CANONICAL REMOVE_ONE x + (x * 5) SORT @ NODE 1 (1*x) + (x*5) SORT @ NODE 4 (x*1) + (5*x) EXPAND (x*1) + (x*5) FOLD_CONST x * 6 THE TREE CONTINUES UNTIL CANONICAL FORM OR MAX STEPS CANONICAL TARGET 6 * x GREEDY keeps the highest-scored branch BEAM-5 keeps five accumulated paths per depth BFS REFERENCE measures the shortest available route THE ENGINE BUILDS THE SEARCH SPACE / KAN OR MLP SUPPLIES THE RANKING
Current expression (1 + 5) * x
EXPAND (x * 1) + (x * 5)
SORT x * (1 + 5)
FOLD_CONST 6 * x
Selected route goal reached in 1 step
SCROLL

// plain terms

What this project does.

The algebra rules are already known. The hard part is choosing the right next rule, at the right place in the expression, while keeping the route short and clean.

ISRE

Interpretable Symbolic Reasoning Engine. It takes an algebra expression, turns it into an AST tree, lists possible simplification moves, chooses one move, applies it, and repeats. The goal is a correct simplification path with visible reasons for each step.

Symbolic engine

The deterministic part. It uses fixed algebra rules to check the current expression and return legal moves such as REMOVE_ZERO, FOLD_CONST, MERGE_POWER, SORT_COMMUTATIVE, EXPAND, or COLLECT_TERMS.

Policy

The learned decision-maker. Given the current expression and the legal moves, it scores every candidate action and chooses the next one. Weak choices can still simplify the expression while making the path longer and less optimal.

MLP

The standard neural baseline. An MLP is a stack of dense layers. It is familiar, strong, easy to train, and a fair comparison point. The drawback is that its decisions are hard to inspect: it can work well without giving a clean view of which symbolic features mattered.

KAN

The alternative policy head. KAN can be more interpretable because it learns small feature-wise functions instead of mixing everything through dense matrix layers. In this project, raw KAN had too little representation power on its own and needed an encoder.

Encoder-KAN

The successful version. First, an AST encoder reads the expression tree and builds a richer representation. Then KAN scores the legal moves. This version became competitive while staying much smaller than the large MLP baseline.

What we compare

We compare raw KAN, KAN with an action embedding, Encoder-KAN, small MLPs, and a larger MLP-128 baseline. The main question is which policy chooses near-optimal simplification steps with fewer parameters and less waste.

// mechanism

One expression. Several legal moves. The model chooses the next one.

For every state, the symbolic engine produces a menu of legal actions. The neural policy ranks that menu. This separation keeps algebraic legality deterministic, learns the judgment step, and lets the route be measured against BFS-optimal paths.

Input AST (x + 0) * x^2
Symbolic engine REMOVE_ZERO / MERGE_POWER / FOLD_CONST
Policy score rank(node, action)
Next AST x^3

// concrete choices

What the policy actually sees.

Each state becomes a small menu. The correct move depends on local algebra and on the global expression context.

CASE_01

Remove neutral structure

The engine finds a zero term inside an addition. The policy should prefer the simplification that changes nothing semantically and reduces the tree.

state: Add(x, 0) candidates: REMOVE_ZERO, SORT_COMMUTATIVE chosen: REMOVE_ZERO -> x

CASE_02

Merge repeated powers

For multiplicative structure, a variable can behave like a hidden first power. The policy must learn that this is part of the same algebraic pattern.

state: Mul(x, Pow(x, 2)) candidates: MERGE_POWER, SORT_COMMUTATIVE chosen: MERGE_POWER -> Pow(x, 3)

CASE_03

Fold constants when safe

The engine offers constant folding when a numeric subtree is available. The policy learns when that local compression advances the full canonical path.

state: Add(2, 3, x) candidates: FOLD_CONST, SORT_COMMUTATIVE chosen: FOLD_CONST -> Add(5, x)

// comparison

KAN and MLP depend on the representation they receive.

Raw KAN used thin hand-made features. The MLP family had stronger learned representations in the comparison, so raw KAN tested a narrow version of the idea. Encoder-KAN added an AST encoder before the KAN head, giving KAN a comparable expression representation. With that encoder, the KAN policy became much smaller than MLP-128, beat it on greedy rollout, and nearly matched the strongest micro-MLP.

94.63% mean greedy BFS-optimal across 3 seeds
99.53% mean beam-5 BFS-optimal
15,528 parameters in the Encoder-KAN policy

// findings

KAN became competitive through compression with structure.

KAN became strong after the encoder gave it a useful expression representation. At that point the model became small, competitive, and easier to reason about.

Smaller than MLP-128

Encoder-KAN reached 94.63% mean greedy BFS-optimal with 15,528 parameters. The MLP-128 baseline had 474,753 parameters and reached 89.4% greedy BFS-optimal. That is roughly a 30x parameter reduction while improving the rollout result.

Less compute waste

This run used parameter count and model size as the practical efficiency evidence. Fewer parameters usually mean less memory movement and less compute per step. In practical terms, Encoder-KAN is the lighter policy to train and run than the large MLP baseline.

More interpretable head

KAN is attractive because its learned pieces can be inspected more like feature-wise curves. MLP dense layers are effective and familiar, yet harder to turn into a clear rule-level story.

Still honest

The strongest micro-MLP h32 slightly wins greedy rollout: 95.0% versus 94.63% for the best stable Encoder-KAN group. The result is a competitive KAN policy with the right encoder and a much smaller parameter count.

// larger frame

Why this small algebra test matters.

Modern Transformer systems are built from attention plus large feed-forward blocks. In many architectures, the feed-forward part is MLP-like. Mixture-of-Experts scales that idea by routing tokens through different expert networks. This makes MLP-style computation one of the main workhorses of current AI systems.

Current pattern

Transformers use learned dense computation as a central building block. MoE adds routing and many experts, increasing capacity while trying to spend compute selectively.

Open question

The question is whether every small decision module needs to be an MLP-shaped black box. Symbolic reasoning tasks give a clean place to test alternatives because every legal move and every rollout path can be inspected.

KAN angle

KAN may offer a different computational apparatus: smaller, more structured, and easier to inspect when the input representation is good. In ISRE, raw KAN struggled, while Encoder-KAN became competitive after receiving an AST representation.

Research value

This project is a controlled miniature. It avoids a direct replacement claim for Transformer MLP blocks. It shows a place where a KAN-based scorer can compete with MLP baselines while using far fewer parameters.

// geometry

The winner came from geometry, representation, and scale.

Several wider heads produced weaker rollout quality. The best point emerged from representation quality, bottleneck width, and encoder message-passing rounds.

KAN bottleneck and head sweep map A monochrome scatter map showing that KAN performance changes non-monotonically across architecture choices.

// raw-backed ledger

A compact leaderboard with the main comparison.

The strongest micro-MLP narrowly leads greedy rollout. Encoder-KAN matters because it resolves the raw KAN representation gap, beats the large MLP-128 baseline, and reaches the same beam-5 regime with far fewer parameters.

Model Family Params Greedy Beam-5 Overhead

// conclusion

KAN needed a representation that respected the structure of the problem.