Introducing Neumathway: Exploring Neural-Symbolic AI for Mathematical Reasoning

Hi everyone!

I’d like to share Neumathway, an experimental open-source AI project I’m developing to explore a different approach to mathematical reasoning.

Unlike conventional language models that generate answers through text prediction, Neumathway explores a neural-symbolic approach, combining neural networks with symbolic mathematical computation to work with mathematical expressions and problems.

What’s interesting about Neumathway?

  • 8.27 million training samples used to train the model.

  • 2.47 million parameters, making it a relatively compact model.

  • A neural-symbolic architecture designed to combine learned representations with structured mathematical reasoning.

  • Support for multiple mathematical domains, including arithmetic, linear equations, systems of equations, differentiation, integration, limits, and matrix operations.

The goal is to explore whether a relatively small, specialized model can perform mathematical reasoning more reliably by combining neural learning with symbolic computation, rather than relying on text generation alone.

Why am I building this?

Large language models have made impressive progress, but mathematical reasoning still presents interesting challenges. I wanted to explore an alternative architecture that treats mathematical problems as structured expressions rather than ordinary text.

Neumathway is an ongoing experiment, not a claim that these challenges have been completely solved. It has limitations, and I’m continuing to investigate its capabilities, reliability, and performance.

I’d love to hear your thoughts!

I’m sharing Neumathway with the Hugging Face community to get feedback, discuss the architecture, and learn from others working on neural-symbolic AI, mathematical reasoning, and small specialized models.

If you’re interested, feel free to explore the model and share your thoughts!

:link: Model: BhinnekaAI/neumathwork-v1 · Hugging Face

:laptop: GitHub: GitHub - christopherhamonangan/Neumathway: Neumathway (NMN): A lightweight Neuro-Symbolic AI engine combining Graph Attention Networks (GAT), Recurrent GRU, and exact rational verification. Solves K-12 algebra to undergraduate calculus and linear algebra with 100% soundness and zero hallucination. Pretrained on 8.27M verified samples by Christopher Alberto Hamonangan. · GitHub

Neumathway is an experimental open-source project, and contributions and feedback are welcome.

Thanks for reading!

For now, I tried running a little of the public code:


Thanks for sharing Neumathway. What interests me most is the proposed division of labor: a compact learned component recognizes mathematical structure or helps choose a step, while a symbolic component performs and checks the operation. That seems like a useful direction to explore independently of text-based answer generation.

I looked at the repository, the model card, and a few runnable paths. The two things I would prioritize are showing where a neural prediction changes a symbolic step and making the meaning of a successful result unambiguous. Both could make the experiment easier to understand, test, and extend without changing its research goal.

Scope: These are local CPU checks of public code corresponding to commit 4f3f9054, run on October 28, 2026. I tested parser/evaluator functions and a separate checkpoint-loading/forward pass. I did not retrain the model, reproduce the full published validation, or test a deployed service. An observation on one entrypoint does not establish the behavior of another app branch or a newer research version.

A few observations

There is a working narrow exact-arithmetic path. 1+2*3 returned 7, 1/2+1/3 returned 5/6, and sqrt(9/4) returned 3/2. In 120 deliberately shallow, generated rational-arithmetic controls, all results matched a separate Python Fraction oracle. This is a useful sanity check for that limited domain, not a mathematical-accuracy score or a test of neural reasoning.

The boundaries of that path need clearer result semantics. On MathTextParser.parse(...) followed by evaluate_expression_tree(...), I observed:

Input                     Returned value   Status    Mathematical interpretation
------------------------  ---------------  --------  ---------------------------
1/2+1/3                   5/6              OK        Exact rational control
sqrt(9/4)                 3/2              OK        Exact rational root
sqrt(2)                   1                OK        Exact value is irrational
1.5+2                     3                OK        Decimal input would mean 3.5
pow(2,-1)                 0                OK        Exact answer is 1/2

