/ Модель

Характеристики

Лицензия
Apache 2.0
Базовая модель
granite-docling-258M
Опубликована
16 окт 2026

granite-docling-258M-coreai

Изображение и текст → текст7 профессий

Перенос IBM Granite Docling 258M для локального преобразования изображений страниц документов в структурированные DocTags на устройствах Apple.

0скачиваний за 30 дней0лайковвеса обновлены16 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

smdesai/granite-docling-258M-coreai — перенос модели IBM Granite Docling 258M в формат Apple Core AI для распознавания и преобразования страниц документов на устройствах Apple. Модель принимает изображение страницы и генерирует DocTags со структурой документа: текстом, координатами элементов, таблицами, формулами, фрагментами кода и списками. Предназначена для локальной обработки документов без передачи изображений на сервер.

Архитектура включает 30-слойный декодер и визуальный энкодер SigLIP2 с коннектором; декодер выполняется на Neural Engine, а энкодер и выходная проекция — на GPU. В репозитории приведены варианты контекста декодера 1024, 2048, 3072 и 4096 токенов. Сборки aimodelc подготовлены для чипа A19 Pro и проверены на iPhone 17 Pro; на других чипах требуется компиляция исходных файлов. Для тестовой страницы точность текста и формул совпала с запуском базовой модели FP32, однако это ограниченная проверка.

Модель основана на ibm-granite/granite-docling-258M и распространяется по лицензии Apache-2.0. Производительность и работоспособность подтверждены только для указанной конфигурации; в README также отмечен риск повторяющихся циклов при жадном декодировании.

Сценарии применения

  • извлечение текста и структуры из фотографий страниц документов
  • распознавание таблиц, формул, списков и блоков кода в документах
  • преобразование страниц документов в структуру Docling на iPhone
  • локальный разбор страниц научных статей

Ограничения

Скомпилированные файлы подготовлены и проверены для A19 Pro; для других чипов требуется самостоятельная компиляция исходников. Точность проверена на ограниченном числе примеров, а жадное декодирование может зацикливаться на некоторых страницах.

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

granite-docling-258M — Core AI

IBM granite-docling-258M for Apple's Core AI runtime (iOS 27 / macOS 27). It turns an image of a document page into DocTags (text, layout boxes, tables, formulas, code, lists), entirely on device. The decoder runs on the Neural Engine; the vision encoder and the final norm + vocabulary projection run on the GPU.

The compiled .aimodelc files are built for A19 Pro (h18p) and were tested on iPhone 17 Pro. For any other chip, compile the portable sources in source/ yourself (see below).

DevicePageDecodeMemory
iPhone 17 Profull arXiv page, 1,759 tokens117 tok/s~400 MB
iPhone 17 Protable page, 400 tokens130 tok/s~400 MB

Accuracy: on the arXiv sample page, the generated document text and formulas match an FP32 run of the base model; a few layout coordinates differ by one unit (FP16 near-ties). Output is identical across repeated runs.

Files

