LLM & Generative AI Foundations — Everything an Enterprise Architect Needs to Know

Share
LLM & Generative AI Foundations — Everything an Enterprise Architect Needs to Know

The AI Architect's Blueprint · Blog 1 of 5
A complete foundation series for enterprise architects building production AI systems — from first principles to deployment.

TL;DR — Key takeaways
AI is the umbrella. ML, Deep Learning, and Generative AI are progressively narrower subsets — knowing the difference matters when you are scoping a project or talking to a vendor.
Foundation Models, LLMs, Multimodal Models, and SLMs are distinct categories — each with different cost, capability, and deployment trade-offs.
The mathematics of AI — vectors, matrix multiplication, probability, and neural networks — are the reason tokens cost money, context windows have limits, and hallucinations happen.
Transformers and attention are the engine. Everything else — prompting, RAG, fine-tuning — is how you drive that engine.
Prompting first. RAG second. Fine-tuning last. This sequencing saves most enterprise teams months of wasted effort.

Why architects need this foundation now

We are at an inflection point. Every enterprise is being asked to "do something with AI" — and most architects are being pulled into these conversations without a solid foundation in how these systems actually work.

This is the gap this series fills. Not a course in machine learning. Not a vendor tutorial. A practitioner's foundation — the concepts, the vocabulary, and the architectural intuition you need to design AI systems that work in production.

We start at the beginning: what AI actually is, how the mathematics underpins everything you will build, and how to make the most important early architectural decision — which model, trained how, deployed where.


1. The AI landscape — clearing up the confusion

The terms AI, Machine Learning, Deep Learning, and Generative AI are used interchangeably in most boardrooms. They are not interchangeable. Understanding the hierarchy is the first step.

Artificial Intelligence is the broadest term — any technique that enables machines to simulate human intelligence. This includes rule-based systems, decision trees, and expert systems that predate modern ML entirely.

Machine Learning is a subset of AI where systems learn from data rather than following explicitly programmed rules. Given enough examples of "spam" and "not spam," an ML model learns to classify email — without a human writing the rules.

Deep Learning is a subset of Machine Learning that uses neural networks with many layers. The "deep" refers to the depth of those layers. Deep learning is what powers image recognition, speech-to-text, and every major LLM in production today.

Generative AI is a subset of Deep Learning where the model's output is new content — text, images, code, audio, or video. Rather than classifying or predicting, it creates. This is the category that includes GPT-4, Claude, Gemini, and Stable Diffusion.

The architectural implication: when a vendor says "AI-powered," ask which layer they mean. A rule-based recommendation engine and a generative foundation model are both "AI" — but they have completely different cost structures, failure modes, and governance requirements.

Artificial Intelligence Any technique enabling machines to simulate human intelligence Machine Learning Systems that learn from data — no explicit rules needed Deep Learning Neural networks with many layers — powers vision, speech, language Generative AI Creates new content — text, images, code, audio, video GPT-4o Claude 3.5 Gemini 1.5 Llama 3.x ...
Generative AI sits inside Deep Learning, inside ML, inside the broader AI umbrella. Each layer narrows the scope and increases the architectural complexity.

2. Models — not all AI is the same kind of AI

Once you understand the hierarchy, the next confusion is between different types of models. These distinctions matter enormously for architecture decisions.

Foundation Model — A model trained on massive, general-purpose data at enormous scale. The key property is that it can be adapted to many downstream tasks without being retrained from scratch. GPT-4, Claude, and Gemini are all foundation models. The "foundation" means they serve as a base layer — you build on top of them.

Large Language Model (LLM) — A foundation model specifically trained on text. The "large" refers to the number of parameters — the learned weights inside the model. GPT-4 is estimated to have over a trillion parameters. LLMs are what power most enterprise AI applications today: chatbots, document analysis, code generation, summarization.

Multimodal Model — A model that can process and generate multiple types of content: text, images, audio, and video in a single model. GPT-4o (the "o" is for omni), Gemini 1.5, and Claude 3 are multimodal. For enterprise architecture, this matters when your use case involves receipts, diagrams, product images, or voice interfaces.

Small Language Model (SLM) — A compact, efficient model designed for on-device or edge deployment. Examples include Microsoft Phi-3, Google Gemma, and Apple's on-device models. SLMs trade raw capability for speed, privacy, and cost. For Retail POS systems, drive-thru voice ordering, or any latency-sensitive application, SLMs are often the right architectural choice.

