RAG Chunk Visualizer
Veja como um documento é dividido em chunks para RAG: tamanho do chunk, sobreposição, contagem de tokens, custo de embedding e contexto recuperado
Semelhante ao RecursiveCharacterTextSplitter do LangChain: tenta dividir primeiro em linhas em branco, depois quebras de linha, frases e palavras, mantendo os chunks o mais semânticos possível.
- Chunks
- 3
- Tokens do documento
- 232
- Média de tokens / chunk
- 81
- Mín. / máx. de tokens
- 46 / 126
- Tokens para embedding
- 242
- Fator de sobreposição
- 1.04×
Custo estimado de embedding: $0.000005
Contexto adicionado a cada prompt: 323 tokens
Mapa do documento (amarelo = sobreposição com o chunk anterior)
Linhas alternadas facilitam a diferenciação de chunks vizinhos.
- #170 tokens280 caracteres0–280
# Retrieval-Augmented Generation Retrieval-Augmented Generation (RAG) gives a language model access to knowledge it was not trained on. Instead of fine-tuning, you split your documents into chunks, embed each chunk, and store the vectors in a database. ## Why chunking matters
- #2126 tokens503 caracteres255–75825 caracteres de sobreposição
## Why chunking matters At query time the question is embedded and the closest chunks are retrieved. If a chunk is too large, it dilutes the meaning and wastes context window. If it is too small, it loses the surrounding context and the answer gets cut in half. A common starting point is 256 to 512 tokens with 10 to 20 percent overlap. Overlap repeats the end of one chunk at the start of the next, so a sentence that straddles a boundary is still found whole in at least one chunk. ## Trade-offs
- #346 tokens184 caracteres743–92715 caracteres de sobreposição
## Trade-offs Larger overlap improves recall but increases the number of tokens you embed and store. Always measure retrieval quality on your own questions before settling on a size.
A contagem de tokens é uma estimativa (~4 caracteres por token para inglês, ~1 por caractere não latino), e não a saída exata do tokenizer de um modelo. Os custos dependem do preço atual do seu provedor.