A deliberately restricted rational-only evaluator is a reasonable prototype. The issue is not that it must handle every function today: an input outside the supported grammar or number domain should be visibly unsupported (or approximate), rather than yielding a different value labeled OK. Likewise, an unfinished reduction needs a different status from a verified result.

There is one useful cross-check against the advertised interface: the model card includes diff(...)-style syntax, while diff(3*x^2+4*x) returned 3 / OK through this generic parser/evaluator path. This does not establish that a dedicated calculus handler, a different UI branch, or a later version cannot differentiate; it points to the value of documenting which entrypoint implements which capability. In other boundary checks, 1/0 and sqrt(-1) did raise explicit errors, so error handling is already present for some cases.

The neural checkpoint and the public generic expression route are distinct in the code I checked. I could instantiate the model defined in train_nmn.py, load the checkpoint, and run a compatible forward pass. But the checked route in app.py calls the symbolic evaluator, and symbolic_engine.py selects the first reducible node (redexes[0]). I did not see learned scores select the reduction on that path. This may simply be a deliberate distinction between the public demonstration and the research pipeline.

The smallest useful next example

If an integrated learned-action loop already exists, one genuine trace would explain more than a large aggregate score. If it does not yet exist, a minimal mapping from learned outputs to permitted symbolic actions would be useful on its own. For example, this is a suggested reporting shape, not a Neumathway result I observed:

Input and goal:         supported expression and desired task
Parsed state:           typed AST / graph for that expression
Legal candidate moves:  (node, rule, preconditions)
Neural output:          scores or ranking for those candidates
Chosen action:          selected node and executable rule
Symbolic check:         accepted / rejected, plus assumptions
Updated expression:     state after the verified rewrite
Final status:           solved / incomplete / unsupported / error

Depending on the current implementation, the natural next step differs:

  • Neural action selection already integrated: show one real input, candidates, scores, chosen rewrite, and result. Then compare that example with deterministic symbolic selection under the same rules and budget.
  • Model and symbolic app still separate: show the intended feature encoding, operator-label mapping, and action interface. No end-to-end neural-versus-symbolic accuracy claim is needed at this stage.
  • Integration lives in another branch or entrypoint: linking that revision would let interested readers evaluate the right system.

The detailed notes below are optional design and test ideas, not a request to implement everything before continuing the experiment.

1. Exactness, parsing, and what an OK result means

A narrow supported domain can be a strength

Shallow exact-rational arithmetic worked in the controls. But sqrt(2), decimal literals, and negative powers show why accepting text and preserving its mathematical meaning need separate checks. Without that boundary, errors in parsing or execution can be misattributed to a neural controller that never ran.

In the checked code, the parser’s tokenization and grammar recognize only a restricted set of patterns. An unsupported symbol or an unconsumed suffix can cause the expression’s meaning to change if there is no complete-input check. For example, a decimal point must not be silently ignored when the intended grammar recognizes only integer literals. Similarly, a function call recognized merely as a prefix must not be reported as a complete parse of the user’s original expression. The smallest high-value parser invariant is that a successful parse consumes the entire input and preserves the intended token boundaries. Anything else should be an explicit invalid/unsupported-input outcome.

This need not require a large parser: a restricted lexer and small grammar are enough if successful parsing never silently accepts only part of the input.

parse_success(text):
  - no invalid or unconsumed tokens
  - entire input belongs to the declared grammar
  - precedence and unary signs have documented meanings
  - serialization or AST inspection preserves that meaning

parse_failure(text):
  - identifies invalid syntax versus unsupported syntax
  - does not return a partial expression as a verified answer

The grammar can expand incrementally. What matters first is that its accepted inputs have unambiguous meaning.

Exact rational, exact symbolic, and approximate are distinct

