Chapter 16: Advancing to RAG, Web UI, and fine-tuning
The chapter introduces advanced directions that build on the existing chatbot, including RAG, Open WebUI, agents, and fine-tuning.
After this chapter you will be able to
- Chatbot knowledge limits and RAG. Explain that a chatbot relying on its training data cannot answer questions about personal documents, an internal knowledge base, or events after training, and that RAG addresses this limitation.
- RAG document context flow. Explain that RAG retrieves relevant information from your documents before generation, supplies it alongside the user’s question, and lets the AI answer using both that information and its general knowledge.
- Closest vector document search. Trace how a RAG application converts a question into a vector and finds stored documents with the closest vectors, rather than requiring matching keywords.
- Grounded answers through retrieval. Explain that the AI finds a relevant document and uses it to answer from source material, reducing hallucinations.
- Loading Documents From Files. Describe how to prepare short documents for the example script and why the location from which the script is run matters.
- Chunking Long Documents. Explain what chunking does and why retrieval uses it for long documents.
- Open WebUI and local processing. Explain what Open WebUI provides on top of Ollama and why a local Ollama backend alone does not guarantee that all processing stays local.
- Ready-made versus self-built chat. Distinguish when to use Open WebUI from when to build the Streamlit chatbot yourself.
- Docker containers and installation choice. Explain that Docker runs Open WebUI as a service in a packaged, isolated container rather than installing only a command-line package, and why a reader might choose to stay with Python and Streamlit instead.
- Ollama connection and conversation storage. Explain what the two highlighted docker run flags do when starting Open WebUI.
- Open WebUI startup and sign-in. Describe the startup sequence from running Docker Desktop to opening Open WebUI, including the first account and model detection.
- Local model and chat features. Describe how Open WebUI supports working with Ollama models and conversations: switching models, finding saved chats, chatting with uploaded PDFs, and saving persona presets.
- TEMPLATE instruction purpose. Explain that the TEMPLATE instruction controls how conversation messages are formatted for the underlying model.
- Custom model creation workflow. Describe how to save a customization description as a file named Modelfile, create a model from it, and find and use the resulting model.
- Reproducible custom model configurations. Explain that sharing a Modelfile lets someone else re-create the same custom model configuration.
- LangChain’s reusable building blocks. Explain why a developer might use LangChain when a chatbot needs retrieval, memory, tools, or a multistep workflow. Describe it as a framework that combines tested components and supports Ollama.
- Value of combining components. Explain why connecting LangChain to Ollama is not, by itself, much different from using the Ollama Python library directly, and where the section says LangChain’s value lies.
- Chain pipeline and data flow. Trace how a chain connects a prompt template, an LLM call, and output parsing using the | operator.
- Standard LLM building blocks. Explain why LangChain can simplify building LLM applications: it offers a standard set of well-tested building blocks instead of requiring custom code for every feature.
- Agent actions and tool use. Explain how an AI agent differs from an LLM that only generates text: it can choose an action, use a tool, read the result, and decide what to do next.
- LLM tool choice and answer. Trace the LLM’s role in the full agent setup described here: receiving the question and tool descriptions, deciding whether to use a tool and with what input, then answering after receiving its output.
- Agent tool selection. Explain that the LLM reads tool descriptions and judges whether a tool fits the task, rather than following rigid selection rules. If a suitable tool exists, it uses it; otherwise, it answers from its own knowledge.
- Practical agent use cases. Explain what makes the listed tasks suitable for agents, and describe how agents could help in at least two of them.
- OpenClaw architecture and extensibility. Explain the roles of OpenClaw’s gateway, protocol layer, and ClawHub skills, and state that it supports local models through Ollama.
- Local agent security risks. Justify why running the entire OpenClaw stack locally still requires care: a tool-using agent may access files, run commands, or change system state if configured carelessly.
- Agent and model separation. Explain which work runs on PicoClaw's edge device and which work runs on an LLM backend, and distinguish the agent's memory needs from the model's.
- Agent cost amplification. Explain why API costs matter more for a continuously running autonomous agent than for a personal chatbot.
- Agent deployment cost comparison. Describe how to estimate a hosted agent's token charges and what else to consider when comparing hosted APIs with local inference.
- Fine-tuning a pretrained model. Explain what fine-tuning changes about a pretrained model and what data is used.
- Choosing among customization approaches. Distinguish system prompts, RAG, and fine-tuning using the section’s analogy, and explain why fine-tuning is not the default choice for most use cases.
- GGUF packaging for Ollama. Explain why a fine-tuned model is commonly exported and quantized as a GGUF file before importing it into Ollama.
- Quantization memory and quality tradeoff. Explain how quantization reduces model memory use and why more aggressive compression can affect output quality. Distinguish file or weight size from the additional memory needed during inference.
- Fine-tuning workflow stages. Trace the high-level workflow: prepare examples, choose a base model, train it with a fine-tuning framework, export it to GGUF, create it in Ollama, and test and refine it.
- Training to serving pipeline. Trace the workflow from preparing data and fine-tuning a base model with Unsloth through GGUF export to local serving with Ollama.
- GGUF handoff to Ollama. Describe how to move the exported model to a Mac and register it with Ollama using a Modelfile.
- Q4_K_M quantization tradeoff. Explain why Q4_K_M is popular and how it relates to models downloaded from Ollama.
- Project difficulty progression. Explain how the suggested projects progress from familiar applications to projects requiring significant new learning.
- Fundamentals First Learning Approach. Explain why continued learning should focus on fundamentals rather than trying to master every topic or follow every new release immediately.
What it builds on
- Putting it all together (chapter 8) · The experience of putting together a Streamlit application.
- Installing wget (chapter 2) · Installing a package with Homebrew
- Your first Streamlit app (chapter 8) · Using Streamlit as an alternative app path
- Starting the Ollama service (chapter 3) · Running the local Ollama service
- Building a custom model step by step (chapter 13) · The earlier creation of a named model with a system prompt.
- Your first Ollama Python script (chapter 7) · Prior use of the Ollama Python library provides the point of comparison.
- System prompts explained (chapter 13) · The earlier introduction to system prompts.
- What “quantization” means (chapter 4) · The introductory idea of model quantization.
Section by section
Introduction
The chapter introduces advanced directions that build on the existing chatbot, including RAG, Open WebUI, agents, and fine-tuning.
16.1 RAG: Retrieval-augmented generation
This section introduces RAG as a way to address a chatbot’s inability to answer from information outside its training data.
- Chatbot knowledge limits and RAG: Explain that a chatbot relying on its training data cannot answer questions about personal documents, an internal knowledge base, or events after training, and that RAG addresses this limitation.
Why it matters: This explains why you might need RAG even when your chatbot is otherwise capable.
Key terms: training data, RAG, personal documents, internal knowledge base
16.1.1 What is RAG?
This subsection explains how RAG gives an AI relevant information from your documents before it answers a question.
- RAG document context flow: Explain that RAG retrieves relevant information from your documents before generation, supplies it alongside the user’s question, and lets the AI answer using both that information and its general knowledge.
Why it matters: It explains how an AI can answer using information from your own documents.
Key terms: RAG, retrieve, context
16.1.2 How vectors and embeddings work
Explains how a RAG application represents text as vectors and uses their similarity to find relevant documents without relying on exact word matches.
- Meaning as vector embeddings: Explain that an embedding model converts documents and questions into vectors—lists of numbers that represent meaning—so text with similar meanings has similar vectors.
Why it matters: This explains why a question and a document can be compared even when they use different words. - Closest vector document search: Trace how a RAG application converts a question into a vector and finds stored documents with the closest vectors, rather than requiring matching keywords.
Why it matters: It shows how RAG can retrieve a relevant document even when the question does not repeat its exact words.
Key terms: vector, embedding, embedding model, vector embeddings, similarity search
16.1.3 A simple RAG implementation
The section introduces a local ChromaDB example and explains how retrieving a relevant document helps ground an AI-generated answer.
- Grounded answers through retrieval: Explain that the AI finds a relevant document and uses it to answer from source material, reducing hallucinations.
Why it matters: Retrieval gives the model relevant source material to answer from rather than relying only on what it might generate. - ChromaDB vector database role: Describe ChromaDB’s role in the example as a local vector database that stores vectors and finds close matches.
Why it matters: ChromaDB supplies the local vector-search component used by this example.
Key terms: retrieval-and-generation, hallucinations, source material, ChromaDB, vector database, vectors, closest matches
16.1.4 Loading real documents for RAG
This section explains how to use document files in RAG and why longer documents should be split into retrievable chunks.
- Loading Documents From Files: Describe how to prepare short documents for the example script and why the location from which the script is run matters.
Why it matters: Putting the files where the script expects them lets the RAG example use real documents. - Chunking Long Documents: Explain what chunking does and why retrieval uses it for long documents.
Why it matters: Chunking lets RAG use relevant parts of a long file without sending the whole file to the model.
Key terms: my_documents, current working directory, .txt, .md, chunking, chunks, retrieval, context window
16.2 Using Open WebUI for a ChatGPT-like experience
Introduces Open WebUI as a ready-made interface for Ollama and explains when to choose it instead of a self-built Streamlit chatbot.
- Open WebUI and local processing: Explain what Open WebUI provides on top of Ollama and why a local Ollama backend alone does not guarantee that all processing stays local.
Why it matters: A local chat interface is not, by itself, a guarantee that every feature runs locally. - Ready-made versus self-built chat: Distinguish when to use Open WebUI from when to build the Streamlit chatbot yourself.
Why it matters: You can choose convenience without mistaking Open WebUI for a required step or a replacement for learning how your app works.
Key terms: Open WebUI, Ollama, local embedding, document-processing settings, Streamlit, state management
16.2.1 Using Open WebUI with Docker
This section explains how to run Open WebUI in Docker, connect it to local Ollama, and open it in a browser while making clear that Docker is optional.
- Docker containers and installation choice: Explain that Docker runs Open WebUI as a service in a packaged, isolated container rather than installing only a command-line package, and why a reader might choose to stay with Python and Streamlit instead.
Why it matters: You can decide whether Docker’s added setup is worthwhile without mistaking it for a book requirement. - Ollama connection and conversation storage: Explain what the two highlighted docker run flags do when starting Open WebUI.
Why it matters: These flags address two practical needs: reaching local models and keeping conversations. - Open WebUI startup and sign-in: Describe the startup sequence from running Docker Desktop to opening Open WebUI, including the first account and model detection.
Why it matters: This sequence helps you reach the local interface and recognize the most immediate startup problem.
Key terms: Docker, containers, Open WebUI, Python/Streamlit path, docker run, --add-host, -v, persistent storage, local Ollama server, Docker Desktop
16.2.2 Key features of Open WebUI
This section identifies Open WebUI’s main features for local AI chat and compares it with the Streamlit chatbot built earlier.
- Local model and chat features: Describe how Open WebUI supports working with Ollama models and conversations: switching models, finding saved chats, chatting with uploaded PDFs, and saving persona presets.
Why it matters: These are the main ways Open WebUI extends what you can do with local models and chats. - Sharing and interface conveniences: Describe the optional sharing and convenience features, and explain how the section positions Open WebUI relative to the Streamlit chatbot.
Why it matters: It helps you see how your learning project relates to a more polished chat application.
Key terms: Ollama models, conversation history, document upload, RAG, custom system prompts, user management, keyboard shortcuts, export conversations, Streamlit app
16.3 Custom model creation with Modelfiles
The section connects earlier Modelfile work to a study-assistant model and introduces the purpose of the TEMPLATE instruction.
- TEMPLATE instruction purpose: Explain that the TEMPLATE instruction controls how conversation messages are formatted for the underlying model.
Why it matters: This distinguishes TEMPLATE’s role from the system prompt used in the earlier named model.
Key terms: TEMPLATE instruction, conversation messages, underlying model
16.3.1 Creating a Modelfile
This subsection shows how a Modelfile becomes a custom Ollama model that can be listed and used in Ollama-connected apps.
- Custom model creation workflow: Describe how to save a customization description as a file named Modelfile, create a model from it, and find and use the resulting model.
Why it matters: The customization becomes a model you can use across the Ollama-connected tools you already have.
Key terms: Modelfile, custom model, Ollama
16.3.2 Advanced Modelfile options
This section introduces Modelfile conversation templates and emphasizes that Modelfiles make custom model configurations reproducible and shareable.
- Reproducible custom model configurations: Explain that sharing a Modelfile lets someone else re-create the same custom model configuration.
Why it matters: A Modelfile gives you a way to pass a custom model configuration to someone else. - TEMPLATE conversation format: Describe what the TEMPLATE instruction controls and identify the text inserted by the double-curly-brace expressions in this example.
Why it matters: TEMPLATE illustrates that Modelfiles can configure more than a system prompt.
Key terms: Modelfile, reproducible, shareable model configurations, TEMPLATE, conversation format, .System, .Prompt, .Response, .Messages
16.4 LangChain integration
Introduces LangChain as a way to assemble reusable components for more complex LLM applications, including those using Ollama.
- LangChain’s reusable building blocks: Explain why a developer might use LangChain when a chatbot needs retrieval, memory, tools, or a multistep workflow. Describe it as a framework that combines tested components and supports Ollama.
Why it matters: This gives you a reason to consider LangChain as your local AI applications become more complex.
Key terms: LangChain, building blocks, chains, Ollama
16.4.1 Installing LangChain
16.4.2 Basic LangChain with Ollama
This subsection places a basic LangChain connection to local Ollama in context: by itself it resembles direct use of the Ollama Python library, while its value comes from combining components.
- Value of combining components: Explain why connecting LangChain to Ollama is not, by itself, much different from using the Ollama Python library directly, and where the section says LangChain’s value lies.
Why it matters: This helps you distinguish a basic connection from the component combinations that make LangChain useful.
Key terms: LangChain, Ollama Python library, components
16.4.3 Creating a chain
Explains how a chain passes data through a prompt template, an LLM, and an output parser.
- Chain pipeline and data flow: Trace how a chain connects a prompt template, an LLM call, and output parsing using the | operator.
Why it matters: This lets you follow what each component contributes to a chained LLM workflow.
Key terms: chain, prompt template, LLM, output parser, | operator, pipeline
16.4.4 Why LangChain matters
This section explains why LangChain’s reusable components matter and briefly identifies what its main components do.
- Standard LLM building blocks: Explain why LangChain can simplify building LLM applications: it offers a standard set of well-tested building blocks instead of requiring custom code for every feature.
Why it matters: The component list makes more sense when you see it as a set of parts you can reuse. - Prompt chain and memory roles: Describe the roles assigned here to prompts, chains, and memory: reusable parameterized templates, sequences of operations, and automatic conversation-history management.
Why it matters: These distinctions help you recognize which building block addresses which part of an application. - Tool agent and retriever roles: Distinguish tools, agents, and retrievers by the roles given here: calling functions, deciding which tools to use for a task, and connecting to vector databases for RAG.
Why it matters: These names point to different ways an LLM application can reach beyond a prompt and response.
Key terms: LangChain, building blocks, Prompts, Chains, Memory, Tools, Agents, Retrievers, RAG
16.5 Agentic AI patterns
This section defines an AI agent as an LLM that can choose and use tools, inspect their results, and decide what to do next.
- Agent actions and tool use: Explain how an AI agent differs from an LLM that only generates text: it can choose an action, use a tool, read the result, and decide what to do next.
Why it matters: This distinction explains why an agent can do more than answer in text.
Key terms: AI agent, LLM, tool
16.5.1 A simple agent concept
This subsection distinguishes a simple tool-layer demonstration from a full agent setup in which an LLM chooses whether and how to use a tool before answering.
- Tool demonstration boundaries: Distinguish the Python example, which defines two tools and prints their names and descriptions, from a working agent connected to Ollama.
Why it matters: Seeing what the example leaves out prevents you from mistaking a tool list for a working agent. - LLM tool choice and answer: Trace the LLM’s role in the full agent setup described here: receiving the question and tool descriptions, deciding whether to use a tool and with what input, then answering after receiving its output.
Why it matters: This is the difference between merely having tools and having an LLM decide how to use them for a question.
Key terms: tool layer, Ollama model, reasoning-and-action loop, LLM, tools, tool’s output, final answer
16.5.2 The agent pattern: Evaluate and act
Explains how an agent chooses whether to use a tool and notes that agent performance depends on model capability.
- Agent tool selection: Explain that the LLM reads tool descriptions and judges whether a tool fits the task, rather than following rigid selection rules. If a suitable tool exists, it uses it; otherwise, it answers from its own knowledge.
Why it matters: This explains why an agent might use a calculator for one task but answer another task directly. - Model capability limits: Describe the section’s qualification that agents are still emerging and that more capable models tend to do better at agent tasks, while a small local model such as gemma3:4b has limited capabilities.
Why it matters: It sets realistic expectations when trying agent tasks with local models.
Key terms: LLM, tool descriptions, tool selection, agents, gemma3:4b, 7B or larger models
16.5.3 Real-world agent use cases
This section illustrates where agents are useful by listing tasks that involve choosing tools, acting on external information, and evaluating results.
- Practical agent use cases: Explain what makes the listed tasks suitable for agents, and describe how agents could help in at least two of them.
Why it matters: These examples help you recognize tasks where an agent does more than produce a single answer.
Key terms: agents, select tools, external information, evaluate the results
16.5.4 OpenClaw: The autonomous agent that drew major GitHub attention
This section introduces OpenClaw’s capabilities, architecture, local-model support, and security risks.
- OpenClaw capabilities and reach: Describe OpenClaw as an open source autonomous AI agent that connects to messaging platforms and can perform tasks such as browsing the web, summarizing PDFs, and handling calendars or email.
Why it matters: These capabilities explain why OpenClaw is more than a chatbot in one app. - OpenClaw architecture and extensibility: Explain the roles of OpenClaw’s gateway, protocol layer, and ClawHub skills, and state that it supports local models through Ollama.
Why it matters: This shows how the agent connects to apps, gains abilities, and fits into a local AI setup. - Local agent security risks: Justify why running the entire OpenClaw stack locally still requires care: a tool-using agent may access files, run commands, or change system state if configured carelessly.
Why it matters: Local operation does not make careless tool access safe.
Key terms: OpenClaw, autonomous AI agent, messaging platform, gateway-plus-protocol model, gateway, protocol layer, ClawHub, LLM backends, Ollama, local agent
16.5.5 PicoClaw: An agent that fits in your pocket
PicoClaw shows how a lightweight agent can run on inexpensive hardware while relying on a separate LLM for inference.
- Lightweight PicoClaw runtime: Describe why PicoClaw can run on inexpensive embedded devices: it is a single Go binary with no Docker, Node.js, or Python runtime dependency.
Why it matters: The small, standalone runtime makes an agent practical on hardware that could not host a large software stack. - Agent and model separation: Explain which work runs on PicoClaw's edge device and which work runs on an LLM backend, and distinguish the agent's memory needs from the model's.
Why it matters: Separating the agent from inference explains how a tiny device can provide an AI assistant without loading an LLM itself.
Key terms: PicoClaw, Go binary, agent runtime, embedded hardware, model inference, edge device, LLM API, Ollama server
16.5.6 The API cost revolution: Why open models matter for agents
This section explains why repeated agent calls make costs important and how to compare hosted API pricing with local inference.
- Agent cost amplification: Explain why API costs matter more for a continuously running autonomous agent than for a personal chatbot.
Why it matters: An agent's repeated work can turn a small per-call charge into a significant running cost. - Agent deployment cost comparison: Describe how to estimate a hosted agent's token charges and what else to consider when comparing hosted APIs with local inference.
Why it matters: A fair deployment choice requires measured usage and total costs, not just an advertised token price.
Key terms: autonomous agent, API call, privacy, control, cost, input tokens, output tokens, local inference, tool charges
16.6 Fine-tuning overview
Defines fine-tuning as further training a general pretrained model on your own data to give it specific knowledge or behaviors.
- Fine-tuning a pretrained model: Explain what fine-tuning changes about a pretrained model and what data is used.
Why it matters: This distinction helps you understand what fine-tuning adds to an existing model.
Key terms: fine-tuning, pretrained model, base model
16.6.1 When to fine-tune (and when not to)
This section frames fine-tuning as a powerful but usually unnecessary option and contrasts it with system prompts and RAG through an analogy.
- Choosing among customization approaches: Distinguish system prompts, RAG, and fine-tuning using the section’s analogy, and explain why fine-tuning is not the default choice for most use cases.
Why it matters: This distinction helps you avoid treating fine-tuning as the automatic next step for every application.
Key terms: system prompts, RAG, fine-tuning
16.6.2 The GGUF format for quantized models
This section explains why a fine-tuned model is commonly exported as a quantized GGUF file for Ollama and how quantization levels trade memory use for quality.
- GGUF packaging for Ollama: Explain why a fine-tuned model is commonly exported and quantized as a GGUF file before importing it into Ollama.
Why it matters: The model needs to be packaged in a format Ollama can run on consumer hardware. - Quantization memory and quality tradeoff: Explain how quantization reduces model memory use and why more aggressive compression can affect output quality. Distinguish file or weight size from the additional memory needed during inference.
Why it matters: A smaller model file may fit more easily on a Mac, but neither its quality nor its total running-memory requirement follows from file size alone. - Quantization tag interpretation: Describe what quantization tags such as q4_K_M and q5_0 indicate, and compare the listed levels in terms of size, quality, and RAM needs.
Why it matters: The tags help you recognize which model variant better fits your available RAM and quality needs.
Key terms: GGUF, fine-tuned model, Ollama, quantization, weights, inference, context, runtime overhead, quantization levels, q2_K
16.6.3 Fine-tuning workflow (high level)
Outlines the high-level path from training examples to a fine-tuned model running in Ollama.
- Fine-tuning workflow stages: Trace the high-level workflow: prepare examples, choose a base model, train it with a fine-tuning framework, export it to GGUF, create it in Ollama, and test and refine it.
Why it matters: This sequence connects fine-tuning to a model you can run and evaluate in Ollama. - Training examples and base model: Describe how the workflow starts: create training examples, usually as input/output pairs, and select a base model, noting why a smaller one may be preferable.
Why it matters: The examples define the behavior you want, while the base model affects how easy and fast training will be.
Key terms: fine-tuning framework, GGUF, ollama create, Modelfile, test and iterate, training examples, input/output pairs, base model
16.6.4 Unsloth: The fine-tuning accelerator
Explains how Unsloth fine-tunes and exports a model for local use in Ollama, along with practical limits and handoff steps.
- Unsloth benefits and limits: Explain that Unsloth can reduce fine-tuning time and GPU memory use, but results and hosted GPU availability vary, so compatibility must be checked.
Why it matters: These checks help you set realistic expectations before starting a training run. - Training to serving pipeline: Trace the workflow from preparing data and fine-tuning a base model with Unsloth through GGUF export to local serving with Ollama.
Why it matters: The division of work makes clear which tool trains the model and which runs it locally. - GGUF handoff to Ollama: Describe how to move the exported model to a Mac and register it with Ollama using a Modelfile.
Why it matters: A correct file handoff lets Ollama register the model you actually fine-tuned.
Key terms: Unsloth, GPU memory, GGUF export, hosted GPU, base model, GGUF, Ollama, Jupyter, Google Colab, Modelfile
16.6.5 GGUF quantization deep dive
This subsection identifies Q4_K_M as a common quantization choice for Ollama models because it balances quality with resource usage.
- Q4_K_M quantization tradeoff: Explain why Q4_K_M is popular and how it relates to models downloaded from Ollama.
Why it matters: This helps explain why Q4_K_M appears so often in local model downloads.
Key terms: Q4_K_M, quantization level, Ollama
16.7 Project ideas and learning resources
16.7.1 Ten project ideas
This section offers ten local-AI project ideas, grouped by difficulty, that extend familiar tools with new concepts.
- Project difficulty progression: Explain how the suggested projects progress from familiar applications to projects requiring significant new learning.
Why it matters: The difficulty groupings help you choose a project that fits how much new material you want to tackle. - Beginner and intermediate project combinations: Describe examples of beginner and intermediate projects and the tools or concepts each combines.
Why it matters: These examples show how a concrete application can grow from tools and concepts introduced earlier in the book. - Advanced project extensions: Describe how the advanced project ideas extend a chatbot or local-AI setup into a more capable application.
Why it matters: The advanced examples identify concrete directions for extending an existing local-AI application.
Key terms: beginner projects, intermediate projects, advanced projects, system prompts, conversation history, RAG, ChromaDB, chained prompts, temperature settings, LangChain agents
16.7.2 Learning resources
The section points readers to resources for continued local AI learning and advises them to build on fundamentals rather than chase every new release.
- Fundamentals First Learning Approach: Explain why continued learning should focus on fundamentals rather than trying to master every topic or follow every new release immediately.
Why it matters: You can explore the changing local AI landscape at your own pace without starting from zero. - Continuing Learning Resource Types: Describe the kinds of resources the section recommends for continued learning and for keeping up with local AI.
Why it matters: Different resources can help you learn a topic or check what has changed when you need to.
Key terms: AI landscape, fundamentals, documentation, communities, books and courses, GitHub releases
16.8 Exercises
16.9 Summary
Where this is used later
- Beyond individual models: The rise of orchestration (chapter 17) · the idea of agents that evaluate and act
- Agent cost analysis (chapter 17) · Supports the later analysis of agent costs.
- The complete custom model workflow (chapter 17) · The custom-model workflow builds on packaging a model for Ollama.
- The Unsloth-to-Ollama pipeline (chapter 17) · The earlier high-level fine-tuning workflow provides context for specializing a base model.
Concepts explained in this chapter
- ModelfileA Modelfile is Ollama's declarative file format for specifying the base model, prompts, parameters, and other settings of a custom model.
- GGUFA file format for storing machine-learning model tensors and metadata for inference, including quantized models.
- retrieval-augmented generationRetrieval-augmented generation is a technique that retrieves relevant information from an external knowledge source and supplies it to a language model alongside a question or instruction.
- fine-tuningFine-tuning is the process of further training a pretrained model on selected examples to adapt its behavior or capabilities.
- Open WebUIOpen WebUI is an open-source web interface for interacting with locally hosted language models and related services.
- UnslothA software library that accelerates and streamlines fine-tuning of language models while aiming to reduce memory use.
- AI agentAn AI agent is a software system that perceives information, reasons about tasks, and takes actions to accomplish goals, including software-development tasks.
- LangChainLangChain is a software framework for building applications with language models by connecting them to data sources and composable components.
- pipelineA sequence of processing stages in which each stage feeds its output to the next.
- costThe monetary expense of operating an AI system, including service charges and local operating expenses.
- embeddingAn embedding is a numerical vector representation of an item, such as text, positioned to capture aspects of its meaning or features.
- Chroma DBChromaDB is an open-source vector database for storing, querying, and managing embeddings and associated data.
- vector databaseA vector database stores vector representations and supports searching for vectors that are similar or close to a query vector.
- inferenceModel inference is the process of applying a trained model to input data to produce an output.
- system promptA system message supplies instructions that guide an AI model's behavior in a conversation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
