Tool Use Motivation: Why LLMs Need External Tools for Accuracy › Worked Example: The Compound Interest Problem

Michael BrenndoerferFebruary 1, 20265 min read
Language AI HandbookAll chapters
Part 48 of 67Tool Use and Agents
Chapter 363Tool Use Motivation: Why LLMs Need External Tools for Accuracy › Worked Example: The Compound Interest Problem
Reading section 6 of 13 · Worked Example: The Compound Interest Problem · 5 minSection 6 of 13 · 5 min

Book contents

Section 6 of 13 · 5 min read

Tool Use Motivation: Why LLMs Need External Tools for Accuracy › Worked Example: The Compound Interest ProblemOne section · Sections in this chapter6 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

We examine a concrete scenario that illustrates why tool use is necessary for accuracy and currency. Consider the query:

"If I invest $5,000 in an account with 4.5% annual interest compounded monthly, how much will I have after 3 years and 7 months? Additionally, compare this to the current inflation rate to determine if I'm gaining real purchasing power."

This query combines computational precision requirements with temporal constraints, which makes it impossible for a standalone LLM to answer accurately. The arithmetic requires exact floating-point computation across 43 compounding periods, and the inflation comparison requires current economic data that may have changed materially since the model's training cutoff.

Without Tool Use

An LLM without tool access must rely solely on its parametric knowledge of the compound interest formula, which computes the future value of an investment with periodic compounding:

A=P(1+rn)ntA = P\left(1 + \frac{r}{n}\right)^{nt}

where:

  • AA: the future value of the investment (the accumulated amount after time tt)
  • PP: the principal amount (the initial investment)
  • rr: the annual interest rate (in decimal form)
  • nn: the number of compounding periods per year
  • tt: the time the money is invested for, in years

The formula works by dividing the annual rate rr by the number of periods nn to get the periodic interest rate. The term (1+rn)\left(1 + \frac{r}{n}\right) is the growth factor for a single period. Raising this to the power ntnt compounds this growth across all periods, and multiplying by the principal PP scales this to the initial investment amount.

For this specific calculation:

  • P=5,000P = 5{,}000 (principal)
  • r=0.045r = 0.045 (annual rate)
  • n=12n = 12 (monthly compounding)
  • t=3+712≈3.5833t = 3 + \frac{7}{12} \approx 3.5833 (3 years and 7 months)

The model must compute:

Monthly rate=0.04512=0.00375Number of periods=3×12+7=43A=5000×(1.00375)43\begin{aligned} \text{Monthly rate} &= \frac{0.045}{12} = 0.00375 \\ \text{Number of periods} &= 3 \times 12 + 7 = 43 \\ A &= 5000 \times (1.00375)^{43} \end{aligned}

Computing (1.00375)43(1.00375)^{43} through token prediction is error-prone because it requires precise exponentiation. The model might estimate this as approximately 1.1771.177, yielding $5,885 or it might make arithmetic errors in the exponent or multiplication, perhaps calculating $5,892 or $5,879 due to approximation errors in neural computation. None of these results are completely unreasonable, which makes it hard for you to know whether to trust the answer without running your own calculation.

For the inflation comparison, the model faces the temporal constraint directly. Without access to current economic data, it can only give historical averages based on its training data: "Inflation has recently been around 3-4%," which may be outdated by months or years and prevents a specific, actionable comparison to current economic conditions.

Out[5]:
Visualization
Histogram of 200 simulated LLM compound-interest estimates spanning $5820 to $5960, with a vertical red line marking the exact answer near $5885.
Distribution of simulated LLM responses to the compound interest calculation compared to the exact symbolic result. LLM estimates cluster near the correct value but exhibit variance, with some estimates deviating by tens of dollars due to approximation errors in neural computation. The red line marks the exact correct answer computed symbolically. This variance is representative of real LLM behavior on multi-step arithmetic tasks.

With Tool Use

A tool-augmented system handles this differently, delegating precision and currency to specialized tools. The interaction proceeds in well-defined steps.

First, the model generates a call to a calculator or Python interpreter with the exact formula. The code is unambiguous and deterministic:

In[6]:
Code
P = 5000
r = 0.045
n = 12
t = 3 + 7 / 12
A = P * (1 + r / n) ** (n * t)

Second, the system executes this code and returns the precise value: $5,885.28, calculated with full floating-point precision rather than neural approximation. There is no variance, no bias, no rounding error introduced by the model's generation process.

Third, the model calls an economic data API for the current inflation rate, receiving a structured response such as: {"inflation_rate_annual": 0.032, "as_of": "2024-03-01", "source": "CPI"}.

Fourth, the model uses the calculator again to determine the real return:

Nominal return=5885.28−50005000×100=17.71% over 3.58 yearsAnnualized nominal return≈4.7%Real return (approx)=4.7%−3.2%=1.5%\begin{aligned} \text{Nominal return} &= \frac{5885.28 - 5000}{5000} \times 100 = 17.71\% \text{ over 3.58 years} \\ \text{Annualized nominal return} &\approx 4.7\% \\ \text{Real return (approx)} &= 4.7\% - 3.2\% = 1.5\% \end{aligned}

The final answer gives exact figures and current context: "After 3 years and 7 months, you will have exactly $5,885.28. With current inflation at 3.2%, your real annual return is approximately 1.5%, meaning you are gaining purchasing power, though modestly."

This is categorically more useful than what the model could give without tools. The answer is exact where exactness matters, current where currency matters, and specific where specificity lets decision-making. The model has not become smarter by having access to tools. It has become more reliable by delegating the parts of the problem where neural computation is weak to systems that are strong at those parts.