Base Model vs. Instruction-tuned Model vs. Chat Model — This is a distinction most teams miss. A base model is the raw pre-trained artifact — it predicts the next token, nothing more. An instruction-tuned model has been further trained to follow instructions. A chat model has been tuned specifically for dialogue. When you call the Claude or GPT-4 API, you are using a chat/instruction model, not the raw base model. This matters deeply for fine-tuning decisions.

Architectural rule of thumb: match model type to task. An SLM on-premise for a QSR drive-thru. A multimodal foundation model for a retail product catalog assistant that handles both text queries and product images. A chat-tuned LLM for customer service.

3. The mathematics of AI — what every architect needs to understand

You do not need to implement these. But you need to understand what is happening — because every architectural decision around cost, performance, context limits, and hallucinations traces back to this layer.

Vectors — how data becomes numbers

A vector is simply a list of numbers. In AI, everything becomes a vector: a word, a sentence, an image, a user's purchase history. The numbers represent the "position" of that thing in a mathematical space.

Think of it like coordinates on a map — but instead of two dimensions (latitude, longitude), embeddings live in hundreds or thousands of dimensions. The word "restaurant" might be represented as 4,096 numbers. The word "eatery" would have very similar numbers, because they mean similar things.

This is the foundation of semantic search. When you search for "Italian food near me," the system converts your query into a vector and finds the vectors nearest to it in the database — not by matching keywords, but by measuring distance in vector space.

Matrix multiplication — the fundamental operation of every neural network

Every layer in a neural network is, at its core, a matrix multiplication. A matrix is just a grid of numbers. Matrix multiplication transforms one set of numbers into another — shrinking, rotating, and reshaping the data as it flows through each layer.

When you send text to an LLM, it gets converted to token embeddings (vectors), and those vectors are multiplied through dozens or hundreds of matrices — one per layer. Each multiplication transforms the representation, pulling out higher-level patterns.

Why this matters for architects: Matrix multiplication at scale is extremely compute-intensive. A single forward pass through GPT-4 involves trillions of floating-point operations. This is why GPU clusters cost what they cost, why inference latency is measured in milliseconds-per-token, and why context window size directly impacts your bill — more tokens means more matrix operations.

Probability and softmax — LLMs don't "know" the answer

This is the most important conceptual shift for most architects. LLMs do not retrieve answers. They do not reason the way humans do. They compute a probability distribution over their entire vocabulary — typically 50,000 to 100,000 possible next tokens — and sample from it.

The softmax function converts raw scores (called logits) into probabilities that sum to 1. The model then picks the next token based on those probabilities. Every word in a response is the result of this probabilistic sampling.

Why this matters for architects: Hallucinations are not bugs. They are the expected behaviour of a probabilistic system that has learned to produce plausible-sounding text. The model does not know when it does not know something — it just outputs whatever token sequence has the highest probability given its training. Designing for this means building retrieval layers (RAG), output validation, and human-in-the-loop checkpoints into your architecture from day one.

Neural networks — a series of learned transformations

A neural network is a chain of mathematical transformations. Data enters as numbers, passes through layers of matrix multiplications and activation functions, and exits as a prediction or generation.

Each layer learns to detect increasingly abstract patterns:

  • Early layers detect simple patterns (in text: character combinations and word fragments)
  • Middle layers detect combinations (grammatical structures, named entities, intent signals)
  • Late layers detect high-level concepts (sentiment, domain, semantic meaning)

Weights are the numbers stored in these matrices — the learned knowledge of the model. GPT-4 is estimated to have ~1.8 trillion weights. Training is the process of finding the right values for all of these weights.

Gradients and backpropagation — how models learn

During training, the model makes a prediction, that prediction is compared to the correct answer, and the difference (the error) is computed. Backpropagation calculates how much each weight contributed to the error and adjusts them accordingly — nudging each weight by a tiny amount in the right direction. This is repeated millions of times across billions of training examples.

Why this matters for architects: Training is a one-time, enormously expensive process done by AI labs. You are not doing this. But understanding it explains why pre-trained models exist, why fine-tuning is possible (you are continuing the training process on a smaller targeted dataset), and why the quality of your fine-tuning data matters so much.


4. How LLMs work — the transformer explained

In 2017, a Google research paper titled "Attention is All You Need" introduced the transformer architecture. Every major LLM in production today is built on this foundation.

The key innovation was the attention mechanism — a way for the model to weigh how much each token should influence every other token when computing a representation. When processing "The HVAC unit in Store 42 failed again," the model learns that "failed" is most relevant to "HVAC unit" — not "Store" or "42." Attention scores quantify these relationships mathematically.