Python’s Fraction is excellent for expressions that truly have rational values. It does not by itself make an approximation exact. If a floating-point sqrt(2) is rounded to 1 and then stored as Fraction(1), the result’s type looks exact while its mathematical content is not. Similarly, pow(2,-1) has an exact rational answer, 1/2, but converting the floating-point output of exponentiation to an integer loses it.

These are different design cases:

Input family Useful policy if supported Coherent narrow-scope alternative
Integer/rational arithmetic Exact Fraction evaluation Not needed: already in scope
Negative integer powers Exact reciprocal when defined Reject until a rational-power rule is added
Non-square rational roots Preserve an exact radical such as sqrt(2) Report exact-symbolic unsupported
Decimal literals Parse with stated decimal semantics Reject clearly instead of dropping the point
Exponential/log/trigonometric values Exact symbolic value or labeled approximation Restrict to a documented set of exact cases
Algebra, calculus, matrices Typed symbolic structures and domain-specific handlers Label domain as planned or separately implemented

For functions such as exp(1) or ln(2), a displayed approximation is not inherently wrong; the problem is reporting it as an exact equality without an approximation policy. In another local boundary check, exp(1) returned 3 / OK and ln(2) returned 69/100 / OK through the checked executor. Those results are useful illustrations of the difference between an estimated display value and an exact symbolic result, not representative evidence about the entire project.

Mathematical assumptions belong with a rewrite

As the grammar grows, some transformations are only valid under conditions. Over the real numbers, sqrt(x^2) is abs(x) unless assumptions justify simplifying it further. Dividing an equation by an expression that could be zero can discard possible solutions. A logarithm has domain restrictions. A rule that is perfectly correct under one set of assumptions can be incorrect outside it.

This is where the symbolic component can provide a valuable guarantee: the learned part may propose a rule, but the rule executor checks the preconditions. The neural score should not override the mathematical check. The SymPy assumptions guide explains this general issue, although a custom research engine could implement a much smaller assumptions table appropriate to its supported domain.

Illustrative preconditions might be:

divide(a, b):       allowed only if b != 0
real_sqrt(q):       allowed only if q >= 0; result representation is explicit
real_log(q):        allowed only if q > 0
cancel_factor(x):  preserve nonzero assumptions and excluded solutions
quadratic_roots:    check a != 0 and verify candidates by substitution

For example, if a quadratic helper emits candidate roots, checking them in the original polynomial is a cheap postcondition. In a local helper-level test, x^2-2=0 produced the incorrect candidate pair -1, 1; neither candidate satisfies the equation. That observation is about the pinned helper function and its irrational-root boundary, not a test of the entire neural system. It suggests a useful separation between candidate generation, validity checking, and unsupported exact representation.

Completion needs an explicit state

The checked generic evaluator iterates over reducible nodes with a bounded number of steps. A 28-term sum of ones exhausted the reduction budget and produced a None value with the status OK at the function boundary. A bounded reducer is entirely reasonable; its result should simply distinguish “finished” from “stopped.” Otherwise a reporting layer or a benchmark may accidentally count an unfinished computation as a successful one.

A compact proposed result contract could be:

parse:          complete | invalid | unsupported
execution:      solved | partial | unsupported | domain_error | error
result_kind:    exact_rational | exact_symbolic | approximate | none
value:          final value / expression, or null
verification:   passed | failed | unknown | not_applicable
metadata:       assumptions, precision (if relevant), remaining AST,
                step count, and optional trace

A simple progression would be: (1) complete input consumption, (2) correct exact-rational controls, (3) domain preconditions, (4) exact/approximate/unsupported separation, (5) reliable termination status, and (6) optional final-answer substitution checks. This progression can be tested without modifying the model or training data.

The SymPy best-practices guide distinguishes exact and floating-point values, and solveset illustrates explicit domains and unresolved results. These are useful ideas even for a custom engine. Note that SymPy’s parse_expr uses eval internally and is not a drop-in safe parser for untrusted public input.

2. What the learned model chooses and how to observe it

