Corpus & Permissions

AI's Reference Materials

RAG starts with a searchable document collection (corpus).

Only documents with proper permissions become search targets.

6 document types show their access status with lock indicators.

PDF
Email
Notes
Code
Slides
Spreadsheet
Accessible
Restricted

Parsing & Normalization: Book Scanning

Raw documents are decomposed into structured blocks.

PDFs, images, and tables must be converted to text blocks for search.

A raw document is separated into 5 block types.

Raw Document
Parsing
Heading
Paragraph
Table
Code
List

Chunking: Puzzle Pieces

Documents must be split into appropriately-sized chunks for accurate retrieval.

Too large loses precision; too small loses context.

Adjust chunk size with the slider and observe precision changes.

400
1
2
3
4
5
6
Search PrecisionMedium

Overlap Visualization

Overlapping portions ensure context continuity

Embedding & Vector DB: Semantic Coordinates

Chunks are converted to vectors and form clusters of similar meanings.

Converting text to numbers lets us measure 'similar meaning' as 'close distance.'

See the chunk → model → vector → DB pipeline and cluster space.

Chunk
Embedding Model
Vector
Vector DB
Finance
HR
Eng
Mkt

Chunks with similar topics cluster together

Meaning vs Keyword vs Hybrid: Three Search Methods

Different search methods have different accuracy and speed tradeoffs.

Search by meaning, search by keywords, or use both together.

A query is searched with 3 methods simultaneously and results are merged.

Query Vector

Dense

Semantic similarity via embeddings

Sparse

Keyword matching via BM25

Hybrid

Best of both worlds

Merge Results

Filtering: Smart Filters

Metadata filters narrow search scope for efficiency.

Pre-filtering by date, department, or project speeds up search.

Toggle filters to see candidate document count decrease.

20 chunksBefore
8 chunksAfter

Re-ranking: Second Review

AI carefully re-compares top candidates to reorder them.

After initial search, query-document pairs are directly evaluated for ranking.

Click the button to see ranking changes before and after re-ranking.

1
Doc A
0.85
2
Doc B
0.82
3
Doc C
0.79
4
Doc D
0.75

Context Assembly: Answer Recipe

Selected chunks are assembled into the prompt template.

Most relevant chunks are prioritized within token budget.

See system prompt, context, and query assembled with token budget bar.

<System Prompt>
<Retrieved Context>
Chunk 1120 tokens
Chunk 295 tokens
Chunk 3140 tokens
<User Query>
Token Budget355 / 500

Answer with Citations: Grounded Sources

LLM generates answers with citations based on retrieved context.

Each claim specifies its source for verifiability.

Hover over citation numbers to see source information.

Question

What is our vacation policy?

Answer

Employees receive 15 days of paid vacation annually, which increases to 20 days after 5 years of service. Unused vacation can be carried over up to 5 days

Sources

1
HR Policy Handbook
Section 4.2
2
Benefits Update 2024
Page 12
Click citation to jump to source
Verify any claim instantly
Full traceability