ModernBookNLP speaker attribution, Core ML

A Core ML conversion of the quotation-attribution model in ModernBookNLP (ModernBERT_T2000.safetensors: a ModernBERT-large encoder fine-tuned to find who speaks each quotation in fiction), for on-device use on iPhone and iPad.

Files:

  • ModernBookNLP_L2560_pal6.mlpackage: the encoder, a fixed 2,560-token window, weights palettized to 6 bits (k-means, grouped by 16 channels), float16, iOS 18+. It runs almost entirely on the Neural Engine. Input input_ids and attention_mask (int32, 1ร—2560, pad id 50283); output hidden (1ร—2560ร—1024). Attention masks use -1e4 instead of float32's minimum, so float16 padding rows stay finite.
  • speaker-head.bin: the scoring head, float16, little-endian: W0 (2048ร—4096, batch norm folded in), b0 (2048), W3 (2048), b3 (1). Score(quote, mention) = W3 ยท GELU(W0 ยท [h(q_start), h(q_end), h(m_start), h(m_end)] + b0) + b3.
  • tokenizer.json: ModernBERT's tokenizer, unchanged.

Quality: on four PDNC novels (4,526 quotations), the converted model's speaker picks agree with the PyTorch original on 98.2% of quotations, with the same accuracy (75.3% vs 75.1% speaker correct, using BookNLP's pipeline).

Credits and licenses: ModernBookNLP by its authors (gasmichel, MIT); ModernBERT by Answer.AI and LightOn (Apache-2.0); BookNLP by David Bamman (MIT, see LICENSE-BookNLP). Converted by Quack Later; the conversion is released under the MIT license.

Downloads last month
12
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for quacklater/ModernBookNLP-CoreML

Quantized
(34)
this model