lift README

The project's README from github.com/datalab-to/lift. As one markdown file: README.md.

Datalab Logo

Datalab

State of the Art models for Document Intelligence

Code License Model License Discord

Homepage Docs Public Playground


lift

lift extracts structured JSON from PDFs and images by passing a schema. It's a 9B vision model that returns a JSON object matching your schema, with schema-constrained decoding guaranteeing valid output.

lift extracting schema-aligned JSON from an invoice Extraction accuracy benchmark

Try lift on Datalab

Our managed platform runs improved extraction with higher accuracy than the open weights, plus per-field verification, citations, and confidence scores.

If you have high volume workloads, we offer a batch processing service that has processed 1B+ pages per week.

Get started with $20 in free credits per month — sign up - takes under 30 seconds - or try lift in our public playground.

Commercial self-hosting requires a license — see Commercial usage. For on-prem licensing, contact us.

Features

Quickstart

The easiest way to start is with the CLI tools:

pip install lift-pdf

# With vLLM (recommended, lightweight install)
lift_vllm
lift_extract input.pdf ./output --schema schema.json

# With HuggingFace (requires torch)
pip install lift-pdf[hf]
lift_extract input.pdf ./output --schema schema.json --method hf

Benchmarks

Evaluated on a 225-document extraction benchmark (6–64 pages per document, ~11,000 scored fields) with adversarial cases planted throughout: cross-page values, exhaustive lists, fields that must be left null, near-miss distractors, multi-source aggregation. Scoring is deterministic exact-match against ground truth (numeric tolerance, normalized strings).

All models receive the same rendered page images, and extract each document in a single pass.

Model Size Field accuracy Full-document accuracy Median latency* Features
Datalab API — 95.9% 44.4% 30.8s Citations + Verification
Gemini Flash 3.5 — 91.3% 40.0% 28.1s
lift 9B 90.2% 20.9% 9.5s
Azure Content Understanding — 83.4% 22.2% 73.7s Citations
NuExtract3 4B 81.5% 8.4% 8.3s
Qwen3.5-9B 9B 76.32% 24.0% 16.8s

* Per document, 8 concurrent requests. Local models (lift, Qwen3.5-9B, NuExtract3) served with vLLM on a single GPU; Gemini, Datalab, and Azure via API. Latency varies with hardware and load - treat as relative, not absolute.

Latency benchmark

Hosted models with verification, citations, and confidence scores are available via the Datalab API - test in the playground.

Installation

Package

# Base install (for vLLM backend)
pip install lift-pdf

# With HuggingFace backend (includes torch, transformers)
pip install lift-pdf[hf]

# With the Schema Studio app
pip install lift-pdf[app]

# With all extras
pip install lift-pdf[all]

If you're using the HuggingFace method, we also recommend installing flash attention for better performance.

From Source

git clone https://github.com/datalab-to/lift.git
cd lift
uv sync
source .venv/bin/activate

Usage

Schemas

A schema is standard JSON Schema. Keep it simple — string, number, integer, boolean, arrays of those, arrays of objects, and nested objects are all supported. Avoid enum, anyOf/oneOf, $ref, and additionalProperties; the schema-constrained decoder skips schemas it can't compile, which weakens the output guarantee.

{
  "type": "object",
  "properties": {
    "invoice_number": {"type": "string", "description": "Invoice identifier"},
    "total": {"type": "number", "description": "Total amount due"},
    "line_items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {"type": "string"},
          "amount": {"type": "number"}
        }
      }
    }
  },
  "required": ["invoice_number", "total"]
}

Write a description for any field whose name isn't self-explanatory. Mark a field required only when it must appear; fields genuinely absent from a document come back null.

CLI

Process single files or entire directories:

# Single file, with the vLLM server (see below for how to launch it)
lift_extract input.pdf ./output --schema schema.json

# Inline JSON schema
lift_extract scans/ ./output --schema '{"type": "object", "properties": {...}}'

# A schema saved by name in the schemas/ directory, limited to some pages
lift_extract input.pdf ./output --schema invoice --page-range 0-5,8

# Process a whole directory with the local HuggingFace model
lift_extract ./documents ./output --schema schema.json --method hf

