← Back to list

2.718: How This One Number Impacts What Your AI Says Next

Have you ever wondered how an AI model, like ChatGPT, always seems to find the perfect next word in a sentence? Or how it knows to be more…

Anuranjan Yadav · 2026-03-19 12:19 · 7 claps · 4.3 min read
#llm #softmax-function #ai #eulers-number #generative-ai-solution
Open on Medium ↗
Wiki topics: LLM · Large Language Models AI · AI · General

2.718: How This One Number Impacts What Your AI Says Next

Have you ever wondered how an AI model, like ChatGPT, always seems to find the perfect next word in a sentence? Or how it knows to be more “creative” when you ask it to tell a story?

The secret often lies in a specific, magical number from mathematics:

e ≈ 2.718

often called Euler’s number. This isn’t just a number you might learn in an advanced math class; it’s the heartbeat behind a lot of modern Artificial Intelligence, especially Large Language Models (LLMs). Let’s dive into what e is and how it powers the coolest features of these AI models, explaining it in a way that anyone, even in secondary school, can understand!

What exactly is e ?

So, what is this e number all about? You might be familiar with numbers like π (Pi), which is roughly 3.14. Just like π describes something special about circles, e (which stands for Euler’s Number) describes something special about growth and probability.

It’s often defined in calculus as the unique base for an exponential function (e^x) whose rate of growth is equal to its value.

How is value of e calculated: The Story of the Magic Dollar

To understand why e is 2.718 , imagine you have $1 in a special bank account that gives you 100% interest per year. The formula for compound interest is:

(Where n is the number of times you calculate the interest in a year). Let’s watch what happens to your dollar as we calculate interest more often:

Notice how the number doesn’t keep growing to infinity? Even if you calculate interest every millisecond, you can’t beat the “speed limit” of nature. That limit is e. In LLMs, we use this same “natural growth” math to help the AI grow

For LLMs, though, we care less about interest and more about probability. e is special because functions built around it (like e^x ) have very useful and “smooth” properties when we use calculus to train the model. But more importantly, it lets us turn the raw scores a model gives for a word into real percentages. Let’s see how!

e as the Gatekeeper: Choosing the Next Word

When an LLM is about to generate the next word in a sentence, it doesn’t just know the answer. Instead, its internal math calculates a “score” for every single word in its massive vocabulary. These raw scores are called Logits.

Let’s imagine our LLM is writing the sentence “The cat likes to eat…”. Its vocabulary is: Mice, Yarn, Carrots, The. The model might generate these raw logit scores:

  • Mice: 4
  • Yarn: 2
  • Carrots: 1
  • The: -1

How do we turn these into an actual probability? A probability needs to be between 0 and 1, and all options must add up to 1 . This is where e steps in via the Softmax Function.

The Gateway of Probability: The Softmax Function

To turn scores ‘Zi’ into probabilities that add up to 100%, LLMs use e :

Why e ? Using e as the base ensures the function is monotonically increasing (higher scores = higher probabilities) and differentiable, allowing the model to “smoothly” learn during training.

The “Winner Takes All” Effect: e is an exponential base, so it magnifies small differences in raw scores, helping the model commit to the most likely word rather than being “wishy-washy.”

The Role of e and Softmax: Step-by-Step

Using our “cat” example where e = 2.718 :

Step 1: Exponentiation (The Power of e )

Step 2: Calculate the sum of these values Total Sum

54.60+7.39+2.72+0.37= 65.08

Step 3: Calculate the probability (Value / Total Sum)

This makes ‘Mice’ the strongest choice by far. Exponentially increasing the value helps in making a clear decision.

Controlling Creativity: Temperature Scaling

When you adjust “Temperature” ( T ), you modify the exponent of e. The formula becomes:

Scenario 1: Low Temperature ( T=0.7 ) — Predictable

We divide each raw score by 0.7 . This makes the scores more spread out or “sharpened.”

New Probability

The model is now much more certain.

Scenario 2: High Temperature ( T=1.3 ) — Creative

We divide each raw score by 1.3. This makes the scores less spread out or “flattened.”

New Probability

This aligns with LLM being more creative. Higher the temperature, higher the chance of LLM being more creative.

Conclusion: The Unsung Hero of AI

The next time you’re using an LLM, take a moment to think about this simple number, e. It’s not just a mathematical curiosity. From turning raw internal math into a structured list of word probabilities, to controlling whether the model is a predictable helper or a creative storyteller, Euler’s number (2.718) is the unsung hero that makes Artificial Intelligence feel truly “intelligent.”


메타데이터
post_id
2df3a23949a0
slug
2-718-how-this-one-number-impacts-what-your-ai-says-next-2df3a23949a0
url
https://medium.com/@anuranjan.yadav/2-718-how-this-one-number-impacts-what-your-ai-says-next-2df3a23949a0
canonical_url
https://medium.com/@anuranjan.yadav/2-718-how-this-one-number-impacts-what-your-ai-says-next-2df3a23949a0
author_url
https://medium.com/@anuranjan.yadav
status
ok
fetched_at
2026-06-13 12:55:53