Everything you need to know to build your own AI brain — no jargon, just clear steps.
A comprehensive technical roadmap covering data pipelines, transformer architectures, distributed training, RLHF, and production deployment.
A research-oriented map of the LLM landscape — foundational papers, open problems, current frontiers, and the directions shaping the next generation of language models.
A team-first view of building an LLM — who you need at every stage, what they do, how they coordinate, and how the whole organisation moves together to ship a frontier model.
The founder's playbook — how to incorporate, raise money, decide what to build, make your first hires, set up infrastructure, go to market, and turn a research project into a revenue-generating AI company.
The investor's lens — startup financials, valuation frameworks, funding mechanics, cap tables, burn discipline, the path to IPO, and hard-won lessons from AI founders who've raised billions.
The agentic lens — how autonomous AI agents, coding recursion, and intelligent frameworks are reshaping every stage of LLM development, and whether the current agentic market is a durable category or a transitionary layer soon absorbed by increasingly capable foundation models.
The builder's compass — how to find market gaps, generate ideas, differentiate your product, attract talent, build authority, manage yourself and your team, and decide when to start, when to pivot, and when to stop in the AI era.
Think of it like building a city — each stage builds on the last.
Each stage corresponds to a critical ML engineering milestone with distinct compute, data, and human resource requirements.
Each stage is a research frontier — hover over the paper timelines to trace how each idea evolved and where the open problems lie.
Imagine you're teaching a child to read. You'd give them millions of books, articles, and conversations. That's exactly what we do — except we collect trillions of words from the internet, books, and research papers. Then we clean it up: remove spam, duplicates, and offensive content.
The corpus must be carefully curated: Common Crawl (petabytes of web data), books corpora (Books1/2), Wikipedia, GitHub, arXiv, StackExchange, etc. Preprocessing includes: deduplication (MinHash/SimHash), quality filtering (perplexity-based), PII redaction, language detection, and document scoring. The Datatrove or Apache Spark pipelines are typical at scale.
Traditional data pipelines are static — fixed URLs, scheduled downloads. Agentic data collection uses browser-driving agents that navigate websites like humans: filling forms, following pagination, handling login walls, adapting to UI changes without re-engineering. GPT-4o + Playwright agents at Llama 3's data team collected 3× more diverse web content than script-based crawlers.
Instead of scraping everything and filtering later, active learning agents identify which data would most improve model performance and selectively collect it. An agent monitors model weaknesses, generates targeted queries, finds relevant sources, and adds only the high-signal data — reducing collection cost by 60-80% while improving final model quality.
Autonomous agents evaluate data quality at ingestion time: detecting near-duplicates, flagging low-quality text, identifying potential copyright issues, and scoring educational value (phi-2 "textbook quality" methodology). What previously needed human review teams now runs continuously at petabyte scale.
Computers can't read words — they only understand numbers. Tokenization chops text into small pieces (called tokens) and assigns each a number. "Hello" might become [72, 101, 108, 108, 111] or just [15496] depending on the method. GPT-4 uses about 100,000 different tokens.
Byte-Pair Encoding (BPE) or SentencePiece iteratively merges frequent character pairs to form a vocabulary of ~32K–100K subword tokens. The tokenizer is trained on a representative subset of the corpus. Vocabulary size trades off between sequence length (larger vocab = shorter sequences) and embedding table memory. GPT-4 uses cl100k_base (100,277 tokens).
Preprocessing agents sample batches, run quality metrics (perplexity, deduplication ratio, toxicity scores), identify systematic issues (encoding errors, non-native language contamination, benchmark data leakage), and generate automated reports with fix recommendations — replacing weeks of manual data curation per training run.
When real data is scarce or low quality, agents generate synthetic training examples. GPT-4 generates math reasoning chains; Claude generates diverse instruction-following samples; coding agents generate test cases and solutions. Models like Phi-3 and Orca were trained substantially on GPT-4-generated synthetic data — the student surpasses the teacher.
Minhash LSH deduplication agents identify near-duplicate documents at trillion-token scale without human review. Separate agents analyze domain distribution, detect over-represented sources (Common Crawl bias), and rebalance the dataset to Chinchilla-optimal composition — tasks that previously required months of data science work.
Now we design the AI's "brain". The most important invention here is called Attention — it lets the AI focus on the right words when making predictions, just like how you focus on key words when reading a sentence. We stack many layers of these attention blocks on top of each other.
The decoder-only transformer (GPT architecture) consists of L stacked blocks, each containing: multi-head causal self-attention (Q/K/V projections), followed by a position-wise FFN (typically 4× hidden dim with GELU/SwiGLU). Key design choices: RoPE vs ALiBi positional encodings, GQA vs MHA, RMSNorm vs LayerNorm, context length, and MoE vs dense FFN.
| Model Size | Layers | Heads | Hidden Dim | Parameters |
|---|---|---|---|---|
| Small (GPT-2) | 12 | 12 | 768 | 117M |
| Medium | 24 | 16 | 1024 | 345M |
| Large (GPT-3) | 96 | 96 | 12288 | 175B |
| XL (GPT-4 est.) | 120+ | 128+ | ~25K | ~1.8T |
NAS agents explore architecture hyperparameter spaces (attention heads, layer depth, FFN ratio, activation functions) by training proxy models, evaluating them, and iteratively refining the search — automating what previously required domain experts. Google's Gemini and Apple's on-device models used NAS agents to find efficiency-optimized architectures.
Agents design and run ablation studies autonomously: vary one component, hold others constant, measure impact, log results, generate hypothesis about why performance changed, design the next experiment. What took a research team weeks of coordination now runs as an overnight automated pipeline — compressing architecture iteration cycles from months to days.
Coding agents (Claude Code, Copilot) now write architecture implementations from spec — translating a paper's pseudocode into production-ready PyTorch/JAX, including custom CUDA kernels for attention variants. The time to implement a novel architecture dropped from 2-4 weeks to 1-3 days for a skilled team using AI coding agents.
This is the most expensive step. We feed the model all our data and make it predict the next word billions of times. Every time it's wrong, we adjust its internal numbers slightly. After doing this trillions of times across thousands of powerful GPUs running for months, the model learns to predict language incredibly well.
Pre-training is autoregressive next-token prediction minimizing cross-entropy loss via AdamW optimizer with cosine LR scheduling and warmup. Requires distributed training: tensor parallelism, pipeline parallelism, and data parallelism (3D parallelism). Megatron-LM, DeepSpeed ZeRO, or FSDP are standard frameworks. Chinchilla scaling laws guide optimal token/parameter ratios (≈20 tokens per parameter).
Distributed training at scale (10,000+ GPUs) requires constant monitoring — detecting GPU failures, loss spikes, gradient explosions, and dead nodes. Agentic monitoring systems watch training metrics in real-time, automatically restart failed nodes, checkpoint on anomalies, and page engineers only when human judgment is needed. Meta's OAM (Open Agent Monitoring) reduced manual intervention by 70% during LLaMA 3 training.
Bayesian optimization agents (Optuna, Ray Tune) run thousands of small-scale experiments to find optimal learning rate schedules, warmup periods, batch sizes, and gradient clipping thresholds — then extrapolate to full-scale training. These agents replaced the "loss curve intuition" that previously resided exclusively in senior ML engineers.
Instead of shuffling all data uniformly, curriculum agents order training examples by difficulty — starting simple, introducing hard examples as the model matures. Dynamic curriculum agents monitor model performance on a held-out validation set and continuously adjust the data mix in real-time, converging 15-30% faster than random ordering.
After pre-training, the model can predict text but doesn't know how to be helpful. Fine-tuning is like teaching it manners. We show it thousands of examples of good conversations — "Human asks X, Assistant answers Y" — and it learns to be a helpful assistant instead of just a text predictor.
Supervised Fine-Tuning (SFT) trains the model on curated instruction-response pairs (FLAN, Alpaca, ShareGPT, OpenAssistant-style data). The base model is fine-tuned on these with a lower LR and fewer steps. Parameter-efficient alternatives: LoRA/QLoRA adapt only a small adapter matrix (r=8–64), reducing trainable params by 99%+ while retaining most of the base model's knowledge.
Constitutional AI (Anthropic) uses an agent to critique and revise model outputs against a written constitution — replacing thousands of human preference labels with automated self-critique. RLAIF (RL from AI Feedback) extends this: a strong model generates preference labels for a weaker model. DeepSeek R1 trained primarily on AI-generated preference data, dramatically reducing human labeler cost.
Red-teaming agents systematically probe models for safety failures — generating thousands of adversarial prompts, jailbreak attempts, and harmful requests automatically. Automated red-teaming finds failure modes 10-50× faster than human red teams and runs continuously as the model evolves, catching regressions before deployment.
PRM agents evaluate not just final answers but each step of reasoning — identifying exactly where in a chain-of-thought the model went wrong. Training with PRM feedback produces models that reason more reliably and correct their own mistakes mid-generation. o1, o3, and R1 all use PRM-based training as their core alignment innovation.
We ask humans to rate two AI responses: "Which is better, A or B?" We collect thousands of these ratings, train a Judge AI on them, then use that judge to continuously improve our main model. This is how ChatGPT learned to sound so natural and helpful — it's basically teaching the AI using human preferences.
RLHF (InstructGPT/ChatGPT approach): (1) Train a Reward Model on human preference pairs (Bradley-Terry model), (2) Fine-tune the policy via PPO with KL-divergence penalty to prevent reward hacking. Modern alternatives: DPO (Direct Preference Optimization) eliminates the separate RM and optimizes preferences directly. GRPO (DeepSeek), RLAIF (Constitutional AI), and SimPO are further refinements.
Fine-tuning agents automate the full domain adaptation pipeline: scrape domain corpus, clean and deduplicate, generate Q&A pairs from documents (GPT-4 as synthetic teacher), apply LoRA fine-tuning with hyperparameter search, evaluate on domain benchmark, and iterate until quality threshold is met. What previously required 3-4 ML engineers now runs in a single agentic workflow.
Agents generate diverse instruction-following datasets for fine-tuning: given a topic, an agent creates diverse question types (factual, analytical, creative, adversarial), generates high-quality answers, critiques them for accuracy, and filters for quality — producing training data that matches or exceeds expensive human-curated datasets for most domains.
Models fine-tune on their own better outputs: generate responses, filter high-quality ones, fine-tune on them, repeat. Spin, SELF-INSTRUCT, and Evol-Instruct are agentic self-improvement loops. WizardCoder (competitive with GPT-4 on coding) was fine-tuned entirely on self-generated progressively harder problems — no human-written code in training data.
Before releasing your AI, you need to test it rigorously. We run thousands of standardized tests — math problems, trivia questions, coding tasks — and compare our model's scores against other models. We also test for harmful outputs, biases, and factual errors. Think of it like a final exam before graduation.
Standard benchmarks: MMLU (57-subject knowledge), HellaSwag (commonsense), HumanEval/MBPP (code), GSM8K/MATH (reasoning), TruthfulQA, BIG-Bench Hard, MT-Bench (chat), LMSYS Chatbot Arena (ELO-based human eval). Red-teaming for safety: adversarial prompts, jailbreaks, bias audits, and Constitutional AI evaluations. Eleuther's lm-evaluation-harness is standard.
LLM-as-judge evaluation uses a frontier model to score outputs on quality, faithfulness, helpfulness, and safety — replacing expensive human evaluations for many use cases. Agents run hundreds of test cases in parallel, generate evaluation reports, identify failure patterns, and flag regressions. Braintrust, LangSmith, and Arize Phoenix automate the eval → fix → re-eval loop.
Specialized adversarial agents play the role of difficult users — asking ambiguous questions, providing contradictory context, testing edge cases, and attempting jailbreaks. These agent "testers" run continuously against production models, providing real-time safety and quality signals without human testers. DeepMind's FunSearch used agent-vs-agent evaluation to discover novel mathematical algorithms.
Benchmark contamination (models trained on test sets) makes traditional evals unreliable. Agentic evaluation uses tasks that require real tool use — WebArena agents browse real websites, SWE-bench agents fix real GitHub issues, GAIA agents solve multi-step research tasks with web access. These "living evals" cannot be memorized and reflect true capability.
Now we make it available to users. This means putting the model on powerful servers, compressing it so it runs faster, building an API so apps can talk to it, and scaling up so thousands of people can use it simultaneously. It's like opening a restaurant — you need the kitchen (servers), menu (API), and enough staff (infrastructure) to serve everyone.
Inference optimization: quantization (AWQ, GPTQ, bitsandbytes INT4), speculative decoding, FlashAttention-2, PagedAttention (vLLM), continuous batching, tensor parallelism across GPUs. Serving frameworks: vLLM, TGI, TensorRT-LLM, Triton. For production: rate limiting, safety filters, streaming tokens, observability (latency, TTFT, TPS metrics), and cost per token optimization.
Deployment agents monitor inference clusters in real-time: detect latency spikes, scale capacity preemptively, restart unhealthy pods, route traffic away from failing nodes, and roll back bad model versions automatically. Mean-time-to-recovery for incidents at OpenAI and Anthropic dropped 60-80% after deploying agentic ops systems versus manual alerting-and-fix workflows.
Production agents collect user feedback signals (thumbs down, corrections, regeneration requests), identify failure clusters, generate targeted fine-tuning data from failures, trigger automated fine-tuning runs, A/B test the improved model against the baseline, and promote it if metrics improve — a fully automated capability improvement loop with human oversight only at promotion gates.
Safety classifier agents monitor every production response for policy violations, hallucinations, and harmful content — in real-time, at millions of requests per day. These agents flag suspicious patterns, investigate anomalies, generate incident reports, and adapt classifiers as new attack patterns emerge. Traditional keyword filters are replaced by LLM-powered guardrail agents that understand context.
From idea in a coffee shop to billion-dollar AI company — the real story behind OpenAI, Anthropic, Mistral, and what it takes to repeat it
How the world's top AI companies got started
How AI companies raise money at every stage
The most important and hardest decisions you'll make
The order and profiles that matter most at each stage
The exact stack used by modern AI startups, from day one to Series B
How to turn a research project into a revenue-generating company
How AI companies actually make money
What the founders of OpenAI, Anthropic, Mistral, Cohere, and others wish they'd known
Startup financials, valuation frameworks, funding mechanics, cap tables, burn discipline, the hard realities of raising money, and lessons from founders who've built billion-dollar AI companies
Finding gaps, building conviction, attracting talent, managing yourself and others — everything the great AI founders learned that isn't in any textbook
How the whole organisation aligns to ship a frontier LLM
A structured, opinionated sequence of resources — from linear algebra to production-grade LLM systems. Each phase lists the best books, courses, papers, and code repos.
What's solved, what's open, where to focus your PhD or research career
Is the agentic market a durable category — or a transitory layer? Can LLMs eventually absorb their own scaffolding? How does coding recursion drive model intelligence? And what happens to domain-specific AI businesses when foundation models keep eating upward?
The coding agent evidence — and what it tells us about where frontier models are heading
The most compelling evidence that LLMs absorb agentic behaviors natively comes from coding agents. In 2022, using a model to write code required elaborate prompt engineering — you had to tell it explicitly to "think step by step," to "test the code," to "handle edge cases." By 2025, Claude 4 and GPT-4o do all of this automatically: they write the code, mentally simulate execution, identify edge cases, self-correct syntax errors, and propose test cases — without any scaffolding prompting them to do so.
This happened because coding agents generated training trajectories. Every successful Copilot completion, every Devin repair, every Claude Code fix became implicit signal that "good code generation looks like: plan → draft → review → test → refine." Models trained on billions of these trajectories internalized the agentic loop as a pattern of thought, not a rule imposed from outside.
The most powerful feedback loop in AI: models writing code that trains better models
Code is a uniquely powerful training modality for language models, for one reason: code has verifiable ground truth. A test suite either passes or fails. A function either produces the correct output or it doesn't. This grounding allows models to receive objective feedback on their reasoning — unlike natural language, where "correctness" is often subjective.
AlphaCode 2 demonstrated this at scale: generate 1 million code solutions per problem, execute all of them, train on the successful traces. The resulting model solved competition programming problems at expert human level. The same recursive loop now powers o1, o3, and DeepSeek R1's math and science reasoning — code execution as a reasoning verifier is the key to reliable inference-time scaling.
The deeper implication: code is teaching models to think rigorously. Every generation of frontier models trains on more AI-generated code, verified by tests, creating a recursive improvement spiral. Models that write better code generate better training data that produces models that write even better code. This is one of the few self-improving loops in AI that has demonstrably worked at scale.
The playbook for building durable domain agents in a world where foundation models keep improving
Agentic behavior dramatically amplifies the value of domain-specific LLMs. A domain model that only generates text about radiology is limited. A domain agent that can retrieve patient records, query DICOM viewers, cross-reference literature, flag anomalies, and draft reports is a genuinely transformative product. The agent architecture turns a narrow model into a complete domain workflow.
Fine-tuned on clinical notes + USMLE. Agent layer: EHR access, DICOM viewer, drug interaction database, evidence retrieval. The agent turns a knowledgeable model into a clinical workflow assistant.
Fine-tuned on case law + contracts. Agent layer: Westlaw/LexisNexis access, contract comparison, clause library, court filing systems. Reduces due diligence from weeks to hours.
Fine-tuned on financial documents + market data. Agent layer: real-time Bloomberg terminal access, SEC filings, earnings call transcripts, portfolio management systems.
Fine-tuned on scientific literature. Agent layer: PubMed retrieval, protein structure databases, lab instrument APIs, hypothesis generation + experimental design loops.
The disruption pattern: foundation models expand upward, making layers below them obsolete
There is a consistent disruption pattern in AI: foundation models absorb functionality that previously required separate tools. As models improve, capabilities that once lived in specialized products get absorbed natively. This process has already happened repeatedly:
Tools that connect to data sources no LLM has — internal databases, proprietary feeds, institution-specific systems. A model can't replace a tool that gives it access to data it doesn't have.
HIPAA, SOC2, FedRAMP, GDPR compliance is not a model capability — it's a legal and architectural property. Regulated industries need certified deployments, not better base models.
EHR integrations, banking core system connectors, manufacturing MES integrations took years to build. LLM capability improvements don't replace these integration layers.
Products that are essentially "LLM + prompt + UI" with no proprietary data, integrations, or compliance moat. These face direct absorption as frontier model capability advances.
The most important strategic question for anyone building in the agentic AI space
The agentic AI market is partially transitionary and partially durable. The key is understanding which layer you're building in.
LangChain-style wrappers that handle prompt formatting, tool calling, and basic memory. As models natively understand tool use and as MCP standardizes tool schemas, the orchestration layer becomes thinner and eventually unnecessary for simple agents. Already happening: GPT-4o and Claude 4 use tools without LangChain in most production deployments.
A "legal contract review" agent built on GPT-4 faces risk from GPT-5's improved legal reasoning. However, the risk is absorbed if the agent has deep document storage, law firm integrations, and compliance infrastructure — those persist. The model-agnostic wrapper part gets absorbed; the integration moat survives.
LangSmith, Weights & Biases, Arize Phoenix — tools for tracing, debugging, evaluating, and monitoring agent systems. These become more valuable as agents grow more complex. You need observability regardless of which foundation model is under the hood.
Coordinating 100 specialized agents working in parallel on an enterprise process — with state management, error recovery, human checkpoints, and audit logs — is not a model capability. It's systems engineering. LangGraph, CrewAI, and custom orchestration systems address this layer, which grows more complex as agents grow more capable.
Salesforce Agentforce, ServiceNow AI, Workday AI Agents — these are platform plays with existing enterprise contracts, data, and trust. The LLM inside improves over time; the platform moat deepens. A better foundation model makes Agentforce more capable, not obsolete.
LangGraph, AutoGen, CrewAI, and MCP: who thrives as models get natively agentic?
State machine orchestration, multi-agent graphs, and human-in-the-loop checkpoints address inherent complexity in enterprise agent workflows — not model limitations. As models improve, LangGraph graphs become simpler to write but more valuable to have. Complexity of real-world processes (not model weakness) is the driver.
MCP becomes more valuable as more models and frameworks adopt it. It's a protocol — protocols win by ubiquity, not by competing with model capability. USB-C didn't get absorbed by better laptops; it became the standard connector. MCP is on the same trajectory.
The generic chain and agent abstractions are under pressure. But LangSmith (observability) and the ecosystem of 500+ integrations create durable value. LangChain is pivoting from "make LLMs work" to "manage AI systems in production" — the right strategic direction.
Microsoft's frameworks benefit from Azure and Office 365 integration moats. Standalone AutoGen faces pressure as GPT-5 natively handles multi-agent conversations. The enterprise distribution (through Microsoft 365 Copilot) is the durable asset, not the framework itself.
Dozens of "build an agent in 5 minutes" frameworks that add a thin layer over OpenAI function calling. As models natively handle tool use and MCP standardizes tool schemas, these provide decreasing marginal value. The market consolidates to a few winners with deep enterprise integrations.
Braintrust, Arize, LangSmith — agent evaluation grows more important as agents become more autonomous and decisions become higher-stakes. These platforms are model-agnostic, framework-agnostic, and become more valuable as the risk surface of autonomous AI grows.
The strategic playbook for building defensible AI businesses when foundation models keep getting better
Don't try to stay ahead of what models can do natively — instead, run faster at the frontier of what they can't yet do. Today that's complex multi-step domain workflows. By the time GPT-5 absorbs your current product, you've built the GPT-5-powered version that does something GPT-6 doesn't yet do. This is Harvey AI's strategy — constant product evolution.
Build systems that accumulate proprietary data over time — customer contracts, clinical notes, financial transactions, internal emails. This data trains fine-tuned models that outperform general models on your domain. The longer you operate, the more data you accumulate, and the more valuable your domain model becomes — regardless of how good the base model gets.
Deep integrations with industry systems (EHR, trading platforms, legal databases) take years to build and are not replicated by foundation model improvements. The foundation model inside your product improves over time; the integrations that make it useful stay moated. Epic, Cerner, Bloomberg — integration moats outlast model capability moats by a decade.
HIPAA BAAs, SOC2 Type II, FedRAMP, financial regulatory compliance — these take 12-24 months to achieve and are prerequisites for selling to regulated industries. A hospital cannot use ChatGPT; it can use a HIPAA-certified domain agent. The compliance layer is a structural barrier that survives model improvements.
If you serve multiple foundation models, you can't be disrupted by any single one improving. Tools like Weights & Biases, Helicone, and Braintrust work with every model — they benefit from the entire AI ecosystem growing without depending on any single lab's success.
The entire LLM development pipeline becomes agentic: agents collect data, agents design experiments, agents run training, agents evaluate results, agents generate the next training data. Human researchers set goals and review milestones — the rest is autonomous. This is not science fiction; it's the trajectory of current frontier lab workflows.
Models that write code can write model training code. Models that debug code can debug training pipelines. As models become sufficiently capable software engineers, they begin contributing to their own development — a recursive improvement loop with potentially compounding returns on capability.
Agentic AI isn't just a feature — it's a new economic paradigm. AI agents will buy services from other AI agents, pay in API credits, negotiate contracts, manage subagents, and report to human supervisors. The "company" of the future may have 10 humans managing 10,000 AI agents — and the entire infrastructure for this economy is being built right now.
As agentic AI matures, intelligence becomes infrastructure — as invisible and ubiquitous as cloud compute or the internet. Agentic behaviors won't be "features" of specific products; they'll be capabilities embedded in every software system. The winners will be those who built the reliable, trustworthy, observable agentic infrastructure before it became commoditized.