# huggingface/swift-coreml-transformers

Swift Core ML 3 implementations of GPT-2, DistilGPT-2, BERT, and DistilBERT for Question answering. Other Transformers coming soon!

Repository: https://github.com/huggingface/swift-coreml-transformers
Canonical: https://ross.abutalabs.com/products/swift-coreml-transformers
Language: Swift
License: Apache-2.0
License Family: permissive
Archived: true
Last push: 2023-11-24T19:48:07+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 2624, "days_push": 1013, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1682, forks 176 (observed 2026-08-28T04:05:21.789307+00:00)

## What it is
A Swift library with Core ML implementations of GPT-2, DistilGPT-2, BERT, and DistilBERT, including tokenizers and demo apps for on-device text generation and question answering. The repository has been archived and is no longer maintained, with swift-transformers as its successor.

## Use cases
- run GPT-2 text generation on an iPhone with Core ML
- implement BERT question answering on-device in Swift
- convert PyTorch transformer models to Core ML format
- use a WordPiece tokenizer in a Swift app
- build a demo app for on-device NLP inference

## When to choose
- you need to run GPT-2 or BERT inference fully on-device in an Apple app
- you want reference Swift implementations of transformer tokenizers and decoding strategies
- you are targeting older Core ML 3 tooling or studying archived example code

## When to avoid
- you need an actively maintained library - use huggingface/swift-transformers instead
- you need modern transformer architectures beyond GPT-2 and BERT
- you require server-side or GPU-cluster inference rather than on-device Core ML

## Facets
- artifact type: library
- maturity: abandoned
- function: machine-learning, nlp, llm-inference, parser
- domain: machine-learning, apple-ecosystem, deep-learning
- platform: -
- tags: core-ml, transformers, gpt-2, bert, on-device-inference, text-generation, question-answering, archived, natural-language-processing, swift, ios, macos, apple-ecosystem

## Member repositories
- huggingface/swift-coreml-transformers (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:21.789307+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:41:22.076980+00:00, confidence not recorded.
  - readme: https://github.com/huggingface/swift-coreml-transformers (fetched 2026-08-28T04:05:21.789307+00:00, sha 78de95a85950)
- Data as of 2026-08-30T08:39:29.467469+00:00.
