AI Development
Connect internal manuals, contracts, SOPs and product catalogues to language models through hybrid retrieval, role-based access filtering and verifiable inline source citations.
Method, retrieval pipeline and evaluation benchmarks. Client documents stay private.
Internal search that returns outdated clauses or invents answers
Standard enterprise search fails when staff ask operational questions in natural English or Arabic across hundreds of PDFs, supplier sheets and policy updates. Operations, support and commercial teams across the UAE commission custom RAG development when off-the-shelf chat plugins hit four predictable failure points:
- Superseding addenda stay invisible. Naive vector chunking ranks an older PDF page equally beside last week’s signed update, causing staff to quote retired fee schedules or expired SOP steps.
- Role permissions leak across departments. Indexing shared drives into one shared vector store without document-level access tags exposes commercial margins or HR records to unintended queries.
- Scanned PDFs and nested tables turn into garbled tokens. Multi-column specification sheets, Arabic-English bilingual circulars and merged invoice tables shred during basic text splitting, stripping numbers from the labels they belong to.
- Plausible answers mask missing citations. When retrieval pulls weak matches, an unconstrained generator fills the gap from pre-training weights instead of telling the operator no policy record exists.
Grounded retrieval with permissions and inline citations
Retrieval-augmented generation works reliably only when document parsing, metadata governance and retrieval scoring happen cleanly before a language model writes a word. We build RAG and knowledge systems as five auditable pipeline stages rather than an opaque black box:
-
1. Layout-aware ingestion
We check: Preserve headings, bilingual table rows, page numbers and document effective dates during extraction.
Breaks when: Fixed-character splitting severs table headers from values and splits Arabic paragraphs mid-clause.
-
2. Permission & metadata tagging
We check: Attach tenant ID, department role, status (active vs superseded) and source URI to every chunk.
Breaks when: Archived revisions stay searchable alongside live policy and private records cross tenant borders.
-
3. Hybrid dense + lexical search
We check: Combine semantic embeddings with BM25 keyword matching and cross-encoder reranking.
Breaks when: Exact SKU codes, clause identifiers and model numbers vanish in pure embedding distance searches.
-
4. Grounded answer synthesis
We check: Pass only permission-filtered top passages with strict instructions to cite chunk IDs or refuse.
Breaks when: Unconstrained prompting blends retrieved extracts with general model assumptions cleanly disguised as fact.
-
5. Citation & drift verification
We check: Run nightly golden question-and-citation benchmarks plus automated invalidation when source files change.
Breaks when: Source edits silently diverge from live answers until an operator notices a stale clause in customer correspondence.
Every answer card links directly back to the exact file version and page excerpt used to generate it, giving human reviewers a three-second verification path before acting.
Choosing the right retrieval pattern (and when RAG beats fine-tuning)
Teams often assume they need to train custom model weights to teach an AI assistant their business facts. In practice, model weights store style and formatting well while structured retrieval handles mutable facts, permissions and auditability. For a deeper side-by-side breakdown, read our engineering guide on RAG vs fine-tuning.
| Architecture | Best used for | Strengths | Wrong choice when |
|---|---|---|---|
| Lexical keyword search | Exact part numbers, legal clause codes or single-word glossary lookups. | Sub-50ms deterministic results with zero generative token spend. | Queries ask “how do we handle” across paraphrased policies. |
| Hybrid RAG + reranker | Bilingual SOPs, supplier contracts, product catalogues and engineering handbooks. | Balances exact SKU matching with semantic context, citations and live deletes. | Source documents are clean relational rows better served by SQL queries. |
| SQL / structured tool calls | Live inventory counts, order totals, pricing ledgers and date-range aggregations. | Exact arithmetic and real-time operational consistency across systems. | Knowledge sits primarily inside prose manuals or unstructured attachments. |
| Model fine-tuning | Enforcing specialised domain tone, compact syntax or narrow classification style. | Consistent formatting on repeatable short-context inputs without heavy prompt instructions. | Facts change weekly, sources require citations or role permissions govern access. |
Deliverables, stack and industry applications
Document ingestion pipelines
Incremental watchers for Google Drive, SharePoint, S3 buckets and CMS webhooks handling PDF, DOCX, HTML and CSV sources cleanly.
Bilingual table & layout parsers
Structure-preserving splitters that keep parent headings, Arabic right-to-left segments and markdown table headers attached to chunks.
Hybrid index & access control
PostgreSQL with pgvector plus full-text inverted indexes enforcing mandatory pre-filter predicates per user role before ranking.
Citation-locked answer API
Structured JSON output carrying exact source passages, page anchors and explicit abstention when minimum retrieval scores fail.
Golden Q&A evaluation suite
Automated retrieval recall@k, groundedness and unanswerable-question refusal checks gated in continuous integration.
Freshness & deletion sync
Tombstone handlers ensuring moved, expired or deleted source documents disappear from search results immediately.
We typically assemble RAG backends in Python alongside typed web frontends in TypeScript and JavaScript, storing transactional records and vector indexes together in PostgreSQL deployed on AWS. Across retail and e-commerce catalogues, FMCG distributor specification sheets and food and beverage compliance manuals, keeping structured permissions inside one database prevents vector-store drift cleanly.
How we engineer verifiable knowledge systems
-
Document audit and taxonomy map
We inspect representative PDFs, scans, spreadsheets and access roles across departments before indexing a single file.
- Retrieval & eval pipeline does
- Counts token density, table ratio and OCR error rates per document type.
- Engineers & domain owners decide
- Domain owners define authoritative sources, expiry rules and access boundaries.
-
Golden question-citation bank
Before choosing chunk sizes or models, we assemble real staff questions paired with exact required page citations—and explicit unanswerable traps.
- Retrieval & eval pipeline does
- Synthesises paraphrased bilingual phrasing variations for test coverage.
- Engineers & domain owners decide
- Subject specialists approve ground-truth answers and refusal expectations.
-
Ingestion, ACL filters and hybrid search
We build layout-preserving parsers, security filter enforcement and hybrid dense/BM25 retrieval with cross-encoder reranking.
- Retrieval & eval pipeline does
- Benchmarks recall@k across chunk windows and embedding models.
- Engineers & domain owners decide
- Engineers lock pre-query permission checks so restricted chunks never reach rerankers.
-
Grounded synthesis & citation UI
Generation prompts bind strictly to numbered retrieved excerpts, surfacing clickable verification snippets beside every claim.
- Retrieval & eval pipeline does
- Flags sentences lacking direct textual entailment with retrieved chunks.
- Engineers & domain owners decide
- Product designers make refusal and verification cues immediately obvious to operators.
-
Incremental re-indexing and drift gates
Scheduled sync jobs add, update and purge document chunks while regression runs alert on retrieval drops after corpus growth.
- Retrieval & eval pipeline does
- Detects stale citations or rising abstention spikes per topic.
- Engineers & domain owners decide
- Maintainers inspect flagged low-confidence queries to fill missing source documentation.
When RAG fits, engagement scope and cost drivers
RAG is the right architecture when knowledge spans unstructured documents that evolve continuously, require verifiable citations or enforce per-department access permissions. It is the wrong choice when answers depend on arithmetic across database tables—which belongs to typed SQL queries or deterministic APIs. You can commission either a bounded pilot covering one high-value document library with full citation evaluation, or a production multi-source platform paired with ongoing LLM integration governance.
We quote on scope rather than publishing flat rate tables. Implementation effort and operating costs depend on five drivers: source quality (native digital text versus scanned Arabic/English PDFs with nested tables), permission granularity across departments, sync latency requirements for live deletes, evaluation depth before rollout, and monthly query concurrency.
Questions technical and operational teams ask about RAG
- Why did our first vector-database prototype hallucinate even though the right document was uploaded?
- Usually two reasons: fixed-size text chunking split the answer away from its section heading or table row, or weak retrieval matches were still passed to the language model without a strict relevance floor and refusal instruction.
- How do you handle Arabic and mixed English-Arabic company documents?
- We test OCR fidelity on bilingual layouts first, select multilingual embeddings verified on Arabic-English technical prose rather than relying on English-only defaults, and evaluate citation alignment separately in both languages.
- Do we need a separate dedicated vector database like Pinecone from day one?
- Rarely. Running pgvector inside PostgreSQL keeps permissions, document status metadata and embeddings under the same ACID transactions—reducing infrastructure sprawl unless billion-scale sub-millisecond workloads justify separation.
- Should we fine-tune a custom model or build RAG first?
- Almost always build grounded retrieval first because facts update without retraining and every claim carries a source pointer. See RAG vs fine-tuning for our full decision rubric.
Continue from LLM integration, return to the broader AI development hub, read RAG vs fine-tuning, or review our full technologies index.
Put your documentation on a citation leash
Tell us where your policies, catalogues or technical manuals live, who is allowed to read what, and which questions stall teams today.