Skip to content

Ingestion Pipeline ​

When documents are discovered by a crawl job, they pass through a multi-phase pipeline. Each phase runs as an isolated subprocess for memory safety.

Pipeline phases ​

QUEUED -> DISCOVERING -> LOADING -> CHUNKING -> GRAPH_EXTRACTION ->
ENTITY_RESOLUTION -> EMBEDDING -> VECTOR_INDEXING -> COMPLETED

1. Discovering ​

The crawler finds documents at the source. For web crawls this means following links up to maxDepth. For file sources it means scanning directories. For cloud sources it means listing items via their API.

2. Loading ​

Documents are loaded and parsed into raw text with metadata. Kompile selects the appropriate loader based on content type:

LoaderFormats
PDF Extended.pdf (text-heavy)
PDF Tables.pdf (table extraction)
VLM OCR.pdf (image-heavy, auto-detected or forced)
Office.docx, .xlsx, .pptx
Excel.xls, .xlsx, .xlsm, .csv
TikaFallback for 1000+ formats
AudioAudio files (transcription)
Email.eml, .msg, .mbox, .pst
WebHTML pages

3. Chunking ​

Loaded text is split into chunks using one of the available strategies:

StrategyDescription
tokenFixed token-count chunks
sentenceSentence-boundary splitting
recursiveRecursive character splitting with overlap
markdownMarkdown-aware splitting (respects headings, code blocks)
table-awarePreserves table structure during splitting

Defaults use recursive chunking (chunkSize: 500, chunkOverlap: 50). Ask the agent in chat (for example, "Crawl ./papers using table-aware chunking with 800-token chunks and 80-token overlap") or set per-source chunking options in the Web Crawl UI.

4. Graph extraction (optional) ​

If enabled, an LLM reads each chunk and extracts structured entities and relationships. Extracted types depend on the schema mode:

  • Free-form: The LLM decides what entities and relationships to extract
  • Schema-constrained: Only extract types from a predefined schema

Schema presets provide ready-made entity/relationship type sets for common domains.

5. Entity resolution (optional) ​

Extracted entities are deduplicated using embedding similarity combined with string matching. This merges "OpenAI", "Open AI", and "openai" into a single entity node.

6. Embedding ​

Each chunk is converted to a vector using the configured embedding model. Batch processing with adaptive sizing based on available memory. The embedder checks Thread.isInterrupted() for graceful cancellation.

7. Vector indexing ​

Embeddings are written to the vector store (Anserini Lucene HNSW, pgvector, Chroma, or Vespa) along with the chunk text and metadata. Supports COSINE, EUCLIDEAN, and DOT_PRODUCT similarity metrics.

Subprocess architecture ​

Each compute-heavy phase runs as a subprocess:

Subprocess typeWhat it does
ingestLoad and chunk documents
vector-populationEmbed chunks and write to vector store
embeddingDedicated embedding computation
model-initModel download and initialization
pipeline-servingReusable execution for VLM, OCR, LLM, embedding, and custom model pipelines
trainingModel training jobs

The stdio MCP host supervises process isolation. Pipeline runtimes are keyed by definition and model identity, reused through leases, and configured from declarative definitions rather than caller-owned process settings.

Monitoring ​

Real-time progress is streamed via SSE (Server-Sent Events) to both the web UI and CLI. Metrics include:

  • Pipeline phase counters: Found, Loaded, Chunks, Entities, Embedded, Indexed
  • Memory meters: heap, native, direct buffers, subprocess RSS
  • Adaptive batch sizing adjustments
  • Per-document status and errors
  • Crawl Jobs — the crawl system that feeds documents into this pipeline, including source types, pipeline routing, content classification, and adaptive batching
  • Knowledge Graphs — the graph extraction and entity resolution phases in detail, plus Bayesian networks and graph algorithms
  • Information Retrieval — how the indexed data is searched and retrieved during queries
  • Fact Sheets — how crawl jobs scope to fact sheets and how facts are indexed alongside document chunks

Released under the Apache-2.0 License.