Teaching LLMs to compose math symbolically, not execute it
by CheerfulDreamer | 2025-12-01 17:25:40+00:00
Right now LLMs cannot be counted on to perfectly perform math. The solution I propose is to teach LLMs to instead of executing the math, just compose the mathematical equations correctly and leave the execution to a post-processing step.

My core method would be: Use a single special token ᶜ (U+1D9C) before each element that needs computation, and then compute the result afterwards. For known math that doesn't need to be computed the ᶜ is not added or present.

Thus we would see in the output:

Normal (already computed): 847 * 293 = 248171

Requesting computation: ᶜ847 ᶜ* ᶜ293 ᶜ= ᶜx

The Core Mechanic: Post-Process Computation

This is what makes everything work: Model generates output with ᶜ-marked expressions (fast, no blocking) Generation completes Parse all ᶜ-marked expressions Execute computations with perfect precision Substitute results back into the output Show user the final result with normal mathematical notation

The model never waits for computation results. It reasons symbolically with variables, and values are computed after generation is complete.

Multi-step example:

Model generates: "First, ᶜ847 ᶜ* ᶜ293 ᶜ= ᶜa, then ᶜa ᶜ+ ᶜ150 ᶜ= ᶜb. The answer is ᶜb."

Post-processing: - Execute: 847 * 293 = 248171 (bind to 'ᶜa') - Execute: 248171 + 150 = 248321 (bind to 'ᶜb') - Substitute: ...

User sees: "First, 847 * 293 = 248171, then 248171 + 150 = 248321. The answer is 248321." This is how the model can compose complex calculations without blocking - it's just manipulating symbols, and we handle execution separately.

Training Path 1: During Base Model Training

We augment the training set such that:

Instructional ("Calculate 847 × 293") → add ᶜ tokens Expository ("The result 847 × 293 = 248,171 shows...") → leave as-is

The model learns both patterns during pretraining. When it generates ᶜ-marked expressions during training, they get post-processed (executed and substituted) before computing the loss. The model learns that ᶜ notation leads to computed results.

Training Path 2: Fine-Tuning Existing Models

*If you already have a trained base model:*

1. *Add ᶜ token to vocabulary* 2. *Generate synthetic training data:* ``` Q: "What is 847 multiplied by 293?" A: "Let me calculate: ᶜ847 ᶜ* ᶜ293 ᶜ= ᶜx. The result is x."

Post-process: → "Let me calculate: 847 * 293 = 248171. The result is 248171."

Train on the post-processed version.

Loss and rewards:

High penalty: arithmetic errors without using ᶜ Small penalty: unnecessary ᶜ use (like for 2+2) Reward: correct ᶜ usage and accurate composition

The model learns: "I already know math notation from base training. Now I'm learning to mark computations with ᶜ and let the execution engine handle them."

Fine-tuning is faster since the model already understands mathematical notation - you're just teaching when to use the ᶜ pattern.

Why This Works Separation of concerns:

Model: mathematical composition, when to calculate, symbolic reasoning Execution engine: precise arithmetic, guaranteed correctness Post-processing is the key: The model never waits for results during generation. It composes symbolically, we compute separately. The model doesn't waste parameters learning that 847 × 293 = 248,171. It learns "multiplication is needed here" and delegates execution.

Extensions Same pattern for any deterministic operation:

Dates: ᶜdate_2023 ᶜ- ᶜdate_2022 ᶜ= ᶜdays

Counting: ᶜcount ᶜ( ᶜlist ᶜ) ᶜ= ᶜn

Memory: ᶜstore ᶜ( ᶜslot ᶜ, ᶜvalue ᶜ)

Public Domain Anyone may use, implement, modify, or build upon this approach for any purpose, commercial or non-commercial, without restriction. I specifically disclaim any patent rights and intend this publication to serve as prior art preventing future patent restrictions.

My goal is to help advance AI capabilities in a way that benefits everyone. All praise to Jesus and God who created this amazing universe for us to enjoy.