Mahamudul Hasan Rubel
HomeAboutProjectsSkillsExperienceBlogPhotosContact
Mahamudul Hasan Rubel

Senior Software Engineer crafting high-performance web applications and SaaS platforms.

Navigation

  • Home
  • About
  • Projects
  • Skills
  • Experience
  • Blog
  • Photos
  • Contact

Get in Touch

Available for senior/lead roles and consulting.

bd.mhrubel@gmail.comHire Me

© 2026 Mahamudul Hasan Rubel. All rights reserved.

Built with using Next.js 16 & Tailwind v4

Back to Blog
AI/MLJune 23, 20264 min read

LLM evaluation strategies: Building multi-model verification systems

LLM evaluation for production requires more than just prompts. Learn how to use multi-model verification and consensus to catch hallucinations in critical apps.

LLMAI EngineeringRAGEvaluationProductionMachine LearningAIPrompt Engineering

Last month, I was debugging a RAG pipeline that kept "confidently" hallucinating document IDs that didn't exist in our vector store. We had great retrieval, but the generation layer was simply too creative for the business constraints we were operating under. It was a classic "black box" failure where the LLM’s internal weights favored fluency over factual accuracy.

If you’re building AI features for high-stakes workflows, you can’t rely on a single model call. You need a verification layer. Here is how I’ve started implementing probabilistic consensus and cross-model checks to make our outputs actually trustworthy.

Why single-model calls fail in production

We first tried to solve this with better system prompts and few-shot examples. While it helped, it didn’t eliminate the edge cases where the model would get stuck in a recursive hallucination loop. The problem isn't just the model—it's the nature of probabilistic generation.

When I talk about LLM evaluation in a production context, I’m not talking about static benchmarks like MMLU. I’m talking about real-time, per-request validation. If your application handles data that requires 99.9% accuracy, you need to treat every LLM response as a draft that requires secondary review.

Implementing multi-model verification

The most effective pattern I've found involves a "Judge" or "Verifier" model. Instead of asking one model to generate an answer and hoping for the best, you use a three-step pipeline:

  1. Generation: The primary model (e.g., GPT-4o) generates the answer.
  2. Extraction: A secondary, smaller model (like GPT-4o-mini or Claude 3 Haiku) extracts key assertions from that answer.
  3. Verification: A third call or a deterministic check compares those assertions against your retrieved context.

If you’re already using LLM Agents: Implementing Reflection Patterns for Better Reasoning, you know that self-correction is powerful. But adding a cross-model check adds an objective layer of skepticism that self-reflection often lacks.

The consensus approach

When I need higher confidence, I use a consensus strategy. I prompt three different models (or the same model with different temperatures) to solve the same task. If all three agree on the core facts, the confidence score is high. If they diverge, I trigger a fallback—either a human-in-the-loop escalation or a "I'm not sure" response to the user.

PYTHON
# A simplified example of cross-model consensus
def get_consensus_response(prompt, models=["gpt-4o", "claude-3-5-sonnet"]):
    responses = [call_model(m, prompt) for m in models]
    
    # Simple heuristic: do the answers contain the same key entities?
    # If not, route to a secondary verification step
    if not verify_agreement(responses):
        return trigger_manual_review(responses)
    
    return responses[0]

This approach is expensive, but it’s cheaper than a support ticket caused by a hallucinated legal document. You can optimize this by using LLM Routing: A Strategy for Multi-Model Architectures to only trigger the consensus check for high-stakes queries.

Improving RAG reliability

For RAG-heavy apps, multi-model verification is specifically useful for grounding. I prefer to separate the "retrieval" from the "reasoning." Once the retriever fetches context, I use a verification step to ensure the generated answer cites the provided documents correctly.

I’ve found that using structured output (JSON mode) for the verification step is non-negotiable. If you ask a model to "check for hallucinations," it will often give you a conversational summary. Instead, ask it to output a JSON schema:

JSON
{
  "is_grounded": boolean,
  "missing_citations": [string],
  "hallucinated_facts": [string]
}

This makes it trivial to programmatically decide whether to show the answer to the user or retry the generation. If you’re struggling with citation accuracy, Implementing LLM Grounding: Verifiable Citations in RAG Pipelines is a great deep dive into keeping the model honest.

The trade-offs: latency and cost

Let’s be honest: adding these layers adds latency. In my current project, a standard RAG response takes about 800ms. With a verification layer, it jumps to roughly 2.2 seconds. That’s a significant hit to the user experience.

I mitigate this by:

  • Async processing: Run the verification in the background if the UI allows for a "loading" state.
  • Conditional verification: Only run the heavy checks on queries that involve sensitive data or specific keywords.
  • Streaming: Stream the initial answer to the user while the verifier runs in parallel, allowing us to flag a section as "unverified" if the check fails.

What I'm still learning

I’m still unsure about the best way to handle "soft" disagreements. What if Model A is 90% correct and Model B is 95%? Does that warrant a rewrite, or is it noise?

Right now, I default to the more conservative answer, but it's a heuristic I'm constantly tuning. If you’re building these systems, don't aim for a perfect architecture on day one. Start with one verifier, measure the false-positive rate, and iterate. The goal isn't to eliminate all errors—it's to make them detectable before they reach the user.

Back to Blog

Similar Posts

Selective focus close-up of the word justice in a dictionary, emphasizing concept clarity.
AI/MLJune 21, 20264 min read

Optimizing RAG Retrieval: A Practical Guide to Semantic Reranking

Master semantic reranking to improve your RAG retrieval accuracy. Learn how to implement cross-encoders to filter noisy search results and boost precision.

Read more
Detailed image of a modern industrial control panel featuring multiple connectors and buttons.
AI/ML
June 20, 2026
5 min read

LLM Guardrails for Production: Input Validation and Output Filtering

LLM guardrails are essential for production AI. Learn how to implement reliable input validation and output filtering to keep your LLM apps safe and secure.

Read more
Close-up of an illuminated audio mixer panel in a recording studio, showcasing various controls and switches.
AI/MLJune 20, 20264 min read

Controlling LLM cost and latency: A Practical Production Guide

Controlling LLM cost and latency is the biggest hurdle in production. Learn how to optimize token usage and response times to keep your AI features fast.

Read more