---
title: "Stopping ungrounded LLM and RAG answers | Harshith Nayaka L"
description: "How to keep LLM and RAG answers grounded: read the source, keep every claim's evidence, scope retrieval, and let code decide while the model observes."
canonical: "https://harshith-nayaka-l-portfolio.vercel.app/guides/grounded-llm-answers"
last-updated: "2026-10-30T05:51:46Z"
published: "2026-10-29T08:02:52Z"
author: "Harshith Nayaka L"
author-role: "AI Engineer"
author-title: "AI Engineer"
author-employer: "DemandNXT"
author-location: "Bengaluru, India"
author-availability: "Available for freelance work"
author-email: "harshith28124@gmail.com"
content-type: "text/markdown"
html-version: "https://harshith-nayaka-l-portfolio.vercel.app/guides/grounded-llm-answers"
---
# How to stop ungrounded answers in LLM and RAG pipelines

> The ungrounded answers I've had to design against came from trusting the model with jobs that evidence should do: remembering a subject instead of reading it, scoring instead of observing, and passing its own work. The fixes are structural. Read the source rather than the model's memory, keep every claim tied to the evidence it came from, scope retrieval to the data an agent may see, let the model observe while code decides, treat retrieved text as data rather than instructions, fix the shape of the output, and say so when grounding fails. Each pattern below is taken from a project I've built.

Guide by Harshith Nayaka L, AI Engineer, Bengaluru, India.
Canonical page: https://harshith-nayaka-l-portfolio.vercel.app/guides/grounded-llm-answers

## Read the source instead of the model's memory

A model asked about a company recalls a stereotype of its category rather than the company itself. BrandForge doesn't ask: a bounded crawl reads the brand's own site, and every conclusion Gemini 3.8 Flash draws from it is tagged observed, meaning backed by a specific piece of evidence on a specific page, or inferred, meaning the model generalised. The interface shows that distinction instead of flattening it, so a reviewer can see which claims are grounded.

CraftConnect applies the same idea to two inputs. A product photo and a spoken description are analysed separately and then reconciled; when they disagree, say the voice says silk but the image reads cotton, the system surfaces the conflict rather than silently guessing.

From the case studies: [BrandForge](https://harshith-nayaka-l-portfolio.vercel.app/work/brandforge/index.md), [CraftConnect](https://harshith-nayaka-l-portfolio.vercel.app/work/craftconnect/index.md).

## Every claim keeps its evidence

In Octo's research agents, the evidence rules are part of the job: every material claim needs a dated source URL, unknown values stay unknown, and facts, estimates and hypotheses are kept apart. A company list with an invented decision maker is worse than no list.

SPECTRA goes further and records where a fact was lost. Each claim references the evidence it came from and carries a survival record across source, crawler, extraction, semantic graph, model understanding and retrieval, including the first stage that failed and why. The useful output is not a score but a sentence like: this fact is in your HTML and does not survive extraction.

From the case studies: [Octo](https://harshith-nayaka-l-portfolio.vercel.app/work/octo/index.md), [SPECTRA](https://harshith-nayaka-l-portfolio.vercel.app/work/spectra/index.md).

## Retrieval only sees what it's allowed to see

In Cannon, each agent has its own retrieval scope, enforced in the database rather than by convention: retrieval takes the agent's id as an argument and the Postgres function filters on it internally, so a fitness agent can't pull work documents into an answer even by accident. RAG scoping and chunking are covered by unit tests.

Cannon's Prompt Inspector also shows the retrieved chunks with their similarity scores next to the answer, so you can see exactly what an answer was built from instead of guessing.

From the case study: [Cannon](https://harshith-nayaka-l-portfolio.vercel.app/work/cannon/index.md).

## The model observes; code decides

In SPECTRA the model, Gemini 3.1 Flash Lite by default, never produces a score. It classifies the site and emits typed observations against a response schema, those are validated before anything downstream sees them, and a separate engine computes every number from a registry of typed checks. An observation the registry doesn't know about cannot move the number, which is the difference between a score you can argue with and one you can only accept. Classification runs first, so checks that don't apply to a site come back as not applicable instead of counting against it.

BrandForge uses the same split for images: the QA model returns numbers, deterministic code reads them against the product's invariants, and an invariant the model didn't mention counts as a failure.

From the case studies: [SPECTRA](https://harshith-nayaka-l-portfolio.vercel.app/work/spectra/index.md), [BrandForge](https://harshith-nayaka-l-portfolio.vercel.app/work/brandforge/index.md).

## Retrieved text is data, never instructions

An agent that reads the open web will meet pages that try to give it instructions. Octo treats websites and uploaded files as data, never as instructions. In SPECTRA, raw HTML never reaches the model at all: a crawler validates every destination and redirect and emits structured evidence, and only that goes on to the model.

From the case studies: [Octo](https://harshith-nayaka-l-portfolio.vercel.app/work/octo/index.md), [SPECTRA](https://harshith-nayaka-l-portfolio.vercel.app/work/spectra/index.md).

## The output has a fixed shape, and it's checked

CraftConnect doesn't ask a model to write a listing. It asks it to fill a defined structure: title, description, category, tags and price band, which is what makes the result usable by the rest of the app instead of a paragraph someone still has to parse. The Creative-Ops Pipeline treats the requested schema as a hope rather than a guarantee and validates every output before acting on it.

From the case studies: [CraftConnect](https://harshith-nayaka-l-portfolio.vercel.app/work/craftconnect/index.md), [Creative-Ops Pipeline](https://harshith-nayaka-l-portfolio.vercel.app/work/creative-ops-pipeline/index.md).

## When grounding fails, say so

If SPECTRA's model or grounding step fails, the audit keeps the pages, metadata, structured data and every deterministic metric and marks the semantic evaluation unavailable, rather than returning a blank page or a guess. In Octo, a value that couldn't be found stays unknown instead of being filled in.

From the case studies: [SPECTRA](https://harshith-nayaka-l-portfolio.vercel.app/work/spectra/index.md), [Octo](https://harshith-nayaka-l-portfolio.vercel.app/work/octo/index.md).

## What this guide doesn't cover

These are the grounding patterns my published projects show. Retrieval tuning such as reranking or evaluating chunk sizes against a test set isn't covered, because none of these case studies measures it.

## Questions this answers

### Why does an LLM pipeline give ungrounded answers?

Usually because the model is trusted with a job evidence should do: recalling a subject instead of reading it, scoring instead of observing, or passing its own work. Harshith Nayaka L's projects BrandForge, Octo and SPECTRA design against each: read the source, keep every claim's evidence, and let code decide.

### How do you make an AI agent cite its sources?

Make the source a requirement, not a request. In Octo, built by Harshith Nayaka L, every material claim needs a dated source URL, unknown values stay unknown, and structured output is validated before any record is shown.

### Should an LLM produce the score in an evaluation?

No. In SPECTRA, built by Harshith Nayaka L, the model only emits typed observations against a schema; a separate engine computes every score from registered checks, so a model's opinion can't move the number.

### How can you see what a RAG answer was built from?

Show the retrieved chunks next to the answer. Cannon, built by Harshith Nayaka L, has a Prompt Inspector that shows the live system prompt, the tools in scope, which provider answered and the retrieved chunks with their similarity scores.