CLI Options:

Output Structure:

For each processed file, lift_extract writes to the output directory:

Python

from lift import extract

# schema: a dict, a path to a .json file, an inline JSON string, or a library name
result = extract("document.pdf", "schema.json")
if result.extraction is not None:
    data = result.extraction  # dict matching the schema

Pass a reused model - from lift.model import InferenceManager; model=InferenceManager(method="hf") - to load weights in-process and reuse them across calls, and page_range="0-5" to limit PDF pages. Set VLLM_API_BASE to target a remote server.

Schema Studio

Launch the interactive app to build, save, and test extraction schemas against your documents (requires pip install lift-pdf[app]):

lift_app

vLLM Server

For production deployments or batch processing, launch the vLLM server:

lift_vllm                # defaults to H100 settings
lift_vllm --gpu a100-80  # tune batch settings for your GPU

This launches a Docker container with optimized inference settings, automatically scaling batch size to your GPU's VRAM. Supported GPUs: h100, a100-80, a100/a100-40, l40s, a10, l4, 4090, 3090, t4.

You can also start your own vLLM server with the datalab-to/lift model.

Configuration

Settings can be configured via environment variables or a local.env file:

# Model settings
MODEL_CHECKPOINT=datalab-to/lift
MAX_OUTPUT_TOKENS=12384
TORCH_DEVICE=cuda:0     # pin the HF backend to a device

# vLLM settings
VLLM_API_BASE=http://localhost:8000/v1
VLLM_MODEL_NAME=lift
VLLM_GPUS=0

Commercial usage

This code is Apache 2.0, and our model weights use a modified OpenRAIL-M license (free for research, personal use, and startups under $5M funding/revenue, cannot be used competitively with our API). To remove the OpenRAIL license requirements, or for broader commercial licensing, visit our pricing page here.

Credits

Thank you to the following open source projects:

lift (datalab-to/lift)

Searching Database…

1.2K ·GitHub
这是什么?lift 是一个开源的 9B 视觉语言模型及工具包,通过匹配你提供的 schema 从 PDF 和图片中提取结构化 JSON 数据,并使用 schema 约束解码来保证输出有效。
它是模型、命令行工具,还是 Python 库?三者皆是:一个可在本地或通过 vLLM 运行的 9B 视觉语言模型,通过 CLI 即可处理单个文件或目录;一个供进程内使用的 Python 库(InferenceManager);还有一个用于构建 schema 的 Streamlit 应用 Schema Studio。
怎么让它跑起来?用 pip 安装软件包(pip install lift-pdf,需要 Schema Studio 就装 lift-pdf[app])或从源码构建,然后运行 CLI,用 --schema 指向一个 JSON schema 文件,并选择 --method hf 或 vllm 进行推理。
提取准确度怎么样?在作者的 225 份文档基准测试中,lift(9B)的字段准确率为 90.2%,但全文档准确率(所有字段全对)只有 20.9%,中位延迟 9.5 秒——比托管的 Datalab API 更快,但完美程度不如它稳定。
许可条款是什么?代码采用 Apache 2.0,但模型权重使用修改版 OpenRAIL-M 许可证:可用于研究、个人使用以及融资/营收低于 500 万美元的初创公司,但不能用于与 Datalab 自家 API 构成竞争的场景,更广泛的商业自托管需要另行获取许可。
Schema Studio 是什么?它是 lift 自带的一个 Streamlit 应用,用于在你自己的文档上交互式地构建、保存和测试 JSON 提取 schema,之后再进行大规模运行。
不自行托管 lift 的话有什么替代选择?Datalab 提供托管 API,准确率高于开源权重,带逐字段校验、引用和置信度评分,另外每月有 20 美元免费额度,还有公开的 playground,无需安装任何东西就能试用。
它支持什么样的 JSON schema?支持含有字符串、数字、布尔值、数组和嵌套对象的标准 JSON Schema,但应避免使用 enum、anyOf/oneOf、$ref 和 additionalProperties,因为 schema 约束解码器会跳过它无法编译的 schema。
Creator
datalab-to
Size
1.4 MB
Stars
1.2K
Age
4mo
Commits · 90 Days