ModernBERT-Ja-130M Core ML / Apple Neural Engine (4D Block-Local)

Note (2026-11-30): This repository is the Core ML / ANE conversion of the base ModernBERT-ja-130m model only. It is NOT a JevLite model itself. JevLite decision models live in the jevlite-* repositories (jevlite-personal-ja-coreml, jevlite-swechat-ja, jevlite-swechat-en, jevlite-modernbert-base-coreml).

Apple Neural Engine (ANE) optimized Core ML (mlprogram, fp16, macOS26 target) conversion of sbintuitions/modernbert-ja-130m.

Optimization Details

  • 4D (B, C, 1, S) channels-first layout with Conv2d(1x1) projections and channels-first LayerNorm
  • Block-local sliding-window attention (block_size=128, window=128) for local layers and split-head attention for global layers so attention tiles stay in ANE on-chip SRAM
  • Precomputed static RoPE cos/sin and static local window masks; 1/sqrt(head_dim) folded into Wq weights
  • Outputs: last_hidden_state ([1, S, 512], fp16) for fixed sequence buckets 128 / 256 / 512 / 1024

Benchmark & Parity (Apple M2 Max 32 GB, macOS 26.6.2, CPU_AND_NE)

seq_len median latency throughput cached .mlmodelc load cosine sim vs PyTorch FP32 mean |err|
128 5.88 ms 170.0 req/s 0.056 s 0.999950 0.0236
256 8.05 ms 124.3 req/s 0.059 s 0.994968 0.0400
512 19.42 ms 51.5 req/s 0.068 s 0.999969 0.0182
1024 49.37 ms 20.3 req/s 0.079 s 0.999973 0.0176

Usage

import coremltools as ct
import numpy as np
from transformers import AutoTokenizer

tok = AutoTokenizer.from_pretrained("sbintuitions/modernbert-ja-130m")
m = ct.models.MLModel("modernbert-ja-130m-256.mlpackage",
                      compute_units=ct.ComputeUnit.CPU_AND_NE)
enc = tok("ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใฎ่‡ชๅพ‹ๅฎŸ่กŒใ‚’็ถš่กŒใ™ใ‚‹ใ‹็ขบ่ชใ—ใฆใใ ใ•ใ„ใ€‚",
          padding="max_length", truncation=True, max_length=256, return_tensors="np")
out = m.predict({
    "input_ids": enc["input_ids"].astype(np.int32),
    "attention_mask": enc["attention_mask"].astype(np.int32),
})
hidden = out["last_hidden_state"]  # [1, 256, 512]

License

MIT (inherits upstream sbintuitions/modernbert-ja-130m license).

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

Model tree for eightman999/modernbert-ja-130m-coreml-ane

Quantized
(17)
this model

Collection including eightman999/modernbert-ja-130m-coreml-ane