FileSizeRole
decoder.h18p.aimodelc215 MB30-layer decoder, Neural Engine, compiled for h18p
vision.h18p.aimodelc179 MBSigLIP2 vision tower + connector, GPU, compiled for h18p
head.h18p.aimodelc110 MBfinal norm + vocabulary projection, GPU, compiled for h18p
embed_tokens_fp16.bin110 MBtoken embedding table, [100352, 576] float16, row-major (looked up on the CPU)
tokenizer.json6.8 MBtokenizer (identical to the base model's)
granite_docling_coreai_bundle.json4 KBasset hashes, toolchain and export configuration
source/decoder.aimodel, source/vision.aimodel, source/head.aimodel494 MBportable sources of the three models
source/granite_docling_coreai.json<1 KBexport configuration

Exported with coreai-torch 0.4.3 (torch 2.13) and compiled with coreai-build 3605.6.3.

Compiling for another chip

xcrun coreai-build compile source/decoder.aimodel --platform iOS --architecture <arch> --preferred-compute neural-engine --output out
xcrun coreai-build compile source/vision.aimodel  --platform iOS --architecture <arch> --preferred-compute gpu --output out
xcrun coreai-build compile source/head.aimodel    --platform iOS --architecture <arch> --preferred-compute gpu --output out

coreai-build names its output <name>.<arch>.aimodelc, the same scheme as the files here. Only the h18p build has been validated. Loading the raw .aimodel sources directly on a phone works but takes minutes to specialize, so ship compiled assets.

Model interfaces

ModelFunction(s)InputsOutputs
Visionmainimage_tile [1, 3, 512, 512] fp16, RGB in 0…1 (normalization is inside the model)image_embeds [1, 64, 576] fp16
Decoderextend_{ctx}_{q}, ctx ∈ {1024, 2048, 3072, 4096}, q ∈ {8, 64}transformer_input [1, q, 1, 576] fp16, position_ids [1, q] uint16, in_step [1] int32, causal_mask [1, ctx, 1, q] fp16out_logits [1, q, 1, 576] fp16 (pre-norm hidden states, despite the name)
Headmainhidden [1, 1, 576] fp16logits [1, 1, 100352] fp16

The decoder keeps its KV caches as runtime state: key_cache and value_cache, each [30, 1, 192, 1, ctx] fp16. Allocate both once from the 4096 function's state descriptors and pass prefix views ([..., 0..<ctx]) to the smaller buckets, so the cache carries over when the context grows. Always call the smallest bucket that holds every position written so far: the Neural Engine reads the whole padded cache each step, so smaller buckets decode faster.

Running it

  1. Tile the page with Lanczos resampling: resize so the longest edge is 2048 (also when upscaling), keeping aspect ratio and rounding the short edge up to even; resize again so both edges are multiples of 512; cut 512×512 tiles row-major, then append the whole page resized to 512×512 as the global view.
  2. Encode each tile with the vision model: 64 embeddings per tile.
  3. Build the prompt (no BOS) and tokenize it with tokenizer.json:
    <|start_of_role|>user<|end_of_role|>
    for each tile row r, column c:  <fake_token_around_image><row_{r}_col_{c}> + <image>×64, then "\n" after each row
    \n<fake_token_around_image><global-img> + <image>×64 + <fake_token_around_image>
    Convert this page to docling.<|end_of_text|>\n<|start_of_role|>assistant<|end_of_role|>
    
    <image> is token 100270; row/column indices start at 1.
  4. Embed on the CPU: each token's row from embed_tokens_fp16.bin, or, for each <image> token, the next vision embedding (tile order, 64 rows per tile). Use the raw rows; any scaling is inside the decoder.
  5. Call the decoder. Each call covers the positions from the previous multiple of q up to the newest token: prefill with q = 64, decode with q = 8 (a decode call re-processes the earlier tokens of its 8-aligned window). For a call starting at position start with n real rows:
    • transformer_input rows 0…n−1 are the embeddings, the rest zero;
    • position_ids[j] = start + j; in_step = start;
    • causal_mask[0, c, 0, j] = 0 if j < n and c <= start + j, else −40000 (padding rows fully masked).
  6. Head: pass the decoder output row of the newest real token to the head; argmax of logits is the next token. Stop at <|end_of_text|> (100257), <end_of_utterance> or </doctag>.

Allocate input and output buffers once from the function descriptors and reuse them as output views; runtime-allocated outputs that are not released promptly grow memory on the phone. Greedy decoding can loop on some pages; stopping when a short token cycle repeats several times is a cheap safeguard.

Conversion notes

The decoder is re-authored in the Neural Engine layout from Apple's coreai-models examples (rank-4 tensors, 1×1 convolution projections, per-head attention, static entrypoints). The first prompt token develops residual activations of ~1.2×10⁵, which overflows FP16, so the residual stream is carried at 1/32 scale (folded into the weights) and RMSNorm is expressed as a LayerNorm that stays finite in FP16.

License and attribution

Apache 2.0, the same as the base model. All model weights are IBM's granite-docling-258M; this repository only changes their format. Please cite and credit IBM's model when you use it.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
3756610

0 моделей