A loaded checkpoint is not yet an action-selection experiment

The neural code contains graph-based features, attention, a recurrent controller, operator-class logits, a numerical prediction, and router outputs. The checkpoint produced outputs with expected shapes on compatible synthetic tensors. That confirms loading/forward compatibility, not semantic correctness: synthetic tensors are not mathematical expressions, and logits are not verified solutions.

Even the word operator covers different tasks:

Possible prediction task What it answers How to check it
Operator recognition Which mathematical operator/class is present? Labeled graph classification
Redex localization Which subexpression can be reduced? Compare node IDs with executable candidates
Legal-rule selection Which rewrite can be applied now? Independent rule and precondition checks
Action ranking Which permitted move is worth trying first? Matched search and step-budget comparison
Intermediate-value estimate What value or magnitude might follow? Clearly specified regression target and tolerance
Termination estimate Is the requested goal achieved? Independent symbolic goal check

All are potentially useful. The distinction matters when evaluating them: a 16-class head that correctly recognizes a label may be doing its declared job perfectly, while the integration that turns that label into an actual (node, rule) decision is still being developed.

Make legal candidates visible before scoring them

For a toy expression such as (2+3)*(4+5), there are two readily available additions. A classifier recognizing + has not by itself identified which occurrence to compute first, and both orders lead to the same value. That is a fine interface example, but it is not evidence of a neural search advantage. A more discriminating policy experiment needs cases where action order changes the amount of search, proof length, or probability of reaching a goal under a budget.

A small structured trace would therefore show both the allowed choices and the actual choice. If a graph uses eight-dimensional node features, a tiny example of the feature encoding, adjacency convention, and candidate masks would go a long way. The 16 output classes could be documented with their semantic labels and the manner in which they are turned into executable actions. A README table and a few lines of trace output could be enough.

For discussion, the division of responsibility might look like this. This is conceptual pseudocode, not a tested Neumathway patch:

def step_with_policy(state, goal, policy, rules):
    candidates = rules.legal_actions(state, goal)
    if not candidates:
        return {"state": state, "status": "incomplete_no_action"}

    features = encode_state_and_candidates(state, goal, candidates)
    ranking = policy.rank(features, candidates)
    chosen = choose_one_legal_action(candidates, ranking)

    checked = rules.verify_preconditions(state, chosen)
    if not checked.ok:
        return {"state": state, "status": "rejected", "reason": checked.reason}

    updated = rules.apply(state, chosen)
    return {"state": updated, "status": "accepted", "action": chosen}

The appropriate next step therefore depends on whether integration is already present, planned, or implemented elsewhere, as outlined above. The deterministic evaluator remains useful both as a baseline and as a source of checks before a learned policy is involved.

A small, fair comparison when integration is real

Once the bridge exists, I would start with a few supported expressions and compare two policies under the same parser, symbolic rules, verifier, goal test, and step or search budget:

  1. Symbolic-only: choose the first legal reducible node or another documented deterministic heuristic.
  2. Neural-guided: rank the very same legal candidate actions with the learned model.

For each case, report verified final success, steps, examined candidates, end-to-end time, and unsupported/incomplete outcomes. A random-legal-action baseline is optional.

A tiny result template could be:

Problem ID | Policy        | Parsed? | Verified? | Steps | Candidates | ms | State
-----------|---------------|---------|-----------|-------|------------|----|------
case-001   | deterministic | ...     | ...       | ...   | ...        | ...| ...
case-001   | neural-guided | ...     | ...       | ...   | ...        | ...| ...

For straightforward arithmetic, deterministic reduction may already be optimal or nearly so; neural guidance might add overhead. That makes arithmetic a helpful negative control, not a reason to abandon the policy idea. Harder problems with meaningful alternative actions may better reveal benefits. For a compact-deployment claim, latency and memory should include parsing, graph construction, inference, verification, and startup.

