Build Your First LLM from ScratchPart 2 · Section 7 of 7
End-to-End Preview
Here's what the final result looks like:
from model import CalculatorLLM
model = CalculatorLLM.load("calculator-llm.pt")
model.calculate("two plus three") # → "five"
model.calculate("nine times nine") # → "eighty one"
model.calculate("fifty minus twelve") # → "thirty eight"The .calculate() method is a convenience wrapper. Under the hood, it's still doing autoregressive generation—appending "two plus three" + predicted token, checking for [END], and returning just the answer portion.
Try It Live
At the end of this series, we'll deploy our model to Hugging Face Spaces—a free platform to host ML demos. You'll be able to share your working calculator LLM with anyone via a simple URL.
Your friends can test your model in their browser—no Python or setup required. Just type "seven times eight" and watch your model respond "fifty six".
Helpful?