The AI Stack: Application, Model & Infrastructure Layers
Introduction
What Is AI Engineering? (And Why It Exploded) gave Chip Huyen's definition of the field: "the process of building applications with readily available foundation models."
That leaves a practical question. An application built on a model has many parts: the model, the data it learned from, the machines it runs on, the instructions it is given, the screen a user sees. Which of them do you build, and which do you start from?
Huyen sorts them into three layers. The sections below go through each layer, say where AI engineering sits among them, and place the seven courses here on them.
The Three Layers
In the first chapter of her book AI Engineering (O'Reilly, 2025), Huyen writes: "There are three layers to any AI application stack: application development, model development, and infrastructure."
- Application development, at the top, is what you build around a model. In her words, it "involves providing a model with good prompts and necessary context."
- Model development, in the middle, makes and changes models: training them, preparing the data they learn from, and making them run faster and cheaper.
- Infrastructure, at the bottom, "includes tooling for model serving, managing data and compute, and monitoring."
What the top two layers make are applications and models, which she calls "the products of the application development and model development layers, respectively."
The order of the work runs from the top: "When developing an AI application, you'll likely start from the top layer and move downwards as needed." Try what the top layer can do first, and go down a layer only when it cannot give you what you need.

The figure draws each layer with the parts the next three sections describe.
Layer 1: Application Development
Huyen names three jobs in this layer: "evaluation, prompt engineering, and AI interface."
- Prompts and context. Prompt engineering is "about getting AI models to express desirable behaviors from the input alone, without changing the model weights." It covers more than the instructions: "It's also about giving the model the necessary context and tools for a given task." That puts retrieval (RAG), which finds the passages a request needs and adds them to it, and tools, which let a model call functions, in this layer. In her survey of popular open source AI tools (March 2024), she filed RAG, agents and the frameworks for building AI applications here too.
- Evaluation. "Evaluation is needed to select models, benchmark progress, determine whether an application is ready for deployment, and to detect issues and opportunities for improvement in production." It is a bigger problem than it was before foundation models, because their answers are open-ended. For a chatbot, "there are so many possible responses to each prompt that it is impossible to curate an exhaustive list of ground truths to compare a model's response to."
- The AI interface. "AI interface means creating an interface for end users to interact with AI applications." Huyen's examples include web, desktop and phone apps, browser extensions, bots inside chat apps such as Slack and WhatsApp, and plug-ins for products such as VSCode.
None of this changes a model's weights; that is what keeps it in the top layer. It is also where the new tools came fastest. Counting the AI repositories on GitHub with at least 500 stars in March 2024, Huyen found that in 2023 "the categories which saw the biggest increases were applications and application development."
Layer 2: Model Development
"Model development is the layer most commonly associated with traditional ML engineering. It has three main responsibilities: modeling and training, dataset engineering, and inference optimization."
- Modeling and training is "the process of coming up with a model architecture, training it, and fine-tuning it." Training comes in stages. Pre-training "refers to training a model from scratch; the model weights are randomly initialized", and it "is often the most resource-intensive by a long shot." For the InstructGPT model, Huyen writes, "pre-training takes up to 98% of the overall compute and data resources." Fine-tuning "means continuing to train a previously-trained model", and typically needs less data and compute. Huyen tells the two apart by who does the training. Further training by a model's maker is usually called post-training. "It's fine-tuning when it's done by application developers."
- Dataset engineering is "curating, generating, and annotating data needed for training and adapting AI models." In AI engineering, she writes, working with data is "more about deduplication, tokenization, context retrieval, and quality control, including removing sensitive information and toxic data."
- Inference optimization "means making models faster and cheaper." It matters because many of these models write their answer one token at a time: "If it takes 10ms for a model to generate a token, it'll take a second to generate an output of 100 tokens". Quantization is one of its methods: "the process of reducing the precision of model weights".
How much of this layer you do is a choice. A model can be used behind a provider's API, or self-hosted: downloaded and run on your own machines. Either way it was pre-trained by someone else. As Huyen puts it, "With AI engineering, you use a model someone else has trained." You enter this layer when you fine-tune that model, prepare data for it, or make it run faster and cheaper yourself.
Layer 3: Infrastructure
At the bottom of the stack, in Huyen's 2024 survey: "Infrastructure is about managing data, compute, and toolings for serving, monitoring, and other platform work."
- Model serving runs a model so that requests can reach it. A provider's API does this for you. With open weights you serve the model yourself, with tools such as vLLM or NVIDIA's Triton, both of which she files here.
- Compute is the hardware the models run and train on. Because these models need so much of it, she notes, there is "more need for engineers who know how to work with GPUs and big clusters."
- Data, including the vector database that retrieval searches. Her survey puts vector search and database tools such as FAISS, Milvus, Qdrant and LanceDB in this layer, while noting that "many argue this shouldn't be a category at all": the makers of existing databases, such as DataStax and Redis, are bringing vector search to where the data already is.
- Monitoring shows what the system does in production, through metrics, logs and traces.
- Platform pieces round it out, such as a model gateway, which Huyen describes as "an intermediate layer that allows your organization to interface with different models in a unified and secure manner."
This is the layer whose open source tools grew least. In her count of repositories, "The infrastructure layer saw some growth, but much less than in other layers." Her reason: "even though models and applications have changed, the core infrastructural needs of resource management, serving, monitoring, etc., remain the same."
Where AI Engineering Sits
Huyen puts the difference from machine learning engineering in one sentence: "AI engineering differs from ML engineering in that it's less about model development, and more about adapting and evaluating models."
Adapting a model can happen in two layers. "Prompt-based techniques, which includes prompt engineering, adapt a model without updating the model weights": that is the top layer. Fine-tuning "requires updating model weights": that is the middle one. The two differ in effort. Prompt engineering "is easier to get started on and requires less data." Fine-tuning techniques "are more complicated and require more data, but they can significantly improve a model's quality, latency, and cost."
So the work of AI engineering sits mostly at the top, goes down into the middle layer to fine-tune when prompts are not enough, and stands on the bottom layer to ship. Why the top matters most: "With foundation models, where many teams use the same model, differentiation must be gained through the application development process."
The order of the work turned round as well. "With traditional ML engineering, you usually start with gathering data and training a model. Building the product comes last." With models ready to use, "it's possible to start with building the product first, and only invest in data and models once the product shows promise."
How the jobs divide along these layers is the subject of AI Engineer vs ML Engineer vs Full-Stack Engineer.
How the Courses Map to the Stack
The seven courses here, placed on the stack by what their lessons teach:
- Foundations of AI Engineering covers how models are made, which is model development (Pretraining: Learning from the Internet, Supervised Fine-Tuning (SFT): Teaching Instruction-Following), and then prompts, structured output and context, which are application development (Anatomy of a Great Prompt, What Is Context Engineering? (The 2026 Shift)).
- RAG & Retrieval Systems covers retrieval, which is application development, and the vector databases it searches, which are infrastructure (Tour of Vector DBs: pgvector, Pinecone, Weaviate, Chroma, Qdrant).
- AI Agents & MCP is application development: tools, memory, the agent loop and MCP.
- LLM Evaluation & Observability covers evaluation, in the top layer, and watching a system in production, which is monitoring in the bottom one (Tracing LLM & Agent Calls, Detecting Drift & Degradation).
- Fine-Tuning & Model Customization works in model development: fine-tuning, quantization and the data work around them (LoRA & QLoRA Explained, Cleaning, Dedup & Formatting).
- Production AI Engineering (LLMOps) crosses all three: inference optimization in the middle (The KV Cache, Batching & Continuous Batching), serving and the gateway at the bottom (Serving with vLLM / TGI, The Model Gateway & Router), and the interface at the top (Streaming UX (TTFT, Token-by-Token, Markdown Buffering)).
- Capstone Projects & Career builds projects that cross all three, from Project Brief & Architecture to Serving the Model.
Try It Yourself: Place Each Piece
A team is building a support bot for an online shop. For each piece of its work below, pick the layer it belongs to. Each answer names the section to read again.
Place each piece in the stack
1 / 12Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Multiple choice
Common Misconceptions
- "AI engineering never touches a model's weights." Fine-tuning changes them, and application developers do it: "It's fine-tuning when it's done by application developers." The Fine-Tuning & Model Customization course is about exactly that.
- "You need machine learning theory before you can build." "With the availability of foundation models, ML knowledge is no longer a must-have for building AI applications." Huyen adds that it is "still extremely valuable, as it expands the set of tools you can use, and helps with trouble-shooting when a model doesn't work as expected."
- "Infrastructure is someone else's problem." A provider's API serves the model for you, but your application still needs its own monitoring, and data such as a vector database still has to live somewhere.
- "Build from the bottom up." Huyen's order is the reverse: start at the top and go down only as needed.
- "The vector database is part of RAG, so it is application development." The retrieval code is. The database it searches is infrastructure in Huyen's survey.
Key Takeaways
- Three layers, top to bottom: application development, model development, infrastructure.
- Application development changes what goes into a model and what reaches the user: prompts, context and retrieval, tools and agents, evaluation, the interface. No weights change.
- Model development makes or changes the model: pre-training, fine-tuning, dataset engineering, inference optimization. Application developers fine-tune too.
- Infrastructure serves, runs and watches it: serving, compute, data and vector search, monitoring, and platform pieces such as a gateway.
- Start at the top and go down only as needed. When many teams use the same model, the difference is made in the application.
Next: AI Engineer vs ML Engineer vs Full-Stack Engineer, three roles and how they differ.