Xberg — Document Intelligence Engine

2026-08-07 · source · source ↗ · raw capture · wiki page

Xberg is the successor to Kreuzberg — a Rust document intelligence engine that extracts text, tables, structured data, and metadata from 101 file formats across 115 file extensions. Written by Na'aman Hirschfeld, it's available as a library, CLI (13 commands), REST API (xberg serve), and MCP server (9 tools), with Docker and Helm deployment support.


Architecture

Extraction Pipeline

  1. MIME detection → Extractor selection by priority → Format-specific extraction → InternalDocument
  2. Image OCR processing (async) → Captioning prepass (runs BEFORE main derivation to feed captions into InternalDocument)
  3. Derive ExtractedDocument → Image re-encode → Base64 pass → Early post-processors → Language detection
  4. Provisional chunking (so Middle/Late processors see chunks) → Middle post-processors → Late post-processors → Token reduction → Validators → NFC normalization
  5. Discard diverged internal/formatted content (#286, #331 fixes) → LLM structured extraction → Output format → Final chunking (after all content mutations — #213 fix for chunk offset correctness)

OCR Backends

Language Bindings

15 language bindings via the "alef" polyglot binding generator (alef.toml): Rust, Python, Node.js, Go, Java, C#, Ruby, PHP, Elixir, Dart, Swift, Zig, WASM, Kotlin, C FFI. The alef system scans Rust source files and emits idiomatic bindings per language.

Code Intelligence

371 programming languages via tree-sitter, with dynamic loading on native platforms.

Embeddings & ML

Dense (ONNX/static), Sparse (SPLADE), Late-interaction (ColBERT/MaxSim), with reranking. NER via ONNX, Candle, or LLM. Layout detection, captioning, summarization, translation, classification, QR code detection, auto-rotate, document orientation.

Deployment Modes

Key Numbers

Licensing

Dual-licensed: MIT OR Apache-2.0 (unlike Kreuzberg's Elastic License 2.0 restriction).


Source: raw/xberg Last updated: 2026-08-07