...
Categories
Pragatix AI Agents blog Case Study Hallucinations

Beyond “Don’t Hallucinate”: Engineering True Fidelity in RAG Systems 

As we build increasingly sophisticated RAG (Retrieval-Augmented Generation) systems, we encounter a persistent challenge: ensuring the AI stays true to its source material. It’s a common misconception that simply instructing a Large Language Model (LLM) to “answer based only on the provided context” is sufficient. In reality, preventing hallucinations and ensuring high-fidelity answers requires robust engineering mechanisms, not just prompt engineering. 

In this post, we’ll explore why simple prompting falls short and detail the specific mechanisms we’ve implemented—like granular verification and source narrowing—to provide deeper, more reliable answers. 

If you are building RAG systems and care about answer fidelity, this is worth 15 minutes.

The Challenge: Why “Don’t Hallucinate” Isn’t Enough 

The most intuitive approach to RAG is simple: retrieve relevant documents, feed them to the LLM, and add a system instruction like: 

“Answer the user’s question using only the provided context. Do not use outside knowledge. If the answer isn’t in the context, say you don’t know.” 

While this helps, it is far from failsafe. LLMs are trained to be helpful and creative completion engines. When faced with a subtle gap in the provided context, they often “bridge the gap” with plausible-sounding but unverified information from their pre-training data. This “hallucination” is often subtle—a right answer, but for the wrong version of a product, or a conflation of two different documents. 

Furthermore, when we inject 10, 20, or 30 document chunks into the context window to maximize coverage, we introduce noise. The model might latch onto a semantically similar but irrelevant chunk, leading to an answer that is “grounded” in the wrong source. 

Our Approach: Trust Through Verification 

To solve this, we moved beyond passive prompting to active verification. We treat the LLM’s initial answer not as the final product, but as a draft that must undergo rigorous fact-checking before reaching the user. 

Our system implements a multi-stage fidelity pipeline designed to catch hallucinations at a granular level. 

1. Granular Verification: The Paragraph Test 

One of our key insights was that hallucinations are often localized. An answer might be 90% correct, with just one sentence drifting into fabrication. To catch this, we implemented per-paragraph keyword verification

Instead of checking the answer as a vague whole, our FidelityService breaks the generated answer into individual paragraphs. For each paragraph, we: 

  1. Extract Significant Keywords: We ask the model to identify the key entities and claims (topics, specific values, names) in that specific paragraph. 
  1. Verify Presence: We programmatically check if these keywords actually exist in the source documents. 
  1. Strict Thresholding: We enforce a configurable threshold (e.g., 35% of keywords must be explicitly found). If any paragraph fails this test—even if the rest of the answer is perfect—flag it for a redo. 

This granular approach prevents “partial hallucinations” from slipping through. An answer cannot ride on the coattails of a mostly correct summary; every claim must earn its keep. 

2. Source Narrowing: Providing Better Context 

A major cause of hallucination is “context flooding”—giving the model too much information. When a user asks a specific question, they don’t need 20 loose chunks of text; they often need one complete, coherent document. 

We addressed this with a Two-Phase Source Narrowing strategy: 

  • Phase 1 (Citation Check): When the model generates an initial answer, it cites specific documents. We verify these citations first. If the keywords from the answer are largely found in the cited docs, we know the model is on the right track. 
  • Phase 2 (Context Refinement): If the verification fails or needs a redo, we don’t just ask the model to “try again” with the same overwhelmed context. Instead, we narrow the source scope
  • If the model cited 1-2 specific documents, we retrieve the full text of those documents (replacing the fragmented chunks) to give the model complete context. 
  • We remove irrelevant chunks that might have distracted the model. 
  • We essentially say: “You identified Document A and B as relevant. Here is the full text of A and B. Now answer the question again strictly using these.” 

By narrowing the scope to the most probable sources, we remove the noise that causes hallucinations. 

Conclusion 

Building a trustworthy RAG system isn’t about finding the perfect prompt; it’s about building a verification loop. By implementing granular paragraph-level checks and intelligently narrowing source context based on initial citations, we can move from “hoping” the model doesn’t hallucinate to proving it hasn’t. 

This engineering-first approach allows us to trust the answers our system provides, knowing they are backed by specific, verified evidence. 

Further Reading

Categories
UC Solutions blog Case Study

The case for Archiving beyond regulation and compliance requirements.

