Good retrieval starts before a document reaches a vector database. This guide provides a practical RAG document chunking and metadata checklist, including scenario-based starting points, preparation steps, troubleshooting methods, and review triggers for improving a knowledge base chatbot without rebuilding the bot.
Overview
In a retrieval-augmented generation (RAG) system, source documents are parsed, divided into chunks, converted into embeddings, stored for search, and supplied to a language model as context. Chunking determines how much meaning each searchable unit contains. Metadata gives the retriever additional ways to filter, rank, and explain those units.
There is no single best chunk size for every AI Q&A bot. A useful starting point depends on the document structure, the type of questions users ask, the embedding model, the context window, and the retrieval settings. Short chunks can improve precision but may remove important context. Long chunks preserve context but can make results less focused and leave less room for other sources in the prompt.
Use chunking as an information-design decision rather than a purely technical setting. A policy exception, a troubleshooting step, and a product comparison may need different boundaries even if they come from the same file. Before changing your application code, test whether better parsing, cleaner source documents, more useful metadata, or improved retrieval filters can solve the problem.
A practical starting model
- Preserve structure: Keep headings, section names, list labels, table context, and document identity with each chunk where possible.
- Prefer semantic boundaries: Split between sections, procedures, questions and answers, or complete topic units instead of cutting through a sentence or instruction.
- Use overlap selectively: A small overlap can preserve continuity across boundaries, but excessive overlap creates duplicate search results.
- Keep provenance: Store the source path, title, version, page or section reference, and access classification so the bot can cite and filter responsibly.
- Measure retrieval separately from generation: First ask whether the correct passage was retrieved. Only then evaluate whether the model used it correctly.
Checklist by scenario
Start with the scenario closest to your corpus, then validate the choice with representative questions. The ranges below are starting points, not universal limits; confirm them against your parser, embedding model, vector store, and model context budget.
| Document or use case | Chunking approach | Metadata to prioritize | Quality check |
|---|---|---|---|
| FAQ or support articles | Keep each question and its complete answer together. Split unusually long answers by subtopic or procedure step. | Product, feature, audience, locale, article status, effective date, source URL. | Can the bot answer a question using one result without losing a qualification or exception? |
| Policies and compliance documents | Respect headings, numbered clauses, definitions, exceptions, and appendices. Keep a rule with its conditions where practical. | Policy name, owner, version, effective date, jurisdiction, department, access level. | Are definitions and exceptions retrieved with the rule they modify? |
| Technical manuals | Group a task overview, prerequisites, steps, warnings, and expected result. Keep code blocks and command output intact. | Product version, operating system, component, task type, difficulty, document version. | Can a user follow the retrieved procedure without missing prerequisites or warnings? |
| Tickets, conversations, or transcripts | Separate issue, context, resolution, and follow-up. Avoid treating an entire long conversation as one searchable unit. | Issue type, product, resolution status, date, customer segment, language, sensitive-data flag. | Does retrieval surface the resolution rather than an unrelated opening message? |
| Tables and catalogs | Repeat the table title, column meaning, and relevant row context in each row group. Do not embed isolated values without labels. | Category, region, currency or unit, validity period, product ID, row identifier. | Can the bot distinguish similar values and explain the applicable unit or date? |
| Internal knowledge base | Use section-aware chunks that are large enough to preserve team-specific context but small enough to distinguish separate procedures. | Team, owner, confidentiality, system, workflow, review date, audience. | Are restricted or outdated pages excluded before generation? |
Document-preparation checklist
- Inventory the file types, languages, owners, versions, and access levels in the import.
- Remove navigation menus, repeated footers, boilerplate, tracking parameters, and accidental duplicate text.
- Confirm that the parser preserves headings, lists, tables, links, code, page numbers, and image captions where they matter.
- Normalize obvious formatting problems, but retain meaningful product names, identifiers, units, and capitalization.
- Separate superseded material from current material instead of relying only on the language model to choose between them.
- Assign stable document and chunk identifiers so reindexing can replace old records rather than create duplicates.
- Record the document owner and a review date before ingestion. A knowledge base chatbot is easier to maintain when every source has accountability.
Metadata schema template
A compact schema is usually easier to maintain than a large collection of inconsistent fields. Adapt the names to your platform, but define each field and its allowed values.
{
"document_id": "stable-source-id",
"chunk_id": "stable-source-id-section-03",
"title": "Document title",
"heading_path": ["Product", "Setup", "Troubleshooting"],
"source_uri": "https://example.com/source",
"source_type": "html|pdf|docx|ticket",
"version": "2026-01",
"effective_from": "YYYY-MM-DD",
"review_on": "YYYY-MM-DD",
"owner": "team-or-role",
"product": "product-name",
"language": "en",
"access_level": "public|internal|restricted",
"content_status": "current|draft|retired"
}
Use controlled values for fields used in filters. For example, “internal,” “Internal,” and “company-only” may be understandable to people but can produce inconsistent filtering. Keep display text separate from machine-readable values when necessary.
What to double-check
1. Retrieval settings and chunk size
Chunk size and retrieval count are connected. If chunks are large, returning many of them may exceed the useful context budget. If chunks are very small, retrieving more results may be necessary to reconstruct an answer. Test several combinations rather than tuning only one number.
Review whether your system supports metadata filtering, keyword or hybrid search, reranking, deduplication, and parent-child retrieval. A child chunk can provide precise matching while a parent section supplies broader context. The exact implementation depends on your tools, so document the assumptions in your ingestion and deployment notes.
2. Source boundaries and citations
Inspect a sample of stored chunks directly. Each one should answer basic questions such as: Where did this text come from? What section did it belong to? Which version applies? Is the citation location useful to a reader? If the answer is no, improve the ingestion record before adjusting the prompt.
3. Access control
Apply permissions before retrieved content reaches the model. Metadata such as access_level, team, tenant, or document owner should support enforcement, not merely display. For a broader implementation checklist, see the AI Chatbot Security and Access Control Guide.
4. Evaluation questions
Create a small evaluation set containing direct questions, questions requiring two sections, questions about exceptions, obsolete-content questions, ambiguous requests, and questions whose answer is absent. Label the expected source or sources. Then record:
- Whether the correct document appeared in retrieval results.
- Whether the best passage appeared near the top.
- Whether duplicate chunks crowded out useful evidence.
- Whether citations pointed to the correct section and version.
- Whether the bot appropriately said it could not verify an answer.
This separates ingestion defects from prompt or conversation-design defects. The AI Chatbot Testing Checklist can help organize these cases, while the AI Chatbot Monitoring Guide is useful once the system is in regular use.
Common mistakes
- Using one fixed size for every file: A legal clause, FAQ answer, and troubleshooting procedure do not share the same information shape. Let structure guide the split.
- Splitting without preserving headings: A paragraph titled “Refund exceptions” is less useful when stored without that heading.
- Embedding raw PDFs without inspection: Multi-column layouts, headers, footers, scanned pages, and tables can produce scrambled text or missing content.
- Adding too much overlap: Repeated passages can dominate results and consume context. Increase overlap only when evaluation shows that boundary loss is the problem.
- Ignoring outdated documents: A well-retrieved obsolete answer is still a bad answer. Use status, version, effective date, and review metadata.
- Storing metadata inconsistently: Filters and analytics become unreliable when values, date formats, or field meanings vary by importer.
- Changing several variables at once: If chunk size, embedding model, retrieval count, and prompt all change together, you cannot tell what improved or harmed results. Track ingestion versions and use controlled tests. A prompt change should also be recorded using a prompt versioning workflow.
- Measuring only final answers: A fluent answer can hide a retrieval failure. Log retrieved document IDs, scores when available, filters, and citations while respecting privacy requirements.
When to revisit
Revisit chunking and metadata whenever the inputs or retrieval environment change. A review is especially useful before a seasonal planning cycle, after a major documentation import, or when teams begin asking questions that the original corpus did not anticipate.
Use this recheck workflow
- Capture the trigger: Record whether the change came from new files, a parser update, a vector database change, a model change, a new language, or user feedback.
- Freeze a baseline: Save the current chunking settings, metadata schema, retrieval configuration, and evaluation results.
- Inspect representative failures: Classify each as parsing, chunk boundary, missing metadata, filtering, ranking, stale content, or answer-generation failure.
- Change one main variable: For example, compare semantic sectioning with a fixed-size approach while keeping retrieval and prompting constant.
- Reindex safely: Use versioned indexes or stable identifiers so the new corpus can be compared with and rolled back from the previous one.
- Run regression tests: Include previously successful questions, recent failures, access-control cases, and no-answer cases.
- Document the decision: Note the selected approach, known limitations, owners, and the next review date.
Finally, connect retrieval maintenance to broader knowledge-base ownership. The AI Chatbot Knowledge Base Maintenance workflow can help keep source review separate from index tuning. When retrieval is reliable, revisit conversation design and handoff behavior rather than making the ingestion pipeline compensate for every user-intent problem.
Action for your next import: choose ten representative questions, inspect the chunks they retrieve, verify their metadata and permissions, and record one measurable change to test. That small feedback loop is more dependable than searching for a universal “best” chunk size.