Skip to content

Context Expansion: Smart Document Understanding ​

Last Updated: September 2026

Structure-aware retrieval

Context Expansion lets Scrapalot answer from whole sections of a document instead of isolated fragments, by understanding the document's structure (chapters, sections, subsections) and expanding context when a question needs it.

Traditional RAG systems work with isolated chunks of text, losing important context and relationships. Scrapalot's Context Expansion system solves this by understanding document structure and intelligently expanding context when needed.

How It Works ​

Context Expansion operates through intelligent document analysis and strategic context assembly:

The Problem With Traditional RAG ​

Traditional RAG systems break documents into isolated chunks, losing critical context:

Four Intelligent Strategies ​

Context Expansion is delivered by dedicated retrieval strategies — Section Expansion, Agentic Expansion, Agentic Context Navigator and Two-Phase Context (plus Entity-Expanded, which widens retrieval through the entities a question mentions) — together with document summaries and structure-aware chunking done at upload time. In practice they work in four ways:

1. Section-Based Expansion ​

Perfect for: Questions requiring complete procedural knowledge

2. AI-Powered Navigation ​

Perfect for: Complex questions requiring intelligent context decisions

3. Document Summary Enhancement ​

Perfect for: Providing rich background context

4. Structure-Aware Chunking ​

Perfect for: Technical documents with complex formatting

Real-World Impact ​

Before vs After Context Expansion ​

Smart Context Selection ​

Context Expansion automatically chooses the optimal strategy based on your question type:

Configuration & Control ​

Context Expansion works automatically:

  • Automatic routing (the default) picks a context-expansion strategy when the question needs it
  • Manual mode: switch off automatic routing and pick Section Expansion, Agentic Expansion, Agentic Context Navigator, Two-Phase Context or Entity-Expanded yourself from the strategy selector
  • Hierarchy detection and document summaries are produced automatically in the background after upload

Performance & Efficiency ​

  • Background preparation: structure analysis and document summaries are built by background workers after upload, so questions never wait for them
  • Expansion at query time only reads what is already stored — sections and summaries — rather than re-processing documents
  • Page-level citations are kept when context is expanded, so you can still jump to the exact source

Getting Started ​

Context Expansion works automatically with your documents:

  1. Upload Documents: Context analysis happens automatically
  2. Ask Questions: Get complete, contextual answers
  3. Review Citations: See exactly where information comes from
  4. Adjust Settings: Fine-tune expansion behavior if needed

Automatic Intelligence

Context Expansion requires no setup or configuration. It automatically analyzes your documents and improves answer quality from your first question.

Best Practices ​

Document Preparation ​

  • Clear Structure: Use proper headings (H1, H2, H3)
  • Logical Organization: Group related information
  • Consistent Formatting: Maintain formatting standards

Question Formulation ​

  • Be Specific: "How do I configure SSL?" vs "Tell me about security"
  • Use Context: "In the deployment section, how do I..."
  • Ask Follow-ups: Build on previous answers for deeper understanding

Advanced Features ​

Multi-Document Context ​

Context Expansion can intelligently combine information across multiple related documents:

Continuous Learning ​

The system learns from usage patterns to improve context selection:

  • Query Analysis: Understands common question patterns
  • Success Metrics: Tracks answer completeness and accuracy
  • Adaptive Behavior: Improves strategy selection over time

Context Expansion integrates seamlessly with other Scrapalot capabilities:


Context Expansion represents the future of intelligent document understanding, moving beyond simple keyword matching to true comprehension of document structure and context. Experience the difference of complete, accurate answers that respect the original document's intent and organization.

Open-core — Community Edition under AGPL-3.0 · Hosted product is proprietary.