Tokens are the atomic units the model works with. A token is roughly 0.75 words in English. "Restaurant" is one token. "Multicultural" might be two. Every API call is billed per token, latency scales with token count, and context limits are measured in tokens. Tokens are the currency of LLMs — manage them like memory.

Embeddings are what happen to tokens before they enter the transformer. Each token is converted into a high-dimensional vector that captures its meaning in relation to all other tokens the model has seen. These embeddings are learned during pre-training and form the foundation of semantic similarity — which is why RAG systems work.

Context window is everything the model can see at once: your system prompt, conversation history, retrieved documents, and the user's query. When you exceed it, older content is dropped. This is your most precious architectural resource — manage it deliberately.

Key insight for architects: the transformer does not read your prompt sequentially. It processes all tokens in parallel, computing attention across everything simultaneously. This is why the ordering and structure of your prompt matters in non-obvious ways — and why placing instructions at the beginning and end of a long context outperforms burying them in the middle.

INPUT TOKENS EMBED OUTPUT "Which HVAC unit is compatible with a 240V single-phase circuit?" "Which" "HVAC" "unit" "is" "compatible" "240" "V" ... 4 more tokens 11 tokens total · each token ≈ $0.000003 at current API pricing Embedding layer → Transformer layers (×N) Each token → 4096-dim vector · Attention computes token relationships · 96 layers of matrix multiply attention Next-token prediction (probability distribution over ~100K vocabulary) "The MiniSplit Pro 240V Series is fully compatible — here are three options for your load profile." P("The")=0.74 P("Yes")=0.18 P("Sure")=0.05 This entire process runs in ~200–800ms per response · cost and latency scale with token count
The complete LLM pipeline — from raw text to generated response. Every step has architectural implications for cost, latency, and quality.

5. Training vs. inference — two very different things

Most architects conflate "training a model" with "using a model." These are completely different operations with completely different cost structures.

Pre-training is what AI labs do. They feed a model trillions of tokens from the internet and books, running backpropagation for months on thousands of GPUs. The result is a base model. This costs tens of millions of dollars. You are not doing this.

Instruction tuning is how base models become useful. After pre-training, the model is further trained on examples of instruction-following. This is how GPT-4-base becomes GPT-4o, how Claude-base becomes Claude 3.5 Sonnet. The model learns to respond helpfully to instructions rather than just continuing text.

RLHF (Reinforcement Learning from Human Feedback) is how models are aligned to be helpful, harmless, and honest. Human raters compare model outputs and score them. The model is trained to prefer higher-scored outputs. This is why modern frontier models are dramatically safer and more useful than raw base models.

Fine-tuning is what you might do. You take an instruction-tuned model and continue training it on your own labeled data — your company's documents, your brand's tone, your domain's terminology. It creates a model artifact you now own and must maintain.

Inference is what runs in production every time a user sends a message. You call the API, tokens are processed through the transformer, and a response is streamed back. This is what you pay for. Inference cost is the primary operational cost of all LLM applications.


6. Prompting vs. RAG vs. fine-tuning — the architect's decision framework

This is the question I receive most often from enterprise teams: "Should we fine-tune the model on our data?"

The answer is almost always: not yet.

Prompt engineering is your first tool. A well-structured system prompt with clear instructions, a persona, constraints, and a few examples covers the majority of enterprise use cases. Zero-shot (no examples), few-shot (2–5 examples), and chain-of-thought (ask the model to reason step by step) are your primary techniques. Start here. Always.

RAG (Retrieval-Augmented Generation) is your second tool. When your use case requires the model to reason over proprietary or current data — product catalogs, policy documents, operations manuals, real-time inventory — you retrieve the relevant content and inject it into the context. RAG solves the knowledge cutoff problem and keeps sensitive data out of model training. We cover RAG in depth in Blog 2.

Fine-tuning is your last resort. Use it only when:

  • Prompting and RAG have genuinely hit their limits
  • You need the model to adopt a very specific style or format consistently
  • You have 500+ high-quality labeled examples to train on
  • You have the infrastructure to re-tune when the base model is updated

The most common and costly mistake in enterprise AI: teams jump to fine-tuning because it feels more "custom." In practice, it introduces months of delay, significant cost, and an ongoing operational burden. Prompting solves 80% of use cases. RAG solves another 15%.


7. The model ecosystem — an architect's map

