Views
No views yet
coreai-torch (LLMs: coreai.llm.export) into .aimodel bundles that run on the GPU or the Neural Engine, e.g. Qwen3-8B 4-bit decodes at 94 tok/s on an M4 Max GPU, MLX 90 under the same protocol (apple-silicon-llm-bench, macOS 27 beta, 2026-06).Mirror ofmlboydaisuke/GLiNER2-PII-CoreAI— the canonical repo (CoreAI Model Zoo). Updates land there first.
fastino/gliner2-privacy-filter-PII-multi
(Apache-2.0) on a multilingual mDeBERTa-v3 base
(278M), fused into one static Core AI graph; the tokenizer, schema linearization, and span
decode run in the Swift host.Uncontested on iPhone. An on-device GLiNER2 already exists (GLiNER2Swift) but it is macOS-CPU / MLX only. This runs the GPU on iPhone (and, AOT-compiled, the ANE) — the first GLiNER on Apple Silicon's accelerators.
InformationExtractor
downloads this bundle once, then runs fully offline:1import CoreAIKitEmbeddings
2
3let extractor = try await InformationExtractor(model: .gliner2PII)
4
5// zero-shot: any labels you want, decided at call time
6let entities = try await extractor.extract(
7 from: "Contact Dr. Sarah Johnson at sarah.j@acme.com or +1-415-555-0142.",
8 entities: ["person", "email", "phone number"])
9// ["person": ["Sarah Johnson"], "email": ["sarah.j@acme.com"], "phone number": ["+1-415-555-0142"]]
10
11// or redact in place
12let clean = try await extractor.redact(
13 "SSN 123-45-6789, card 4111 1111 1111 1111.",
14 entities: ["social security number", "credit card number"])
15// "SSN [SOCIAL SECURITY NUMBER], card [CREDIT CARD NUMBER]."forward(input_ids[1,256], attention_mask[1,256], text_word_idx[1,96], schema_idx[1,17]) → span_scores[1,16,96,8]. Inside: mDeBERTa-v3 (disentangled attention, exported
at a fixed shape so the relative-position buckets gather cleanly) → "first" sub-word pooling →
SpanMarker → CountLSTM → einsum → sigmoid. MMAX=16 labels, T=96 words, span width K=8.input_ids (( [P] entities ( [E] l0 [E] l1 … ) ) [SEP_TEXT] …) and supplies the
gather indices, so a single converted bundle answers any schema up to MMAX.collate_fn_inference._format_spans.ext.extract at every tier — the Swift collator matches
Python collate_fn_inference (input ids + gather indices), the fp16 Core AI graph matches the fp32
reference (span-scores cos 0.999993), and the decoded entities match exactly:ext.extract.ext.extract exactly.GATE_RESULT: PASS. Model load ~1.8 s;
extraction ~22–32 ms per text (warm).macos/ — JIT .aimodel (fp16, ~582 MB) + tokenizer/ + extractor.json.ios/ — AOT-compiled h18p bundle (~823 MB; the device JIT is skipped) + tokenizer/ +
extractor.json.extractor.json carries the graph shapes and the GLiNER special-marker token ids (they live above
the Unigram vocab, so the host emits them directly). The tokenizer is the mDeBERTa SentencePiece model
declared as XLMRobertaTokenizer so swift-transformers routes it through its Unigram implementation.