Building with LLMs: How Generative AI Is Reshaping the Way We Code, Think, and Create


By [Vinatha Viswanathan], August 2025 · 7 min read
Generative AI is no longer just hype — it’s a paradigm shift. Whether you're chatting with a digital assistant, watching an autonomous agent complete a multi-step task, or just marveling at an AI that can generate SQL queries or short stories, you're seeing the power of large language models (LLMs) in action.
But here’s the thing: most people interacting with these tools don’t really understand what’s happening under the hood. And they should. Because once you do understand the fundamentals, you stop treating LLMs like magic boxes — and start building with them like engineers.
So let’s peel back the layers and explore what’s really going on.
From Rule-Based AI to Self-Learning Systems
In the early days of AI, systems were essentially giant flowcharts — every decision, condition, and rule had to be explicitly written by a human.
Imagine building a spam filter like that.
You'd start with a bunch of hard-coded rules:
If the subject line contains “free money,” mark as spam.
If the sender domain is on a blacklist, mark as spam.
If the email has more than five exclamation points, mark as spam.
These are rigid, fragile rules. They might catch obvious junk, but they break down fast — especially once spammers evolve their tactics. Change “free money” to “fr33 m0ney” and you’re back to square one.
That’s the problem with rule-based AI: it doesn’t adapt.
Now enter machine learning.
Instead of writing all the rules yourself, you collect a dataset of labeled emails — some spam, some not. You feed that into a machine learning model, and it learns the patterns on its own. Not just keywords, but combinations, timing, even sender behavior.
It doesn’t care if the subject says “free money” or “exclusive offer” — it picks up on subtler cues humans might miss.
The shift is subtle but revolutionary:
Rule-based: “Here’s how spam works, let me write it down.”
Machine learning: “Here’s a pile of examples, figure out what spam looks like.”
That’s the moment software stopped being just instructions, and started becoming something that learns.
Neural Networks: Planes, Not Brains
Then came deep learning, and with it, neural networks. Inspired by the brain, yes, but don’t fall for the metaphor. Neural networks aren’t “silicon minds” any more than airplanes are “metal birds.” They fly, sure, but they do it on entirely different principles.
At their core, neural networks are stacks of mathematical units called neurons. Each neuron applies a set of weights (learned from data), passes the result through a nonlinear function, and hands it off to the next layer. The magic happens during training, where the model’s errors are used to adjust the weights in a process called backpropagation — a feedback loop that gets tighter and smarter with every iteration.
Inference: Real-Time Language Generation Without the Crystal Ball
Once a large language model has gone through its long training journey — absorbing patterns, grammar, context, and semantics — it’s ready to put all that learning to work. This phase is called inference.
But what is the model really doing?
Think of it like autocomplete, but turbocharged with billions of parameters and a deep contextual awareness. You give it a prompt — maybe something like:
“In the year 2045, humans and machines will…”
The model doesn’t “know” the future. It doesn’t understand politics or ethics or intent. What it does have is a mathematical map of what typically comes next when people write things like that. It scans its internal representations, calculates probabilities for every possible next token, and chooses the one that best fits the sequence.
Then it does it again. And again. And again — one token at a time — until the output feels complete.
The result may sound insightful, witty, or creative. But under the hood, it’s just statistical next-word prediction operating at breathtaking scale.
Inference isn’t about thinking — it’s about pattern continuation. What makes it powerful is how surprisingly human those continuations can feel.
Transformers: The Engine Behind Modern Language Models
What made LLMs possible? Transformer architecture.
Before transformers, models like RNNs and LSTMs were the standard. They processed sequences token-by-token, which was slow and limited in scope. Transformers changed the game with their attention mechanism, which allows the model to consider all words in a sentence simultaneously.
Introduced in the 2017 paper Attention is All You Need, transformers laid the groundwork for everything from GPT-4 to LLaMA 3.
At a high level, a transformer has two parts:
Encoder: Converts input into contextual embeddings.
Decoder: Uses that context to generate the next token, one step at a time.
This setup enables powerful bidirectional understanding and long-context reasoning — two things earlier models struggled with.
Tokenization: The Language of Numbers
Before any LLM can generate text, it first needs to convert words into numbers. That’s where tokenization comes in. Tokens are fragments of text — sometimes full words, sometimes parts of words — that are then mapped to vectors.
For example:
"LLMs are trained on..."
Could become tokens like:["LLMs", "are", "train", "ed", "on"]
These tokens are passed into the model, transformed by layers of attention and math, and decoded back into human-readable text.
Sampling Strategies: How LLMs Choose Their Words
Once the model computes a probability distribution over the next possible tokens, it needs to choose one. That’s where sampling strategies come in.
Greedy Decoding
Always chooses the most probable next token. It’s fast and safe — but can lead to boring, repetitive outputs.
Top-k Sampling
Limits the options to the k most probable tokens. Adds randomness, but keeps the choices focused.
Top-p (Nucleus) Sampling
Chooses from the smallest set of tokens whose total probability exceeds a certain threshold (e.g. 0.9). More flexible than top-k.
Temperature
Controls how “sharp” or “flat” the probability distribution is. A low temperature = predictable output. High temperature = creative and chaotic.
Each strategy has trade-offs. Greedy is deterministic. High-temperature sampling is poetic but risky. The right choice depends on your use case.
Training LLMs: Pre-training vs. Fine-tuning
Training a large language model is a two-phase marathon.
Phase 1: Pre-training
The model reads a massive corpus of text — books, articles, code, Reddit threads, whatever. It learns to predict the next token in a sequence. No supervision. Just raw prediction.
This phase captures broad knowledge, grammar, facts, patterns, and even bias.
Phase 2: Fine-tuning
Now the model gets task-specific. It’s trained on curated datasets with labeled inputs and outputs — for example, a question with its answer, or a prompt with a SQL query.
Fine-tuning makes the model better at specific tasks but can narrow its generality if overdone.
LLMs Are Just Really Smart Math
At the end of the day, a large language model isn’t thinking. It’s not conscious. It’s just solving one problem: what token is most likely to come next?
You give it some text.
It tokenizes it.
It generates a probability distribution over the next token.
It samples one.
And repeats.
That’s it. That’s the magic.
And yet… from this simple loop comes poems, plans, emails, essays, and code.
Who’s Building the Future?
LLMs are being pushed forward by both proprietary giants and open-source innovators.
Proprietary Powerhouses
OpenAI: GPT-4, GPT-4o — cutting-edge general reasoning.
Anthropic: Claude series — fast, safe, highly steerable.
Google DeepMind: Gemini — integrated across products.
Open-Source Contenders
Meta: LLaMA 2, 3 — highly performant and freely available.
Mistral AI: Compact models with competitive capabilities.
API Platforms
Hugging Face: Think GitHub for AI models.
GroqCloud: Fast inference for open models.
The landscape is shifting fast, and performance benchmarks — like LM Arena or Aider Leaderboards — are tracking the winners.
Final Thought: The Tool Is Not the Limit
Understanding how LLMs work isn’t just for curiosity. It’s a competitive advantage.
If you’re building products, writing code, automating workflows, or even just interacting with AI tools daily — this knowledge lets you shape the output, tune the behavior, and design smarter systems.
The real power of LLMs isn't just in what they can do out of the box. It's in how you use them — how you prompt, configure, and combine them into agents, teams, and intelligent apps.
Once you see the math behind the magic, you stop asking what AI can do — and start asking what you can build with it.
Subscribe to my newsletter
Read articles from Vinatha V directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