Keep the checker independent of policy confidence

A higher model score must not make an otherwise invalid rewrite admissible. If a controller suggests canceling a factor that might be zero, the checker can require an assumption, split cases, or reject the rewrite. If the controller predicts a numeric answer, the executor can treat it as a hint rather than a certificate. If a search step times out, the result can remain incomplete instead of claiming mathematical success.

3. Evaluation, generalization, and practical reproducibility

Name the task behind each number

The model card reports about 8.27 million training samples and 100% Neural Operator Prediction (NOP) accuracy on a reported validation task, with a described validation set of approximately 1.625 million samples. These are author-reported figures. I have not independently reproduced the generator, dataset split, evaluator, or full training run. The README already acknowledges that operator-label accuracy and broader mathematical correctness are different metrics, so the natural feedback is to make that distinction concrete rather than repeat it as a criticism.

The metrics can be separated by the stage they actually measure:

Evaluated stage Suitable measure What it establishes
Operator labels Accuracy and per-class recall Agreement with a declared target label
Next-action proposal Legal-action and selected-action rates Whether predictions align with executable choices
Multi-step solver Verified solved/attempted, completion statuses End-to-end behavior under a stated budget
Search guidance States examined or steps per solved task Contribution beyond a simple action policy
Numeric estimates Error against an explicit target Numerical predictive behavior, not exact proof
Runtime End-to-end latency and memory Practical deployment cost under defined conditions
Structural generalization Held-out expression families/shapes Performance beyond familiar generated patterns

Not every row needs to be measured now. A compact report that gives the precise definition of the current NOP task, with end-to-end solving marked not yet measured if applicable, is more useful than a large table with ambiguous headings.

What a synthetic split is really testing

Synthetic mathematical data can be a strength: generated expressions have known structure, controllable complexity, explicit labels, and sometimes exact or independently checkable answers. But simply changing the constants is not the same as changing the structure. (2+3)*4 and (7+5)*9 have different numbers but the same operator tree. A random split across millions of such samples can be suitable for testing new values within a known grammar; it is less informative about unfamiliar tree shapes, deeper compositions, or a new solver objective.

When useful, the evaluation could distinguish:

  • New operands within known templates: checks numeric variation and features.
  • New tree shapes or depth: checks structural extrapolation within a supported operator set.
  • New compositions of familiar rules: checks whether learned choices transfer to different action sequences.
  • Held-out generator templates: reduces the chance that near-duplicate expression families appear across training and evaluation.
  • A distinct mathematical domain: a stronger and separate claim, not automatically implied by the preceding tests.

A mini-evaluation artifact is enough to start

The checked public snapshot contains training code and a checkpoint, but not some generator/evaluation scripts and data shards named by the README (generate_dataset.py, benchmark_eval.py, deep_rigorous_benchmark.py). I therefore could not reproduce the reported validation from that snapshot. This does not imply those experiments were not performed or that the files do not exist elsewhere.

Rather than publishing millions of examples immediately, a small reproducible example bundle would probably offer greater information per unit of effort. For instance:

sample_manifest:
  code revision, checkpoint identity, dependency versions
  supported input grammar and relevant assumptions
  class labels and how they map to executable actions
  feature/adjacency/mask conventions
  few example input expressions and expected labels
  evaluation procedure and meaning of each reported metric

mini_evaluation:
  parse each included input
  construct the corresponding features
  run the checkpoint on those actual features
  report target and predicted operator labels
  if integrated, apply one selected legal action and verify it

This could be a README section, an existing log, or a small notebook. The Hugging Face model-card guidance provides a suitable documentation pattern.

It also helps to map each checkpoint and reported result to the code and feature-encoding revision actually used:

checkpoint file/revision
model code revision and instantiation arguments
feature encoder and class mapping revision
training dataset and validation split identifier
metric/evaluator revision

This small version mapping would also help readers avoid matching metrics from one experiment to code from another.