Archiving is seen as a procedure that only applies to companies that need to follow specific regulations and compliance requirements. The IT bluder in KPMG that deleted 145,000 users’ personal chats in Microsoft Teams gives the verdict to our case.

What is archiving and why isn’t it so widely spread

Archiving is another way to refer to a trustworthy “back-up” that is also legally valid, ie. in case of a trial, can be used as evidence. Archives remain on separate domains, outside the danger of being altered or deleted.

Having said that, archives are usually seen more as compliance requirements that need special infrastructure, and in simple terms, cost more.

Economic laws tend to indicate that an extra fix cost is unnecessary and therefore it is mostly regulated companies (for example banks, financial institutions, medical institutions) that widely adopt archiving software or systems.

So why isn’t archiving a part of the Unified Communications Software features?

Since archives have a great and strategic value, the issue is about risk diversification rather than technical feasibility. If one goes and gives the same UC vendor the function to archive, when one fails (which is very often) both (UC Service and archive) can fail and provoke bigger losses.

This being said, 3rd party service providers like AGAT, offer Archiving and eDiscovery for Microsoft Teams, Slack, Webex, Zoom and Skype for Business. SphereShield by AGAT works for both messages, files, audio and video, being the most complete solution that can apply eDiscovery for audio recording AI generated scripts or video sharing through special optical character recognition.

Archiving is more necessary than usually thought.

It came to the news that a human error provoked the deletion of around 145,000 users’ personal chats in Microsoft Teams in KPMG, one of the biggest corporations in the world (Get the whole story here). This error is most likely to have come with a high price tag: important data lost, necessary archives gone and the list would still go on.

The necessity to archive (as a back-up) is the millenary necessity to be ready for a rainy day. That is why people sometimes leave their umbrellas in their cars although it could be a sunny day, the benefit outweighs the costs.

It is obvious that human errors like those need to be investigated and new methodologies must emerge to prevent them, but errors will still appear.

Conclusion: archive today, thank yourself tomorrow.

The conclusion is that, unless it will be impossible to afford, archiving has to be part of every company as a standard.

It is right that also employees need to be taught to reduce the amount of crucial information that is shared throughout chats, but that comes with a parable:

It is more effective to put higher fences on a balcony than always be reminding children of how dangerous it is to climb to see what’s below.

Cases like the one in KPMG are easily solved when companies count with archiving policies and data remains safe from human mistakes.

AGAT is offering the most complete solution out there for archiving and eDiscovery that includes both written and audio/video conversations.


Contact Us to see how AGAT can help your company with archiving and eDiscovery

Categories
Case Study UC Solutions

Case Study: How to mitigate insider risk while allowing 3rd party employees into Teams enviroment.

This case study reflects how SphereShield for Microsoft Teams helps a leading Australian company with over 7,000 employees mitigate insider threats while allowing their workers into their Teams enviroment

The Challenge: Limit a contractor’s ability to share sensitive information

Insider risk is a very serious concern for any company (see more). Even minor negligence acts have to be addressed and not left out of control.

A leading Australian corporation with over 7,000 employees approached AGAT one day. They were looking for a very crucial solution for their help desk service.

In order to provide for their help desk service, this company hired a 3rd party contractor which also received access to their Virtual Desktop infrastructure and Microsoft Teams tenant.

This represented a potential insider risk of third party employees having access to sensitive information.

This corporation approached AGAT Software in order to provide a solution that enables full visibility on the external contractor employees and locks down their ability to share sensitive information and mitigate insider risk

Our Solution

AGAT provided with two of its products to address the solution

SphereShield Ethical Wall for Microsoft Teams allowed the company to block 3rd party employees from contacting external parties, while allowing regular employees to communicate with everyone
In the same way, it blocked 3rd party employees from sharing their screens with internal parties to prevent private information from virtual desktops to be leaked

Second, SphereShield eDiscovery to allow capturing all communications events between users in that included: Event Type (chat, audio, video, file screen share), participants, content of the event

Customer Benefits

By choosing SphereShield by AGAT, our customer solved potential information breaches while letting internal communications run as usual. The Ethical Wall allowed them to easily manage communication policies involving 3rd party employees for ensuring sensitive information. What is more, the eDiscovery enabled for a more complete visibility of employee’s communications with a more robust monitoring over contractors to significantly diminish the risk of information leaks

Looking how to improve the compliance and security of your company’s Unified Communications and Collaboration service?
Contact us today