StackMap
Subscribe

contextgem vs docling-graph

Declarative LLM extraction from documents: describe Aspects and Concepts in plain language, get structured values back with paragraph- or sentence-level references and built-in justifications. — versus — Documents to validated knowledge graphs: Docling parses, an LLM or VLM fills Pydantic schemas, and you get a directed NetworkX graph with provenance, Cypher/CSV export and HTML views.

The curated verdict

Both fill typed schemas from documents with an LLM. docling-graph aims outward at a validated knowledge graph — entities and relations across a corpus; ContextGem deliberately stays inside one document, tying each extracted value back to the sentences that support it.

contextgemdocling-graph
Stars2.0k800
Forks18384
LanguagePythonPython
LicenseApache-2.0MIT
Last activity11 days ago5 days ago
Topicsocr, dataknowledge-graphs, ocr
Curated connections75

contextgem — the curator's take

Its thesis is explicitly anti-RAG: stop chunking and retrieving, put the whole document in a long context window and extract in place. You declare Aspects — the sections or themes worth pulling — and Concepts — the entities, booleans, numbers, ratings and JSON objects inside them — and the framework writes the prompts, builds the validation models, and returns every item with reference_paragraphs, reference_sentences and a justification. That provenance is the point: it makes contract and filing review defensible rather than merely plausible. Two limits it states about itself: no cross-document querying or corpus-wide retrieval, so reach for a real RAG framework there; and its detailed instruction style wants a model at gpt-4o-mini level or better, so 8B local models will struggle even though LiteLLM happily points it at Ollama.

docling-graph — the curator's take

Built for the domains where an approximate embedding is worthless — chemistry, finance, legal — because what you need is the exact edge between a compound and a reaction or an instrument and its dependency. Pydantic schemas make extraction validated rather than hopeful, template generation bootstraps those schemas from example documents or an OWL/RDFS ontology, the provenance ledger carries bounding-box geometry with no extra LLM calls, and graph fusion merges multiple graphs deterministically. Under the Linux Foundation AI & Data umbrella with the Docling project's engineering behind it. Caveats: you own the schema design, which is the actual work; VLM extraction needs the heavy `vlm` extra plus local GPU or a served model; and the output is a NetworkX graph you export, not a queryable graph database.