DocLang

An open document format that a language model can read and write.

What it is

DocLang is an XML format for documents of any type, designed for the way a language model reads: a constrained vocabulary of about a thousand tokens, so that a model can emit it token for token. One file carries the structure of a document, its text, the layout of every element on the page, and the order a reader is meant to take them in. It is not a converter and not an API. The project’s own comparison is to JSON for data and HTML for the web.

PDF and DOCX were built for print and for editing, and a model working from them has to guess what a human would see. DocLang records it. Tables are written in OTSL, a compact table language, element positions sit on a 512-point grid normalized against the page, and every semantic element splits into a head that describes it and a body that holds it.

The two file types

A bare document is a .dclg: one XML file. A .dclx is an archive, an OPC zip holding document.xml together with optional page images under pages/ and pictures under assets/. The archive is what makes review possible, because the scan the model read travels with the text it produced. Segler opens both and Duckling writes both.

Who stands behind it

DocLang is a project of the LF AI & Data Foundation, developed under Joint Development Foundation Projects so that, in the project’s words, no single vendor controls the roadmap. IBM, NVIDIA, Red Hat, ABBYY and HumanSignal founded the working group. The specification and a Python reference toolkit are in doclang-project/doclang, licensed Apache-2.0, and the project’s home is doclang.ai.

The specification is still at 0.x, and early minor versions have not promised compatibility with each other. A tool that reads DocLang should say which version it targets. Segler validates against the specification as published and treats it as the authority; where they disagree the bug is Segler’s.

Who reads and writes it

Docling and ABBYY FineReader Engine write DocLang natively, according to doclang.ai, and docling.rs, the Rust port of Docling, writes and reads it too. The project publishes a browser viewer for looking at a document with its layout overlays, Duckling converts to it from a desktop window, and Segler is where a person corrects it. The ecosystem page lays these out side by side and says which to reach for.

Why it needs an editor

A format built for models is mostly written by them, and the documents that matter most, scanned contracts, old reports, forms, are the ones a model is likeliest to misread. When the corrected text goes on to feed a search index or a training set, a wrong cell is a wrong fact downstream. The cheapest place to catch it is beside the page it came from, which is the one thing Segler is for.