RAG & Vector Lab

Eight interactive labs: text chunking, embeddings, semantic search, vector databases, the RAG pipeline, advanced retrieval, chat with your documents and evaluation, plus an assistant builder for your own documents and experiments that run in the browser.

44interactive experiments

Text Chunking Lab

Compare eight chunking strategies on a real text: size, overlap, sentence and heading boundaries, and their effect on retrieval, with special handling of Arabic text.

  • 5Experiments
  • 3Lessons
  • 8Algorithms & concepts

Every experiment is labelled by its nature: "Real local execution" is genuinely computed in your browser or on your site's server, "Educational simulation" explains an idea without claiming to measure a real system, and "External integration" needs a service the site administrator configures. The local vectors here are lexical hashed vectors (not semantic embeddings) and are labelled as such.

Experiments

Real local execution L1

Compare chunking strategies

Chunk the same text with all eight strategies and read count, mean, deviation and time.

Real local execution L1

Chunks, visualised

See each chunk's boundaries, heading and length on the text.

Real local execution L2

Chunk size vs retrieval

Measure Hit@k and MRR at five sizes over the built-in question set.

Real local execution L2

Effect of overlap

Count sentences split across two chunks at different overlap values.

Real local execution L2

Arabic text handling

Normalisation, light stemming and tokens while keeping the original text for citations.

Lessons

Practice

Choosing a chunk size

Chunk size trades context against precision: a small chunk matches the question closely but loses its surroundings, a large one keeps context but mixes topics and dilutes the signal.

Read the lesson
Concept

Overlap between chunks

Overlap repeats the end of one chunk at the start of the next so that a sentence or fact is not cut at the boundary.

Read the lesson
Algorithm

Structure, recursive and semantic chunking

Fixed cuts by character count, recursive tries separators in order (paragraph, line, sentence, word), structural respects headings, and semantic cuts where the topic changes according to the similarity of neighbouring sentences.

Read the lesson

Algorithms and concepts in this lab

Algorithm / conceptLabNatureComplexityNote
Fixed-size chunkingText Chunking LabReal local executionO(n)Cuts every N characters with optional overlap, ignoring sentences.
Recursive chunkingText Chunking LabReal local executionO(n)Tries graded separators (paragraph, line, sentence, word) until the size fits.
Sentence chunkingText Chunking LabReal local executionO(n)Groups whole sentences up to the maximum size.
Structure-aware chunkingText Chunking LabReal local executionO(n)Cuts at headings and keeps the section name with each chunk.
Semantic chunking (lexical)Text Chunking LabReal local executionO(n·d)Cuts where neighbouring-sentence similarity drops; similarity here uses lexical vectors.
OverlapText Chunking LabReal local executionO(n)Repeats the end of a chunk at the start of the next to keep boundary sentences.
Arabic normalisationText Chunking LabReal local executionO(n)Removes diacritics and tatweel, unifies alef/yeh/teh-marbuta and digits, keeping the original.
Light Arabic/English stemmerText Chunking LabReal local executionO(n)Strips common prefixes and suffixes; not a morphological analyser.