fdem-4b-MLX-8bit

fdem fills a list of fields from one document: text, a page image or one PDF page. It returns one typed value per field. The model is trained to return null for a field the document does not state, and the response gives the reason. Use it through the fdem Python package, which builds the prompt the model was trained on and checks and converts its answers.

An 8-bit MLX conversion of fdem-4b for Apple Silicon Macs, made with mlx-vlm 0.7.9 from the bf16 release weights. It keeps the vision part, so it reads page images.

Usage

Run fdem in front of mlx-vlm's server as the client: fdem builds the trained prompt and checks and converts the answer. fdem needs the tokenizer and fdem.json from the bf16 repository (no weights).

git clone https://github.com/davidleitw/fdem && cd fdem && pip install . mlx-vlm==0.7.9
hf download davidleitw/fdem-4b --exclude "*.safetensors" --local-dir fdem-4b
python -m mlx_vlm.server --model davidleitw/fdem-4b-MLX-8bit --port 8080
# in a second terminal, once the server is up:
fdem-serve --model fdem-4b --backend chat --server-kind mlx_vlm --server-url http://127.0.0.1:8080/v1      # fdem API on :8000

Leave mlx_vlm.server's --enable-thinking off. In Python: Extractor.chat("fdem-4b", server_url="http://127.0.0.1:8080/v1", server_kind="mlx_vlm"). Confidence is null when the server returns no per-token log-probabilities, and a min_confidence threshold then rejects every filled value.

Requests to port 8000 are the same as for fdem-4b.

API reference: docs/api.md. Recipes: docs/cookbook.md.

Scores

Measured on this variant itself, on the fdem benchmark, with fdem as the client. Do not assume the bf16 scores of fdem-4b. "Same answer as bf16" is the share of fields where this variant's answer equals the bf16 model's.

Set Right Wrong Blank Filled empty fields Same answer as bf16
Held-back, English (2,957 stated / 218 empty) 2,895 33 29 9 / 218 99.6%
Held-back, Chinese DRCD (948) 889 32 27 - 99.4%
Held-back, Japanese JaWildText (1,077 / 156) 1,048 24 5 8 / 156 99.8%
Real-usage (1,757 / 389) 1,574 119 64 21 / 389 98.6%

Speed and peak memory, measured on a Mac mini (Apple M4, 16 GB, macOS 15.6) with mlx-vlm 0.7.9, one request at a time over the 933 held-back documents (text and page images, as the benchmark gives them): 0.08 documents per second, a mean of 12.1 s per document (total time divided by documents; mlx-vlm logs no per-request times, so there is no median), and a peak memory footprint of 7.2 GiB of unified memory for the mlx-vlm server and the fdem client together. All tables: docs/results.md.

Intended use

Pulling typed fields (names, numbers, dates, times, durations, lists and tables) out of invoices, receipts, forms, contracts, statements, filings, notices and web pages, where an empty answer is better than a guessed one. Check the answers that matter: spans, null_reasons and confidence in each response point to the ones worth a second look.

Out of scope: decisions about people made without human review (credit, hiring, benefits), identifying people in documents, and multi-page reasoning across a whole PDF.

Limitations

  • One page per request. Up to 20 fields, 200,000 characters of text and 16,384 tokens per request. Field names must be English.
  • Measured on English, Chinese (mostly Traditional) and Japanese (receipts as text). Other languages are untested.
  • confidence comes from token probabilities; use it to sort answers for review, not as the chance of being right.
  • Scores hold only with fdem building the prompt. Calling the weights with your own prompt, directly or through mlx-vlm's own API, is not measured. A request with no system message gets a default instruction prompt from the chat template instead, and that is not the trained fdem prompt either.
  • A compressed variant can give a different answer from the bf16 model on some fields; the table above says how often.

Licence

The weights are released under Apache-2.0, the licence of the base model Qwen3.5-4B (also Apache-2.0). The training data and training code are not part of this release. The benchmark documents keep their sources' licences, listed in the benchmark README.

Citation

@software{lei2026fdem,
  author  = {Lei, David},
  title   = {{FDEM}: Field-level Data Extraction Model},
  version = {0.1.0},
  year    = {2026},
  url     = {https://github.com/davidleitw/fdem}
}
Downloads last month
17
Safetensors
Model size
5B params
Tensor type
U32
·
BF16
·
F32
·
MLX
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for davidleitw/fdem-4b-MLX-8bit

Finetuned
Qwen/Qwen3.5-4B
Quantized
(5)
this model

Collection including davidleitw/fdem-4b-MLX-8bit