# Financial Numerical Reasoning

Performing calculation and quantitative reasoning over financial documents, where language models are notably weak.

**Rests on:** Data Literacy

*Applied Domains · AI in Finance*


## Why learn this

This concept unlocks the ability to work with numbers in financial documents—something language models are notably weak at. You'll learn why models fail at arithmetic, how to use tools for accurate calculations, and how to build systems that can answer questions like 'What was the total revenue growth from 2023 to 2024?' or 'Is the debt-to-equity ratio above 2?' This is the foundation for more advanced topics like Backtesting LLM Strategies, where every number must be correct or the entire strategy collapses.


## The intuition

Imagine you ask a friend to read a company's financial report and tell you the net profit margin. Your friend is very good at understanding the text—they can find the revenue and the net income, but when it comes to dividing 2,340,000 by 12,500,000, they start making mistakes. They might say 'about 18%' when the actual answer is 18.72%. You wouldn't ask your friend to do the arithmetic in their head; you'd hand them a calculator. The same is true for language models. They are designed to predict the next word, not to do arithmetic. When you ask a model to compute a sum or a ratio, it's guessing at the answer, not calculating it. That's why financial systems use a 'tool'—a separate calculator—to do the math, and then the model reads the result and explains it in context.


## An analogy

Think of a language model as a brilliant accounting analyst who excels at reading financial statements and explaining what they mean, but who has never learned to do arithmetic. They can tell you that revenue grew, but if you ask them to compute the exact growth percentage, they might say 'around 30%' when it's actually 28.6%. Now, imagine you give this analyst a calculator. They still read the documents, but when it's time to compute a number, they press the buttons on the calculator and read the exact answer. The analyst becomes far more reliable because they've separated 'understanding' (which they're good at) from 'calculation' (which they're not). In AI systems, this 'calculator' is a piece of software called a 'tool' that the model can call. The model turns the arithmetic into a prompt for the tool, the tool returns the exact answer, and the model uses that answer in its response. This is why modern financial AI systems use this pattern: it gives you the comprehension of a language model and the precision of a calculator. The analogy breaks down when you consider that the analyst might not know which numbers to plug in or what to do with the result—the model still needs to understand the financial context to ask the right questions and interpret the answers.


## Definition

Financial numerical reasoning is the ability to perform accurate calculations—such as percentages, ratios, and sums—over numbers extracted from financial documents, using language models combined with computational tools, because language models alone are unreliable at arithmetic.


## How it connects

This concept connects to your notes on Financial Sentiment, where the tone of financial text is classified, but here we focus on the numbers themselves. It also underpins Backtesting LLM Strategies, where every figure must be correct to avoid false conclusions. The library notes emphasize that 'numerical reasoning remains a genuine weakness of language models,' and this concept directly addresses that gap. You've also noted point-in-time data discipline from 'Large Language Models in Finance'—when you're calculating a ratio, you must only use numbers that were known at the time, otherwise the result is meaningless. This concept builds on your understanding of language models from other topics, but it takes a step back: before you ask a model to reason about numbers, you need to know how to make the arithmetic reliable.


## The mathematics

The mathematics here is arithmetic—addition, subtraction, multiplication, division, and percentages. This is the branch of mathematics you use when you're working with concrete numbers, not abstract equations. In financial numerical reasoning, you'll often need to compute things like growth rates, ratios, and margins. For example, if a company's revenue last year was 100 crore and this year it's 120 crore, the growth rate is 20%. That's (new - old) / old × 100. In words: take the difference between the new and old numbers, divide that difference by the old number, then multiply by 100 to get a percentage. Another common operation is the ratio, such as the debt-to-equity ratio: divide total debt by total equity. If debt is 50 lakh and equity is 25 lakh, the ratio is 2—meaning the company has twice as much debt as equity. These are simple arithmetic operations, but getting them exactly right matters. A mistake in a percentage could mean the difference between an investment that looks safe and one that is risky.

For any two numbers A and B:

Growth rate = (B - A) / A × 100%

For any two quantities X and Y:

Ratio = X / Y

In these formulas, A and B are the old and new values, and X and Y are the two quantities you're comparing.


## A worked example

```
We have a company's income statement. Revenue for 2023: ₹50,000,000. Revenue for 2024: ₹55,000,000. Net income for 2024: ₹8,000,000. Total assets at end of 2024: ₹100,000,000. Total liabilities at end of 2024: ₹60,000,000.

Step 1: Revenue growth = (55,000,000 - 50,000,000) / 50,000,000 = 5,000,000 / 50,000,000 = 0.10   # First, find the absolute change in revenue.
Step 2: 0.10 × 100 = 10%   # Convert the decimal to a percentage.
Step 3: Net profit margin = 8,000,000 / 55,000,000 = 0.14545...   # Divide net income by revenue.
Step 4: 0.14545 × 100 = 14.55%   # Convert to a percentage.
Step 5: Debt-to-equity ratio = 60,000,000 / (100,000,000 - 60,000,000) = 60,000,000 / 40,000,000 = 1.5   # Equity is assets minus liabilities, then divide debt by equity.

Result: Revenue grew by 10% from 2023 to 2024. The net profit margin is 14.55%. The debt-to-equity ratio is 1.5, meaning the company has 1.5 times as much debt as equity.
```


## From scratch, in Python

```python
# A simple calculator for financial ratios, using only basic Python.

# These are the numbers from the income statement, stored as floats.
revenue_2023 = 50000000.0
revenue_2024 = 55000000.0
net_income = 8000000.0
assets = 100000000.0
liabilities = 60000000.0

# Compute a growth percentage.
def growth_percentage(old_value, new_value):
    growth = (new_value - old_value) / old_value
    return growth * 100

# Compute a simple ratio.
def ratio(numerator, denominator):
    return numerator / denominator

# Use the functions defined above.
revenue_growth = growth_percentage(revenue_2023, revenue_2024)
print("Revenue growth:", revenue_growth, "%")

# Equity is assets minus liabilities.
equity = assets - liabilities

# Calculate the net profit margin.
margin = net_income / revenue_2024
print("Net profit margin:", margin * 100, "%")

# Calculate the debt-to-equity ratio.
de_ratio = ratio(liabilities, equity)
print("Debt-to-equity ratio:", de_ratio)
```


## What the code does

The code uses basic Python: variables store numbers (like `revenue_2023`), and functions like `growth_percentage` perform the calculations. The `def` keyword creates a function that can be reused. The `print` statements show the results. In practice, you'd use a library like `numpy` for arrays of numbers, but the core arithmetic is the same. A language model would use an external tool to call a function like `growth_percentage` and get the exact answer.


## Common misconceptions

**The model can just do the math if I ask nicely** — If I prompt the model with 'calculate 1,234 × 5,678', it will give me the correct answer because it's a smart AI.

Language models are not calculators. They generate text that looks plausible, but they have no built-in arithmetic engine. Even with 'please', the answer may be wrong. In fact: Always use a tool for arithmetic. The model's job is to understand the problem and state the answer, not to compute it directly.

**Tokenisation makes numbers easier for the model** — The model sees the number '1,234,567' as a single unit, so it can reason about it as a whole.

In most tokenisers, numbers are broken into smaller pieces. '1,234,567' might become tokens like '1', ',', '2', '3', '4'—the model doesn't see the value as a whole. In fact: Because the model can't grasp the full number, it's unreliable for arithmetic. Use exact numbers from a tool.

**One calculation is enough** — If I compute a ratio once, that's all I need—the answer is final.

In finance, numbers change, and you must ensure you're using the most recent, correct data. Also, a single calculation might be wrong if the input numbers are wrong. In fact: Always verify your inputs and use point-in-time discipline—use numbers that were available at the time of the decision.

**The result is correct, so the reasoning is correct** — If the final number is 10%, everything in my analysis is sound.

A correct arithmetic result can be based on wrong data or a misinterpreted question. The process matters as much as the output. In fact: Check both the calculation and the data source. Only cite results that come from verified figures.

**All models are equally bad at math** — Smaller models are just as good at arithmetic as large ones, so I don't need a tool regardless.

Smaller models are generally worse at arithmetic because they have fewer parameters to learn patterns. Tool use is even more important for them. In fact: Always use a tool for arithmetic, regardless of model size.


## In short

Financial numerical reasoning is about getting the numbers right. Language models can't do arithmetic accurately, so you must use tools—like a calculator function—to compute exact answers. The mathematics is simple arithmetic: growth rates, ratios, and percentages. The code is straightforward: define functions that take numbers and return calculations. The application is everywhere in finance, from LLM assistants to agentic systems. Remember: never trust a language model to compute a number by itself. Always verify with a tool.


## Where this is used

In large language models (LLMs), numerical reasoning is a known weakness. When you ask an LLM to multiply 1,234 by 5,678, it often guesses and gets the answer wrong. This is because the model doesn't compute—it predicts the most likely sequence of tokens, and arithmetic patterns are hard to learn from text. To solve this, real-world systems use a pattern called 'tool use.' The LLM is allowed to call a tool—like a calculator function—that performs the calculation exactly. For example, in a financial assistant, the model might say: "I need to calculate the revenue growth for this company," and then call a tool with the two revenue figures. The tool returns the exact percentage, and the model wraps that in a human-readable answer. This approach is used in almost every serious financial AI application. For small language models running on phones or laptops, the principle is the same—you still need a calculator, because the model is even less capable. For retrieval-augmented generation (RAG), where the model pulls facts from documents, numerical reasoning is critical when the answer depends on numbers in those documents. The system must extract the right numbers and then calculate correctly—again, using an external tool. In agentic systems, where an AI plans and acts in loops, the agent might need to check a company's quarterly results, compute a ratio, and decide whether to buy or sell. The calculus is always done by a tool, not by the model. In everyday applied machine learning, financial forecasting models use numbers directly, but when explaining predictions to humans, the LLM must be able to compute and articulate metrics like 'we expect a 5% increase.' Here, tool use is again the answer. When building such software, a developer writes code that defines the tools—like the `growth_percentage` function—and then connects it to the model's ability to call it. The framework used is often LangChain or similar, but the underlying principle is the same. If this is done badly, the model returns wrong numbers, which in finance can lead to catastrophic decisions.


---

Read this on the web: https://basavapurushottam.com/learn-ai/financial-numerical-reasoning
