Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Rush Shahani

Tested strategies to reduce hallucinations, improve performance and cost efficiency, and reduce bias or unethical behavior in your LLMs outputs. Building Reliable AI Systems shows you exactly how to guide large language models from research prototypes to scalable, robust, and efficient production systems. From model training to maintenance, an engineer will find everything they need to work with LLMs in this one-stop guide. This book complements Sebastian Raschka’s Build a Large Language Model (From Scratch), which takes a hands-on, ground-up approach to constructing LLMs. While Raschka’s book focuses on building models from scratch, Building Reliable AI Systems centers on deploying, optimizing, and maintaining reliable, production-grade AI systems. Inside Building Reliable AI Systems you’ll learn how to: Deploy LLMs into production Detect and reduce hallucinations Mitigate bias Optimize LLM performance and resource usage Advanced prompt engineering techniques Build intelligent agents and Retrieval-Augmented Generation Building Reliable AI Systems is a guide to putting LLMs into production in the real world. The book bridges the gap between theory and practice. You’ll go beyond basics like prompting into advanced optimizations: intelligent agents, Retrieval Augmented Generation (RAG), and in-depth solutions for mitigating hallucinations and bias. about the reader For data scientists or software engineers confident in Python and NLP. about the author Rush Shahani is a seasoned AI Engineer and CTO of Persana AI, a YCombinator-backed startup. At Persana, he leads the development of natural language processing and large language model systems that provide actionable insights to companies in order to drive revenue growth. His experience includes building AI systems at companies like LinkedIn, Element AI, and Shopify.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A production-focused field guide for engineers who already know Python and NLP but need to make LLM systems trustworthy at scale—covering model selection, prompt engineering, RAG, agents, and the operational discipline of evaluation and monitoring. Read it if you're shipping AI features and care more about reliability, cost, and bias than about training models from scratch. 【Book Arc】 - **Opening (~0%–10%)**: Frames the core problem—moving LLMs from research prototypes to production—and introduces a three-layer reliability model spanning the model, the agent/tooling layer, and reliable operations (evaluation, deployment, monitoring). - **Early (~10%–30%)**: Fundamentals of controlling model behavior: choosing between reasoning and non-reasoning models, navigating the cost-capability spectrum, taming intrinsic randomness via temperature, top-p, seed fixing, and ensemble/majority voting, plus prompt engineering components and self-consistency checks. - **Early–Middle (~30%–45%)**: Retrieval-Augmented Generation in depth—architecture, prompt templates that ground responses in retrieved passages, RAG-specific failure modes, and evaluation with evaluator LLMs and frameworks like RAGAS. - **Middle (~45%–60%)**: Embeddings and vector search—why embedding quality determines retrieval success, choosing commercial vs. open-source vs. domain-specific models, hybrid and multi-stage retrieval (dense + sparse + reranking), and a hands-on hybrid retriever build. - **Late (~60%–85%)**: Agents and tooling—giving agents access to APIs, databases, and services via standards like MCP, multi-agent coordination patterns (e.g., supervisor architectures), and preventing cascading failures. (Excerpts do not cover the exact chapter boundaries here.) - **Ending (~85%–100%)**: Reliable operations—evaluation approaches (ROUGE/BLEU, LLM-as-judge, red teaming, human protocols), observability platforms like Arize and Phoenix, and keeping systems reliable as models update and data drifts. (Excerpts do not cover the final chapters in detail.) 【Key Takeaways】 - **Reliability is a layered engineering problem, not a single fix** (Opening): the book structures everything around model-level, agent-level, and operational reliability, so you stop treating hallucination as one bug to patch. - **Model selection is the highest-leverage decision** (Early): reasoning vs. non-reasoning models differ in cost, latency, and which sampling parameters they even support—start non-reasoning, escalate only when prompting fails. - **Intrinsic randomness can be mitigated but not eliminated** (Early): seed fixing and ensemble/majority voting stabilize outputs, while temperature and top-p tuning trade determinism against diversity. - **Prompt structure is a reliability tool** (Early): well-designed prompt components and self-consistency sampling (cross-checking multiple outputs) catch hallucinations before users do. - **RAG is powerful but not a silver bullet** (Early–Middle): it adds retrieval latency, embedding costs, and its own failure modes—small stable knowledge bases may be better served by in-prompt context. - **Retrieval quality gates generation quality** (Middle): embedding model choice and hybrid/multi-stage retrieval (dense + sparse + reranking) determine whether the right documents ever reach the model. - **Context placement matters** (Middle): the "Lost in the Middle" effect means stuffing long documents can hurt—metadata filtering and re-ranking keep key facts where the model attends. - **Agents need standardized, auditable tooling** (Late): MCP-style integration, supervisor architectures, and cascading-failure prevention make multi-agent systems diagnosable rather than opaque. - **Evaluation is plural and continuous** (Ending): reference metrics, LLM-as-judge, red teaming, and human review catch different failure modes—production systems combine several and monitor drift over time. 【Reading Tips】 - **Deep-read the early chapters on model selection and sampling parameters**—these decisions cascade through everything else and are cheap to get right early. - **Skim code-heavy walkthroughs (RAG project, hybrid retriever) on first pass**, then return to them when building your own pipeline; the prose around the code carries the design rationale. - **Treat the evaluation chapter as a checklist**, not theory—pick 2–3 complementary methods (e.g., LLM-as-judge + red teaming) and wire them in before launch. - **Watch for the tradeoff framing throughout**: RAG vs. in-prompt context, reasoning vs. non-reasoning models, determinism vs. diversity. The book consistently presents costs, not just capabilities. - **Pair with a from-scratch LLM book** if you also need to understand model internals; this one assumes the model exists and focuses on deploying it well. 【Coverage Limits】 This guide is synthesized from stratified excerpts covering roughly the first half of the book in detail (model selection, prompting, RAG, embeddings) with lighter coverage of agents and operations; specific chapter titles, later-chapter content, and exact percentages for the final sections are not fully represented in the excerpts.
Excerpt 1
able insights to companies in order to drive revenue growth. His experience includes building AI systems at companies like LinkedIn, Element AI, and Shopify....
View in text
Excerpt 2
ndation = Counter(recommendations).most_common(1)[0][0] #B #A Collect multiple recommendations from the AI model #B Perform ensemble averaging or majority vo...
View in text
Excerpt 3
s dive deeper into its architecture, outlined in figure 3.3. The RAG system is composed of several key components that work together to retrieve relevant inf...
View in text
Excerpt 4
enizer = AutoTokenizer.from_pretrained("bert-base-uncased") model = AutoModelForQuestionAnswering.from_pretrained("bert-base-uncased") bert-base-uncased is c...
View in text
Excerpt 5
'): #D if metadata.get('status') != auto_filters['status']: continue # Adjust scores based on metadata if metadata.get('status') == 'archived': #E score *= 0...
View in text
Excerpt 6
g code, you can compute accuracy or loss (a numerical score measuring how wrong the model's predictions are (lower is better) on the validation set each epoc...
View in text
Excerpt 7
rated and stored. As the conversation continues, the system performs dynamic updates, integrating new information into the existing summary. Less relevant de...
View in text
Excerpt 8
etup #A # Webhook verification #A # Error handling #A # Retry logic #A # Version management #A # ... 500 lines later ... #A @mcp.tool() #B async def process_...
View in text
Tags
AI categories
Artificial IntelligenceLLMBackend
Publish Year: 2026
Language: English
Pages: 434
File Format: PDF
File Size: 14.1 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…