The frontier model landscape is genuinely competitive. The right choice depends on your use case, data residency requirements, latency targets, and enterprise relationships.


Model ecosystem — architect's selection guide
ANTHROPIC
Claude 3.5 / 4
200K tokens · AWS Bedrock + API
BEST FOR
Long documents, nuanced instruction-following, safety-sensitive customer-facing apps
OPENAI
GPT-4o / o1
128K tokens · Azure OpenAI + API
BEST FOR
Coding, complex reasoning, broad enterprise tasks, Microsoft ecosystem integration
GOOGLE
Gemini 1.5 / 2.0
1M tokens · Vertex AI
BEST FOR
Multimodal tasks (text + image + video), Google Workspace, massive document analysis
META
Llama 3.x
128K tokens · Open weights
BEST FOR
On-premise, air-gapped, privacy-sensitive deployments — you own the model and the cost
MISTRAL
Mistral / Mixtral
32–128K tokens · EU hosted
BEST FOR
EU data residency, GDPR-first deployments, compact high-performance open models
Architect's note: Build model-agnostic from day one. Abstract your LLM calls behind an AI Gateway layer so you can swap models as the landscape evolves — without rewriting your application. We cover AI Gateway architecture in Blog 4.

8. Real-world application — Retail & QSR use cases

Let us make the theory concrete with two use cases from industries where these decisions play out very differently.

Retail Knowledge Assistant

A retail chain wants an internal tool for customer service agents — answering product questions live: "Does this HVAC unit work with a 240V circuit?" or "What is the return policy for sale items?"

Architectural decisions shaped by this blog:

  • Model: Claude or GPT-4o — strong instruction-following, 128–200K context handles the full product catalog
  • Type: Chat-tuned model via API — no fine-tuning needed
  • Tokens: System prompt constrains output length (agents are on live calls — concise responses only)
  • Prompting: Few-shot examples establish response format; system prompt defines scope boundaries
  • RAG over fine-tuning: Product catalog and policy docs retrieved at query time — not baked into weights
  • Context strategy: 10–15 retrieved chunks + conversation history fits inside 128K comfortably

Restaurant Operations Chatbot (QSR)

A quick-service restaurant group wants a chatbot store managers can query for operational guidance — food safety compliance, equipment troubleshooting, shift scheduling rules.

Architectural decisions shaped by this blog:

  • Model: Llama 3.1 8B or Mistral 7B, hosted on-premise — operational data stays off third-party servers
  • Type: SLM — lower raw capability, sufficient for structured operational queries
  • Tokens: Short specific queries at high volume — cost per query matters across hundreds of stores
  • Prompting: Brand-specific tone established via system prompt; few-shot examples critical
  • Fine-tuning consideration: If the chain has proprietary SOP terminology the base model does not know, fine-tuning on operational documents becomes justifiable — but only after RAG is validated first
  • Context window: Smaller models have tighter windows — retrieval must be precise, not generous
The same first principles — tokens, context, model type, training vs. inference — lead to completely different architectures depending on the use case. That is the point of understanding them.

Key takeaways

  1. AI → ML → Deep Learning → GenAI is a hierarchy of specificity. Know where your use case lives before scoping a project or evaluating a vendor.
  2. Foundation models, LLMs, multimodal models, and SLMs are distinct categories. Match the model type to the task, latency requirement, and deployment environment.
  3. Everything in AI is math — vectors represent meaning, matrix multiplication transforms it, probability drives generation, backpropagation teaches the weights. Understanding this demystifies costs, context limits, and hallucinations.
  4. The transformer and attention mechanism process all tokens in parallel, computing weighted relationships across everything in context. Prompt structure and ordering matter.
  5. Tokens are your currency — they determine cost, latency, and context limits. Manage them deliberately.
  6. Prompting → RAG → fine-tuning is the right sequencing. Most enterprise teams skip to fine-tuning and waste months.
  7. Model selection is an architectural decision — not a vendor preference. Evaluate against your actual use case, data residency requirements, and deployment environment.

What's next

In Blog 2 — RAG Systems & Vector Databases, we go deep on retrieval-augmented generation: chunking strategies, embedding model selection, vector database comparisons (Pinecone vs. Qdrant vs. Weaviate vs. Chroma), and how to actually measure whether your retrieval is working.

Follow along at solutionarchitecture.ai or subscribe below to get notified when Blog 2 drops.

— Firdous | Enterprise AI Architect | Designing Intelligent Systems for the AI-First Enterprise