Knowledge assistants and RAG features that answer from your documents, show where each answer came from, filter by each user’s permissions and say “I don’t know” when the documents don’t say.
Free discovery callNDA on requestFixed proposal after scoping
Real questionsfrom your users
Permission checknothing the asker can't see
Retrievalwere the passages found?
Recallneeded passages found
Rerankingbest passages first
Precisionirrelevant passages out
Answeronly from passages
Faithfulnessno claim beyond sources
Citationseach claim sourced
Citation accuracysource supports the claim
Fig. 1 — Each stage has its own measure on a set of real questions: did retrieval find the passages needed, were irrelevant ones kept out, does the answer stay within its sources, and does each citation support its claim.
In short
Retrieval-augmented generation (RAG) is a pattern where a language model answers from passages retrieved from your own documents instead of from memory. Solidity Labs builds RAG systems end to end: ingestion and structure-aware chunking, hybrid search, permission filtering, reranking, cited answers, an evaluation set that measures retrieval and faithfulness, and monitoring once it is live.
Definition
What is retrieval-augmented generation?
RAG gives a model the right pages to read. Fine-tuning changes how a model writes. Most knowledge problems need the first, not the second.
A language model knows a lot about the world and nothing about your contracts, policies, product manuals or tickets. RAG closes that gap at question time: the system searches your content for the passages most likely to contain the answer, places them in the prompt, and asks the model to answer only from them, with references.
A demo that works on a handful of questions is easy to build. Production RAG is harder because the failure modes are quiet: the right passage is never retrieved, a table is split in half during chunking, an outdated version outranks the current one, or a user sees an answer drawn from a document they are not allowed to open. Our work is mostly about those details, and about measuring them, so quality is a number you can track rather than an impression.
If you are deciding between RAG and training your own model, our comparison of RAG and fine-tuning explains when each fits. The short version: use retrieval for knowledge that changes, and fine-tuning for behavior and format.
Problems we solve
Problems RAG solves well
People can’t find what the company already knows
Policies, specifications and past decisions live in drives, wikis and inboxes. A cited answer with a link beats a search results page.
Answers differ depending on who you ask
When everyone gets the answer from the same approved source, consistency follows, and the source gets fixed when it is wrong.
Generic chatbots invent answers
Answering only from retrieved passages, and declining when nothing relevant is found, cuts unsupported answers. A citation that doesn’t back its sentence makes the rest easy to spot.
Sensitive documents can’t go into a public tool
Permission filtering at retrieval time, private deployment options and redaction keep restricted content restricted.
What we build
What we build
Ingestion pipeline
Connectors for SharePoint, Google Drive, Confluence, Notion, ticketing systems and databases, with parsing that keeps headings, tables and page numbers.
Hybrid retrieval
Vector and keyword search combined, metadata filters and a reranker, tuned on your real questions.
Permission filtering
Each user only retrieves passages from documents they can open in the source system.
Cited answers
Every claim linked to a passage, with “I don’t know” when the retrieved context doesn’t support an answer.
Evaluation set
Questions with expected sources and answers, scored for retrieval recall and faithfulness on every change.
Freshness and versions
Incremental re-indexing, deleted documents removed, and superseded versions down-ranked or excluded.
Monitoring
Traces, unanswered questions, user feedback and cost per answer, reviewed with your team on a schedule you agree.
Use cases
Where RAG pays off
Internal knowledge assistant
Policies, procedures and product knowledge answered with citations for staff, filtered by department and role.
Customer support deflection
Help-center and documentation answers inside the support bot, with hand-off when the answer isn’t there.
Contract and policy review
Find the clause, compare versions and summarize obligations, with every statement traceable to a page.
Technical documentation search
Engineers and field teams ask in plain language and get the exact section of a manual or runbook.
Sales and RFP answers
Draft responses from approved past answers and product documentation, for a person to check.
Regulated research
Analysts query filings, reports and internal research, with sources recorded for audit.
How it works
How a production RAG system is put together
Ingestion runs ahead of time. At question time, retrieval is filtered by the asker’s permissions before the model sees anything.
SourcesPDFs · wiki · tickets
Parse & chunkstructure-aware
Embed+ metadata & ACLs
Hybrid indexvector + keyword
Questionwith user identity
Retrievefiltered by permission
Reranktop passages
Language modelgrounded prompt
Evaluation set & tracingfaithfulness · recall · cost
Cited answeror “I don’t know”
Fig. 2 — Documents are parsed, chunked and indexed ahead of time. At question time, retrieval is filtered by the asker's permissions, reranked, and the model answers with citations.
Sources
Connectors pull documents with their metadata and access-control lists, on a schedule or on change events.
Parsing and chunking
Structure-aware splitting by heading, table and section, so a chunk is a meaningful unit with its page and version.
Index
Embeddings plus a keyword index, with permissions stored per chunk: PostgreSQL with pgvector and its built-in full-text search, Qdrant with dense and sparse vectors, OpenSearch hybrid queries, or a managed search service.
Retrieval
Hybrid search, permission filter, metadata filters (date, product, region) and a reranker choose the passages.
Generation
A grounded prompt asks the model to answer only from the passages and cite them, or to say it doesn’t know.
Evaluation and monitoring
An evaluation set gates every change; production traces and feedback feed the next round of fixes.
Quality
What we measure, and why
RAG quality is several numbers, not one. We score retrieval separately from the answer, because each points at a different fix.
Were irrelevant passages kept out, with the best ones first?
A reranker, fewer passages, tighter metadata filters
Faithfulness
Is every statement supported by the retrieved passages?
Prompt constraints, smaller context, a stronger model
Citation accuracy
Does each cited passage support the sentence it is attached to?
Citation format in the prompt, passage-level IDs, citation checks in the evaluation set
Answer relevance
Does it answer the question that was asked?
Query understanding, clarifying questions
Refusal accuracy
Does it say “I don’t know” when it should?
Thresholds on retrieval scores, refusal examples in the evaluation set
Permission leakage
Did anyone see content they can’t open?
Filtering before generation; tested with role-based cases
Latency and cost
Is it fast and affordable at your volume?
Caching, smaller models for routing, fewer passages
Design choices
The decisions that matter most, and how we make them
If the right passage isn’t retrieved, no prompt or model change will fix that answer. That is why we measure retrieval first.
Add keyword search next to vector search when people ask with exact terms. Clause numbers, product codes, error codes and names are often missed by embeddings alone. Hybrid search finds both the exact term and the paraphrase.
Add a reranker when the right passage is found but ranked too low. A reranker scores the top results against the question before they reach the model. If recall is already low, fix chunking and search first; a reranker can’t promote a passage that was never retrieved.
Chunk by the document’s own structure. A clause, a table or a procedure step should stay in one chunk with its heading, page and version. Fixed-size chunks split tables and drop the exceptions that matter.
Filter by permission before generation, never after. The model should never see a passage the asker can’t open. Filtering the answer afterwards, or caching answers across users, leaks content.
Decline rather than guess. When retrieval finds nothing relevant, the system says it doesn’t know and, where it fits, offers a hand-off to a person.
Before a RAG system goes to its pilot group, we check that:
Every role has negative tests: questions it must not be able to answer, with the result proven, not assumed.
The evaluation set includes unanswerable questions, questions whose answer changed between versions, and questions about tables and scanned pages.
Retrieval and answers pass the targets agreed in the proposal, scored separately on the same evaluation set.
Documents are screened for hidden instructions at ingestion, and the system is tested against them. Indirect prompt injection (LLM01) and vector and embedding weaknesses (LLM08) are both on the OWASP Top 10 for LLM Applications, 2025 edition.
Deleted and superseded documents are gone from the index, and a test question proves it.
We gather questions people actually ask, with the documents that answer them. They become the evaluation set.
Free call
02
Content audit
We check sources for duplicates, outdated versions, scanned PDFs and permission models before indexing anything.
Audit
03
Scope and proposal
Sources, permissions, channels, evaluation targets and hosting, in a fixed proposal with milestone-based payments agreed in it.
Fixed proposal
04
Build and measure
Demos with evaluation scores, at a cadence agreed in the proposal, so you see quality move, not only features.
Regular demos
05
Pilot and launch
A pilot group first, with feedback buttons and trace review, then wider rollout and handover, with source code and IP transferred on final payment and a support period agreed in the proposal.
Handover
Technology
Tools we use for this
Models
OpenAI
Anthropic Claude
Google Gemini
Open-weight models
Retrieval
PostgreSQL + pgvector
Qdrant
OpenSearch
Cohere Rerank
Frameworks
LangChain
LangGraph
LlamaIndex
Parsing
Unstructured
Apache Tika
OCR for scanned documents
Evaluation
Ragas
Promptfoo
LangSmith
Custom evaluation sets
Scope drivers
What shapes scope
We don’t publish prices or week counts, because they depend on scope. These are the factors that actually move them.
01
Number and type of sources
Each connector, file format and permission model is its own piece of work. Scanned PDFs and complex tables need extra parsing.
02
Permission model
Mirroring document-level access from the source system is more work than a single shared index, and essential when content is sensitive.
03
Content quality
Duplicates, outdated versions and contradictions need clean-up rules or a content owner’s decisions before indexing.
04
Evaluation depth
A larger, carefully labeled evaluation set takes effort up front, and it is what tells you whether each later change helped or hurt.
05
Hosting and data boundary
Using a model provider’s API is simpler than private deployment inside your infrastructure.
06
Channels
A web interface, Slack or Teams bot, API or an embedded feature in your product each adds integration work.
Access to sources and an owner for each collection
Real questions and expected answers for the evaluation set
Decisions on retention and acceptable use
Licensed partners & providers
Model and embedding providers under their data terms
Vector database or cloud provider
Your identity provider for permissions
Security & quality
How we keep it safe and correct
Permission filtering before generation, tested with role-based evaluation cases
Model plans whose terms exclude training on your data (paid API tiers), or self-hosted models; retention configured per provider
Prompt-injection tests for retrieved content, and screening for hidden text such as instructions in white-on-white type
Personal data redaction in logs and traces
Audit trail of questions, retrieved sources and answers where required
Engineering example
Permission-aware knowledge assistant
The same question answered for three roles: retrieval filters what each one may see, cites its sources, and escalates when it can’t answer.
Illustrative engineering example: synthetic data, not a client project. Verified case studies will appear here when consented ones exist.
FAQ
Questions buyers ask us
Not covered here? Ask us directly — a person reads every message.
What is a RAG system?
A system that answers questions by first retrieving relevant passages from your documents and then asking a language model to answer only from those passages, with citations.
How do you stop a RAG system from hallucinating?
By measuring it. We constrain the model to cite retrieved passages, refuse when retrieval finds nothing relevant, and test faithfulness and citation accuracy on an evaluation set before every release. No RAG system is free of hallucinations; the aim is that unsupported answers are rare, caught by the evaluation set before release, and visible through citations and traces after it.
Can different users see different answers?
Yes. Retrieval is filtered by each user’s permissions in the source system, so people only get answers from documents they can already open.
Which vector database do you use?
Often PostgreSQL with pgvector, because many teams already run PostgreSQL, and its built-in full-text search covers the keyword side of hybrid search. Qdrant, OpenSearch or a managed service fit larger or more specialized loads. We choose after looking at volume, filters and hosting.
Can it work with scanned PDFs and tables?
Yes, with OCR and table-aware parsing. Scanned and table-heavy documents need more parsing work and more evaluation cases, so we test them early.
Can the system run without sending data to OpenAI or other providers?
Yes. Open-weight models and embeddings can run in your own cloud or infrastructure. See private AI systems for the trade-offs.
How much does RAG development cost?
It depends on the number of sources, the permission model, content quality, evaluation depth, hosting and channels. We don’t publish prices. After a free discovery call and a written scope, we send a fixed proposal with milestone-based payments agreed in it.
How do you keep answers up to date?
Incremental re-indexing when documents change, removal of deleted documents, and version rules so superseded content doesn’t outrank the current version.
Retrieval-augmented generation gives a model your facts at answer time; fine-tuning changes how the model behaves. Most business problems need RAG first, some need fine-tuning, and a few need both. Here is how to tell which.
Chatbots answer, automations follow fixed steps, and agents decide their own steps. Picking the wrong one wastes money or adds risk. Here is a decision guide with examples, trade-offs and the questions to ask.
An AI agent reads untrusted text and can take actions, so a malicious email or web page can try to steer it. Here are the main risks, prompt injection, data leakage and excessive agency, and the controls that actually reduce them.
Solidity Labs · · 7 min read
Last reviewed: Reviewed by our independent expert review under our editorial policy