Swift Transformers 1.0: Hugging Face powers on-device AI on Apple | Keryc
Hugging Face has just released swift-transformers 1.0, a version that signals stability for developers who want to run language and multimodal models on Apple devices. Can you imagine running an LLM directly on an iPhone without relying on the cloud? That reality is getting closer every day. (huggingface.co)
What is swift-transformers?
swift-transformers is a Swift library designed to reduce the friction of using local models on Apple Silicon, including iPhone and Mac. It’s not just a wrapper: it brings components that Core ML or MLX lack so on-device inference becomes practical. Key pieces include Tokenizers, a Hub to download and cache models, and modules for Models and Generation that make running models converted to Core ML easier. ()
Why does this matter to you? Because converting and preparing models for on-device use has a lot of fiddly details: tokenization, chat templates and download management. swift-transformers handles those so you can focus on the user experience.
How the community uses it
The library is already part of the ecosystem of apps and demos for Apple. Some projects using it include:
mlx-swift-examples from Apple, showing how to run LLMs and VLMs with MLX.
WhisperKit, a speech-recognition framework optimized for Apple Silicon, which uses Hub and Tokenizers.
FastVLM and demos like the native SmolVLM2 app.
These examples show adoption isn’t just theoretical: there are real voice, vision and text apps that benefit from local execution. (huggingface.co)
What's in version 1.0
Tokenizers and Hub are now first-class modules; you can depend only on what you need.
Collaboration with John Mai to improve swift-jinja, the chat templating library, with big speed gains.
Adoption of the Modern Core ML APIs, with support for stateful models and MLTensor, which reduces custom math code.
Improvements in tests, documentation and full support for Swift 6.
Heads up: v1.0 includes breaking changes. If you use the Core ML components, it’s worth contacting the team and reviewing the migration guide they’ll prepare. (huggingface.co)
Quick example
Here’s a condensed example showing how Tokenizers can format input with a tools template for an LLM:
import Tokenizers
let tokenizer = try await AutoTokenizer.from(pretrained: "mlx-community/Qwen2.5-7B-Instruct-4bit")
let weatherTool = [
"type": "function",
"function": [
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": ["type": "object", "properties": ["location": ["type": "string"]], "required": ["location"]]
]
]
let tokens = try tokenizer.applyChatTemplate(
messages: [["role": "user", "content": "What's the weather in Paris?"]],
tools: [weatherTool]
)
This kind of example is available in the README and the Examples folder of the repository. (huggingface.co)
What's next
The team says they want to deepen integration with MLX and work on agentic use cases, which means exposing system resources to local workflows and making pre- and post-processing for LLMs and VLMs easier. In plain terms: they expect the experience of building native apps with AI to keep getting smoother. (huggingface.co)
If you’re an iOS developer or exploring on-device AI, this reduces many of the technical frictions from before. If you’re not a developer, it means more smart features that can run without sending your data to the cloud.
The 1.0 release of swift-transformers is a clear signal: on-device AI on Apple isn’t an experiment anymore, it’s a platform you can build products on. If you want to try it, contribute, or follow progress, check the repository and project documentation on Hugging Face. (huggingface.co)
Stay up to date!
Get AI news, tool launches, and innovative products straight to your inbox. Everything clear and useful.
Swift Transformers 1.0: Hugging Face powers on-device AI on Apple