llm Client-Side Only

Cross-Entropy Loss Laboratory

Explore Cross-Entropy Loss for next-token prediction. Adjust predicted target probability to see how loss scales logarithmically.

Concept Breakdown: Logits to Normalized Probability Distribution

1. The Talent Show Referee

When an AI calculates candidate next words, it gives each word raw points (like +3.8 or -1.2). Softmax is the referee that converts raw points into percentage odds that always add up to 100%.

2. Why Exponents Matter (e^z)

Negative scores confuse percentage math. Raising e to the power of each score turns all numbers strictly positive and exaggerates winners so the best word clearly stands out.

3. Try the Temperature Slider!

Slide Temperature down to 0.2: the #1 winner dominates at 99%. Slide it up to 2.0: all options become equally likely (maximum creativity and chaos).

TEMPERATURE (T):1.0
INPUT LOGITS (z)Adjust sliders (-2.0 to 6.0)
eastz = 3.8
morningz = 2.2
skyz = 1.9
westz = 1.5
horizonz = 0.8
NORMALIZED PROBABILITIES (P)Sum = 100.0%
east66.6%
morning13.4%
sky10.0%
west6.7%
horizon3.3%

Detailed Step-by-Step Numerical Breakdown

TokenLogit (z)Scaled (z / T)Exponent (e^z)Probability (P)
east3.803.801.00066.6%
morning2.202.200.20213.4%
sky1.901.900.15010.0%
west1.501.500.1006.7%
horizon0.800.800.0503.3%

Quick Reference & Instructions

Simple steps, pro tips, and execution details

1

Provide Inputs

Type, paste, or select your values in the form fields below.

2

Instant Live Analysis

Calculations and formatting happen automatically with zero delay as you type.

3

Copy or Use Output

Copy results or apply the clean output directly to your projects.

How It Works

Plots the negative log curve and shows how high-confidence incorrect predictions produce extreme penalties.

Formula & Logic

L=log(Ptarget)\mathcal{L} = -\log(P_{\text{target}})

Frequently Asked Questions

Common questions about calculations, assumptions, and edge cases.

Yes, Cross-Entropy Loss Laboratory is 100% free with unlimited calculations and zero paywalls or subscriptions.