Category: AI Architecture

  • RAG in Production: What the Demos Don’t Tell You

    The demo is always magical. You point a retrieval-augmented generation system at a pile of documents, ask a hard question, and get a fluent, sourced, correct answer. The room nods. Someone says “we should ship this.” And then production happens — and production has questions the demo never asked.

    I have built RAG systems that run in production, including one layered over a manufacturing data pipeline processing billions of IoT rows — where the system doesn’t just retrieve documents, it diagnoses faulty equipment and suggests fixes. The gap between that and a demo is everything I am about to describe.

    Chunking Is Where Demos Go to Die

    Every RAG demo works because someone carefully prepared the documents. In production, nobody prepares the documents. They arrive as PDFs with broken formatting, Confluence pages with five years of edits, ticket histories, manuals scanned sideways. Your chunking strategy meets this reality on day one.

    Chunking — how you split documents into retrievable pieces — is the highest-leverage decision in the system, and it’s the one most teams spend the least time on. Chunk too large and the retriever returns bloated, imprecise context; the model drowns in irrelevant text and the answer quality drops. Chunk too small and you shred meaning across fragments; the retriever finds pieces but the model can’t assemble the full picture. Overlap between chunks helps, but it’s a bandage, not a strategy.

    What actually works: chunking driven by document structure, not fixed sizes. Respect natural boundaries — sections, procedures, Q&A pairs. Different document types get different strategies; the approach that works for product manuals will mangle ticket histories. And critically: evaluate chunking choices against real questions, not vibes. Build a small set of representative questions with known-good answers, and measure retrieval quality as you tune. The teams that treat chunking as an empirical problem ship better systems than the teams that treat it as a configuration choice.

    One more thing demos hide: metadata. In production, retrieval quality often depends less on the embedding model and more on the metadata attached to each chunk — document type, date, product version, access level. A system that can filter “only show me troubleshooting guides for firmware 4.x” will outperform a system with a fancier model and no metadata, every time.

    Your Data Is Stale Before You Ship

    The demo uses a static document set. Production data moves. New documents arrive, old ones get updated, some get deleted — and every change creates a window where your system confidently answers from outdated information.

    This is a pipeline problem, not a model problem. You need ingestion that keeps up: change detection on source systems, incremental re-indexing (not nightly full rebuilds once the corpus is large), and deletion handling — because a document that was removed for being wrong must actually stop being retrieved. I have seen production systems answer questions from documents that were deleted months earlier, because nobody built the deletion path.

    Freshness requirements vary by use case, and you should define them explicitly. A system answering questions about product documentation might tolerate daily updates. A system layered over operational data — like the manufacturing pipeline I built, where equipment telemetry streams continuously — needs freshness measured in minutes, not days. Define the freshness SLA for your use case, then design the pipeline to meet it, and monitor it like any other SLA. Stale answers delivered confidently are worse than no answers at all.

    Versioning matters too. When a document updates, do you replace the chunks or version them? For regulated or safety-critical answers, you may need to show which version of a document an answer came from. Build this in early; retrofitting provenance onto a running system is painful.

    Latency and Cost at Real Query Volume

    The demo answers one question at a time, with nobody watching the clock or the meter. Production answers thousands, concurrently, with users who leave if it takes too long and finance teams who notice the bill.

    Latency in RAG is a chain: embedding the query, retrieving candidates, re-ranking, assembling context, generating the answer. Each step adds milliseconds, and the generation step dominates. Practical levers: retrieve fewer, better chunks (quality retrieval beats quantity); cache aggressively — common questions, common documents, even embedding computations; consider smaller, faster models for the generation step when the retrieved context is strong (a good retriever with a small model often beats a mediocre retriever with a large one); and stream responses so users see progress instead of staring at a spinner.

    Cost follows the same chain. Embedding is cheap per document but not free at scale — re-embedding an entire corpus because you changed chunking strategy is a real line item. Generation is the expensive step, priced per token, and long retrieved contexts make every query costly. The discipline is the same as any production system: measure cost per query, set budgets, and treat context-window bloat the way you’d treat any other resource leak.

    The architecture insight: design for the query volume you’ll have in a year, not the demo volume you have today. The retrieval infrastructure that handles a hundred queries a day gracefully may fall over at ten thousand. Load-test the full chain early — it’s much cheaper than re-architecting under pressure.

    Guardrails Aren’t Optional

    A demo that hallucinates is embarrassing. A production system that hallucinates is a liability. Guardrails are the difference, and they need to be engineered, not hoped for.

    Grounding and citations. The system should show its work — every substantive claim traceable to retrieved sources. This isn’t just good UX; it’s how users learn to trust the system, and how you debug it when answers go wrong. If an answer can’t cite its sources, that should be visible, not hidden.

    PII and sensitive data. Your corpus contains things the model should not repeat — personal data, credentials in old tickets, confidential business information. Redaction at ingestion, access-aware retrieval (users only retrieve documents they’re permitted to see), and output filtering are all necessary. Access control deserves emphasis: a RAG system that retrieves across permission boundaries is a data leak with a chat interface. Filter by the user’s permissions at retrieval time, not after generation.

    Evaluation as a guardrail. Build an evaluation harness and run it continuously — not just during development. A small set of golden questions with expected answers, run against every change to prompts, models, chunking, or data:

    for question, expected_sources in eval_set:
        answer, sources = rag_pipeline.ask(question)
        score_retrieval(sources, expected_sources)  # right documents?
        score_faithfulness(answer, sources)          # grounded in them?
        flag_pii(answer)                            # nothing leaked?

    When eval scores drop, you know before users tell you. The teams that run evals in CI ship with confidence; the teams that don’t ship with hope.

    Human escalation paths. Some questions shouldn’t be answered by the system — low-confidence retrievals, safety-critical topics, anything where a wrong answer is expensive. Design the handoff: when confidence is low, say so and route to a human. “I don’t know” is a feature, not a failure.

    Treat retrieved content as untrusted input. This one surprises teams: your documents can attack your system. A document containing instructions (“ignore previous instructions and…”) gets retrieved, placed in context, and the model may follow it — this is indirect prompt injection, and it works against production systems today. Defenses include separating retrieved content from instructions structurally, scanning retrieved chunks for instruction-like language, and never letting retrieved text drive privileged actions (sending email, changing data, executing commands) without human confirmation. If your RAG system can do things rather than just answer, this moves from important to critical.

    When RAG Is the Wrong Answer

    After all this, an honest admission: RAG is not always the right architecture, and knowing when to say so is part of doing this work well.

    RAG excels when the knowledge is large, changes over time, and needs to be cited — documentation, policies, operational knowledge. It struggles when the task requires reasoning over structured relationships rather than retrieving passages. “Which components fail together, and why?” is a question about relationships — and that’s where knowledge graphs earn their place.

    In the manufacturing system I mentioned, RAG alone wasn’t the answer. The pipeline detects faulty IoT devices and components from billions of telemetry rows — but diagnosis benefits enormously from a knowledge graph of the equipment: which components connect to which, which failures cascade, what the maintenance history shows. The graph captures structure; RAG captures narrative. Together, they answer questions neither handles alone: the graph finds what’s related, RAG explains what it means. If your problem has rich entity relationships — equipment, suppliers, systems, dependencies — consider the graph as a complement, not a competitor, to retrieval.

    And sometimes the answer is fine-tuning, or a smaller specialized model, or — heresy — a well-built search interface without a language model at all. The right architecture follows the problem. Anyone selling RAG as the universal answer is selling, not engineering.

    The Bottom Line

    Production RAG is a systems problem wearing a model’s clothes. The demo shows you the model; production tests your chunking, your data pipelines, your latency budget, your guardrails, your evals, and your judgment about when RAG is even the right tool. Get those right and you have something genuinely valuable. Skip them and you have a demo that bills by the token.

    If you’re building RAG for real users — or staring at a pilot that isn’t surviving contact with production — reach out through the contact page. I’ve built these systems where they have to work, and I’m glad to help you think through yours.

    Related: the Generative AI Foundations learning path, and case studies including an IoT + RAG manufacturing system.

  • Beyond the AI Hype: The 3 Breakthroughs Needed to Reach Next-Gen Intelligence

    Every week, the tech world gets flooded with headlines about new model releases, benchmark scores, and trillion-parameter claims. But if you look past the marketing noise, a deeper question emerges: What is actually holding AI back from making its next giant leap?

    If we want AI systems that don’t just chat, but actively solve massive real-world problems—like discovering new materials, writing complex software from scratch, or solving open scientific challenges—scaling up today’s technology isn’t enough.

    Here are the three big engineering shifts that will define the next decade of artificial intelligence.

    1. Smarter Computing: Doing More with Less Energy

    Building massive AI models is becoming insanely expensive. Training a single frontier model can take tens of millions of dollars and enough electricity to power a small city.

    To solve this, researchers are turning to an architecture called Mixture-of-Experts (MoE).

    Think of a traditional AI model like a single, massive dictionary where every single page gets flipped every time you ask a question. An MoE model works more like a hospital: instead of forcing every doctor to examine every patient, a central “router” directs your question straight to the exact specialist needed.

    Why this matters: By only activating a small “specialist” fraction of the brain per request, we get ultra-smart responses at a fraction of the energy cost. The future isn’t just about bigger models—it’s about radically more efficient routing.

    2. Dynamic Memory: Fixing AI’s Short-Term Attention Span

    Have you ever noticed that an AI chat gets confused or forgets instructions during long conversations? That happens because today’s models process information using a method that gets exponentially slower and more memory-heavy the more text you give it.

    Right now, an AI has to re-read its entire conversation history every single time it generates a new word.

    To fix this, engineers are building new hybrid memory systems. Instead of re-reading everything from scratch, future models will continuously condense key facts into an active “working memory”—much like how human brains store useful context while letting background noise fade away.

    Why this matters: This will allow AI agents to work alongside us for days or weeks on complex projects without slowing down, hallucinating, or forgetting past decisions.

    3. Self-Verification: Teaching AI to Double-Check Its Own Work

    Today’s AI operates on instant prediction: it guesses the very next word based on probability. But real human thinking doesn’t work that way. When a doctor diagnoses an illness or a engineer designs a bridge, they don’t just speak the first thought that pops into their head—they test their ideas, look for flaws, and correct their mistakes before making a decision.

    The next big shift is internal self-verification.

    Instead of spitting out an instant answer, future AI models will:

    1. Brainstorm multiple possible paths to a solution.
    2. Check each step against a logic compiler or code tester.
    3. Automatically backtrack and try a different route if it detects an error.

    Jargon Buster: Frequently Asked Questions

    If you’re new to the deeper technical side of AI, here is a quick breakdown of terms you’ll hear often:

    What is a “Parameter”?

    Think of parameters as the “knobs” or “connections” inside an AI’s brain. The more parameters a model has, the more capacity it has to learn complex patterns. A 1-trillion parameter model has 1 trillion internal connections tuned during training.

    What is a “Mixture-of-Experts” (MoE)?

    An AI design technique where a giant model is broken into multiple smaller sub-networks (“experts”). A smart router sends your query only to the relevant experts, saving huge amounts of computing power.

    What is a “Hallucination”?

    When an AI model confidently presents false, fabricated, or illogical information as absolute fact. This happens because the model is predicting words based on language patterns rather than verifying actual ground truth.

    What is “Self-Verification”?

    A setup where an AI model uses external tools (like code interpreters, math checkers, or internal scoring models) to double-check its own logic step-by-step before showing you the final output.

  • AI Governance Board is must now for each organization

    Designing a robust AI governance structure requires a seamless flow from a localized “idea” to centralized “oversight.” In 2026, this isn’t just a bureaucracy—it’s a production line for safe, scalable innovation.

    Here is the step-by-step architecture for your organization’s AI Governance journey.


    Step 1: The AI Intake Form (The Gateway)

    The journey begins with a standardized AI Intake Form. Any employee or department looking to use a third-party AI tool or build a custom model must submit this.

    • Key Fields: Business objective, data types involved (PII, proprietary, or public), expected ROI, and the “Human-in-the-loop” plan.
    • The Goal: To prevent “Shadow AI” and ensure every model is registered in the company’s central AI Inventory.

    Step 2: The BU AI Ambassador (Domain Expertise)

    Each Business Unit (BU)—such as HR, Finance, or Engineering—appoints an AI Ambassador.

    • The Role: They act as the first filter. They possess deep domain knowledge that a central IT team might lack.
    • The Value: They ensure the AI solution actually solves a business problem and isn’t just “tech for tech’s sake.” They help the project owner refine the Intake Form before it moves to the stakeholders.

    Step 3: Initial Review Meeting (AI Stakeholders)

    Once the Ambassador clears the idea, an Initial Review Meeting is held with key AI Stakeholders.

    • The Approval: If the stakeholders agree the project is viable and aligns with the corporate strategy, it receives “Provisional Approval.”
    • Risk Triage: At this stage, the project is categorized by risk level (Low, Medium, High).

    Step 4: The AI Governance Team (The “Gauntlet”)

    After stakeholder approval, the project moves to the core AI Governance Team. This is a cross-functional squad that evaluates the project through four specific lenses:

    PillarFocus Area
    Security TeamVulnerability testing, prompt injection risks, and API security.
    Data PrivacyGDPR/CCPA compliance, data residency, and anonymization protocols.
    Legal TeamIP ownership, liability for AI-generated outputs, and contract review.
    ProcurementVendor stability, licensing costs, and “Exit Strategy” (what if the vendor goes bust?).

    Step 5: AI Executive Team (High-Priority/High-Risk)

    Not every app needs a C-suite review. However, for High-Priority or High-Risk apps (e.g., AI that makes hiring decisions, handles medical data, or moves large sums of money), the project is escalated to the AI Executive Team.

    • Members: CTO, Chief Legal Officer, and relevant BU VPs.
    • Function: They provide final strategic sign-off and ensure the project doesn’t pose an “existential risk” to the company’s reputation.

    Step 6: Operationalization (LLM Ops & MLOps)

    Once approved, the project moves into the technical environment. Governance is now baked into the code through MLOps (for traditional models) and LLM Ops (for Generative AI).

    • Version Control: Tracking which model version is live.
    • Guardrail Integration: Hard-coding filters to prevent toxic outputs or data leakage.
    • Cost Management: Monitoring token usage and compute spend to prevent “bill shock.”

    Step 7: Continuous Monitoring & Feedback Loop

    AI is not “set it and forget it.” In 2026, models “drift” as the world changes.

    • Performance Tracking: Automated alerts if the model’s accuracy drops below a certain threshold.
    • Bias Audits: Scheduled reviews to ensure the AI hasn’t developed discriminatory patterns over time.
    • Sunset Protocol: A clear plan for when a model should be retired or retrained.

  • Build vs Buy in the Age of Vibe Coding

    Why Teams Still Choose SaaS Platforms Like Salesforce or HubSpot

    With modern frameworks, cloud infrastructure, and AI-assisted “vibe coding,” building software has never felt easier. A small team can spin up a CRM, dashboard, or workflow tool in weeks—not years.

    So the natural question arises:

    Why do companies still pay for SaaS platforms like Salesforce or HubSpot instead of building their own?

    The answer is not ideological.
    It is economic, operational, and long-term.

    This article breaks down the real trade-offs—without hype.


    What “Vibe Coding” Has Changed—and What It Hasn’t

    Vibe coding (rapid development powered by frameworks, cloud services, and AI assistants) has dramatically reduced:

    • Initial development time
    • Boilerplate effort
    • Infrastructure setup friction

    But it has not eliminated:

    • Long-term maintenance costs
    • Security, compliance, and reliability burden
    • Organizational complexity at scale

    This is where the build-vs-buy decision becomes nuanced.


    Why SaaS Platforms Exist in the First Place

    Platforms like Salesforce and HubSpot are not just applications. They are operating systems for business functions.

    They bundle:

    • Product features
    • Infrastructure
    • Security
    • Compliance
    • Ecosystem
    • Continuous evolution

    What you are buying is time, risk reduction, and organizational leverage.


    The Case for Building Your Own Platform

    Let’s be honest—sometimes building does make sense.

    Pros of Building In-House

    1. Perfect Fit for Your Workflow
    You design exactly what your team needs—no more, no less.

    2. Full Control Over Data and Logic
    No vendor constraints. No forced upgrades. No black boxes.

    3. Lower Cost for Very Small User Bases
    For 5–20 users, SaaS per-seat pricing can feel expensive compared to a simple internal tool.

    4. Strategic Differentiation
    If the platform is your product or core IP, owning it matters.


    Cons of Building In-House

    1. Hidden Long-Term Cost
    Initial development is cheap.
    Maintenance is not.

    You own:

    • Bug fixes
    • Security patches
    • Performance tuning
    • Feature creep
    • Documentation
    • Onboarding

    2. Talent Dependency Risk
    If key engineers leave, system knowledge leaves with them.

    3. Slower Evolution Over Time
    SaaS platforms improve continuously.
    Internal tools often stagnate once “good enough.”

    4. Opportunity Cost
    Every hour spent maintaining internal tools is an hour not spent on core business value.


    The Case for SaaS Platforms

    Pros of Using SaaS

    1. Speed to Value
    You can go live in days, not months.

    2. Battle-Tested at Scale
    Salesforce and HubSpot handle:

    • Millions of users
    • High availability
    • Global compliance
    • Edge cases you haven’t imagined yet

    3. Ecosystem and Integrations
    App marketplaces, APIs, partners, and community knowledge matter more as you grow.

    4. Predictable Scaling
    Cost increases are linear with users—not exponential with complexity.


    Cons of Using SaaS

    1. Cost at Large Scale
    For hundreds or thousands of users, licensing costs add up.

    2. Customization Limits
    You adapt your process to the tool—not always the other way around.

    3. Vendor Lock-In
    Migration is rarely trivial.

    4. Feature Bloat
    You pay for capabilities you may never use.


    Small User Base vs Large User Base: The Inflection Point

    Small Teams (1–25 Users)

    • Building can be reasonable
    • SaaS feels expensive per seat
    • Flexibility matters more than robustness

    Risk: You underestimate future complexity.


    Mid-Size Teams (25–200 Users)

    This is the danger zone.

    • Internal tools start to crack
    • Data consistency becomes painful
    • Permissions, audits, workflows matter

    This is where SaaS often wins decisively.


    Large Organizations (200+ Users)

    • SaaS platforms shine operationally
    • Governance, compliance, and integrations dominate
    • Custom development moves to extensions, not core systems

    At this scale, not using SaaS is often more expensive than licensing it.


    Long-Term Reality: Software Is a Living System

    The biggest misconception in build-vs-buy decisions:

    “Once we build it, we’re done.”

    In reality:

    • Requirements change
    • Regulations evolve
    • Users grow
    • Integrations multiply
    • Security expectations rise

    SaaS vendors amortize this complexity across thousands of customers.
    You cannot—at least not cheaply.


    A Pragmatic Hybrid Model (Often the Best Answer)

    Many successful teams do this instead:

    • Buy the core platform (CRM, marketing, support)
    • Build lightweight extensions for unique workflows
    • Integrate via APIs, not forks
    • Avoid rebuilding commodity features

    This preserves:

    • Speed
    • Reliability
    • Differentiation where it actually matters

    Final Thought: Vibe Coding Is a Tool, Not a Strategy

    Vibe coding makes building possible.
    It does not automatically make building wise.

    Choosing SaaS platforms like Salesforce or HubSpot is not about lack of skill—it is about focus.

    Build where you differentiate.
    Buy where you operate.

    The most effective teams are not those who build everything—but those who choose carefully what is worth owning