Instructions to use AutomatosX/AXDocLayout-M-v1.2-MLX-AXQ-MXFP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use AutomatosX/AXDocLayout-M-v1.2-MLX-AXQ-MXFP8 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download AutomatosX/AXDocLayout-M-v1.2-MLX-AXQ-MXFP8 --local-dir AXDocLayout-M-v1.2-MLX-AXQ-MXFP8
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
AXDocLayout-M v1.2 — MLX AXQ MXFP8
Apple Silicon MLX Metal document layout detection. This model-specific AXQ
bundle uses native MXFP8/group 32 selected linear weights, FP16 convolution
weights, and FP32 normalization and sensitive box/classification projections.
It derives from the published AXDocLayout-M v1.2 FP32 weights. The architecture
is RT-DETRv2 rtdetrv2_r50vd_m, with 11 public layout classes and 1024 letterboxing.
The checkpoint is 70.86 MB, approximately 52% smaller than the 146.77 MB FP32 source. This release targets checkpoint storage reduction. A material latency improvement was not established by the matched development screen.
Precision and inference source
41 linear weight tensors are physically packed with native MLX MXFP8, using 32-element groups. 101 convolution weight tensors are FP16. Normalization, class/box heads, query-position, sampling-offset and attention-weight projections retain FP32. Activations remain floating point; there is no INT8 or activation-FP8 claim. The bundled runtime uses native MLX Metal kernels. The retained source checkpoint structure includes unused later decoder state; the published inference graph executes the same first three decoder layers.
AXQ identifies AXQuant 2.3.0 conversion lineage and packing policy. Complete
model-specific inference source is included under inference/. Use this source
to load the checkpoint. The general AXQuant conversion CLI has no registered
RT-DETRv2 adapter; no general adapter or certification claim is made here.
Requirements
Apple Silicon macOS with working MLX 0.32.4 Metal, Python 3.12 or 3.13, NumPy, Pillow and safetensors. Tested on M2 Ultra, Python 3.12.13, MLX 0.32.4, NumPy 2.5.4 and safetensors 0.8.0. PyTorch and AXQuant are not inference dependencies. The loader requires Metal and the immutable weight revision, verifies all required file digests and 864 tensor contracts, and rejects unavailable Metal execution. Other hardware/software combinations require local validation.
Development results
The following aggregate measurements use internal development evaluations, not independent held-out acceptance. AP averages IoU thresholds 0.50:0.95; AP50, AP70 and AP90 use their respective IoU thresholds. Scores are percentages. Small AP differences do not establish an accuracy improvement.
| Runtime | AP | AP50 | AP70 | AP90 |
|---|---|---|---|---|
| MLX FP32 reference | 76.2383 | 90.9897 | 86.8844 | 55.8987 |
| MLX AXQ mixed MXFP8 | 76.3551 | 90.9756 | 86.9060 | 56.0502 |
| Additional internal evaluation | FP32 AP | Mixed MXFP8 AP | Change |
|---|---|---|---|
| A | 90.8594 | 90.7918 | -0.0676 |
| B | 66.6846 | 66.9096 | +0.2250 |
Reference and candidate use matching inputs within each paired evaluation. Exact input reproduction across platforms was not established. Evaluation definitions are private, so these numbers are not independently reproducible benchmarks and must not be combined with other evaluation contexts. They do not establish fitness for every document domain.
Measured API latency
M2 Ultra, batch one. The timed call is predict(PageImage): validated decoded RGB through
CPU PageStructure, including letterboxing, normalization, transfers, inference
and postprocessing. File decoding, caller-side PageImage construction, IPC,
initialization and JSON serialization are excluded.
| p50 ms/page | p95 ms/page | Mean ms/page | Serial pages/s |
|---|---|---|---|
| 53.558 | 54.206 | 53.535 | 18.68 |
These measurements describe this hardware/runtime combination; validate application latency on the deployment machine. They do not establish a cross-hardware comparison with a CUDA implementation.
Input and output
Provide one decoded HWC uint8 RGB page through PageImage. The runtime resizes
the long edge to 1024, preserves aspect ratio, uses bilinear interpolation and
white padding, and normalizes to NCHW float32 in [0,1] under rgb-letterbox-1024/1.
predict applies the default 0.30 score floor, removes reserved/invalid labels,
clips and maps boxes back to original-raster pixel coordinates.
The output schema is ax-doclayout.detection/1, taxonomy ax-doclayout-11/1.
Coordinates are half-open xyxy pixel edges, top-left origin, x right/y down.
Index 0 is reserved. Public class IDs are:
| ID | Label |
|---|---|
| 1 | caption |
| 2 | footnote |
| 3 | formula |
| 4 | list_item |
| 5 | page_footer |
| 6 | page_header |
| 7 | picture |
| 8 | section_header |
| 9 | table |
| 10 | text |
| 11 | title |
Use and limitations
Validate on representative pages before deployment. Small regions, uncommon layouts and boundary precision need review. Confidence scores are not guarantees. The detector takes page rasters. PDF handling, OCR, text extraction, reading order/hierarchy and table-cell reconstruction belong to separate components. Larger batches and throughput under concurrent loads were not qualified here. The accompanying runtime is separate from the CUDA inference package.
License and provenance
Weights and derivative inference source are AGPL-3.0-only. See LICENSE and
NOTICE for the terms and preserved Apache-2.0 component notices. The FP32
source is AutomatosX/AXDocLayout-M-v1.2 at immutable weight commit
7efd000fc7a1ef50ed7913835f2d8f10f30dc8e3. No corpus or training procedure is
included. The root README supplies immutable source/weight installation steps.
MLX format reference: https://ml-explore.github.io/mlx/build/html/python/_autosummary/mlx.core.quantize.html
Immutable installation and inference
Install the download helper:
python -m pip install "huggingface-hub>=0.36,<2"
Install the verified source snapshot:
import subprocess
import sys
from huggingface_hub import snapshot_download
source = snapshot_download(
"AutomatosX/AXDocLayout-M-v1.2-MLX-AXQ-MXFP8",
revision="fb230be55d3b015226f8d602131ab010ee5d182c",
allow_patterns=["inference/**"],
token=False,
)
subprocess.check_call([
sys.executable, "-m", "pip", "install", source + "/inference"
])
Detect on a decoded RGB page:
import numpy as np
from PIL import Image
from ax_doclayout_mlx import PageImage, load_model
model = load_model(revision="843b258c6970804922889e1df3205854eb790cde")
with Image.open("page.png") as image:
rgb = np.asarray(image.convert("RGB"), dtype=np.uint8)
result = model.predict(PageImage(rgb=rgb, page_index=0))
print(result.to_json())
The source binds this exact weight commit. Floating references and other weight revisions are rejected. Inputs stay in the local process; the helper only downloads the verified inference bundle anonymously.
- Downloads last month
- 24
Quantized
Model tree for AutomatosX/AXDocLayout-M-v1.2-MLX-AXQ-MXFP8
Base model
AutomatosX/AXDocLayout-M-v1.2-CUDA-TF32