Simple tests before larger benchmarks

With a declared grammar, even a few structured tests can check invariants independently of the neural model. Hypothesis is one option.

Candidate invariants include:

A successful parse consumes every token of the input.
An exact-rational result agrees with an independent Fraction oracle.
An unsupported token cannot disappear without an error.
An invalid domain cannot be reported as exact success.
Approximate values retain a precision or approximation label.
A completed result satisfies the stated goal and assumptions.
A bounded search that stops early is reported as incomplete.
Candidates returned as equation roots satisfy the original equation.

The 120-case rational control supports only the narrow second assertion for shallow arithmetic. The separate boundary tests identify areas where other assertions should be checked. They should not be merged into a single “Neumathway accuracy” percentage: they sample different contracts with intentionally different purposes.

A small regression set can then protect working arithmetic while decimals, roots, and unary signs are extended.

4. Related work and optional future branches

The project sits near several established lines of research, but similar architecture does not imply identical tasks, guarantees, or failure mechanisms. I would use these references as design and evaluation options, not as proof that any particular Neumathway component is right or wrong.

Peano: Learning Formal Mathematical Reasoning explores learning mathematical reasoning with formally constrained operations. The most transferable idea is to make the action space explicit: what operation is legal, with what arguments, and how the system checks it. The exact environment is different, but its legal-action perspective is helpful when turning operator logits into executable steps.

AlphaGeometry provides an example of neural proposals working together with symbolic deduction in geometry. Its success should not be transferred to a different algebra/calculus engine by analogy. What is transferable is the separation of responsibilities and the value of reporting the performance of the neural-assisted and symbolic components under meaningful comparative conditions.

INT: An Inequality Benchmark for Evaluating Generalization in Theorem Proving addresses inequality theorem proving rather than the full range of Neumathway’s proposed domains. Its relevance is methodological: evaluating unseen mathematical structures rather than only changing numeric constants. This could inspire a held-out AST-template split if structural generalization becomes a central goal.

SymPy best practices, assumptions, and solveset provide practical references for exact/approximate separation, domain conditions, and unresolved results. A small custom symbolic engine can incorporate these ideas without becoming a front end to all of SymPy. SymPy parsing documentation is also relevant, including its warning about untrusted input.

Hypothesis is an option for generating edge cases against a declared grammar. egg is a more distant option for representing many equivalent rewrites, and Lean is a different destination for machine-checked proofs. Neither is a prerequisite for the present prototype.

If the scope expands, I would watch for four common interpretation pitfalls:

  1. Action-space growth: More rewrites can make ranking useful but search harder; report legal choices and budgets.
  2. Hidden assumptions: Equation transformations need valid domains and excluded-value handling.
  3. Template overlap: Large synthetic datasets may share expression structures; define held-out conditions.
  4. Metric mismatch: Neural forward speed, rewrite correctness, and verified end-to-end solving measure different things.

Where I would start

The most informative next step seems small: one authentic learned-action trace, if the loop is already integrated; otherwise a clear expression-to-action mapping, alongside an explicit contract for the symbolic evaluator’s supported inputs and result states. A matched neural-guided versus deterministic comparison can follow when both paths exist, using the same rules and verified goals.

I hope these function-level observations are useful as a small external smoke test. The larger research question remains open and interesting: when does a compact learned policy add value to symbolic reasoning, and how can that contribution be verified separately from the executor? That seems worth exploring without asking this prototype to solve every mathematical domain at once.

Thank you for testing Neumathway and sharing these findings! The current version is intentionally designed around non-decimal numerical representations, so decimal values may be rounded or lose precision. This is a known limitation of the current design.

Your observations about result validation, execution status, and neural-symbolic integration are valuable points for further investigation. I sincerely appreciate the time and effort you put into testing the project and providing such constructive, technically detailed feedback. Thank you for helping me identify areas where Neumathway can improve.