AnyLanguageModel 1.0: One 12 months of Native Fashions on Apple Platforms

Date:

Share post:


Final November, we launched AnyLanguageModel on this weblog:
a drop-in substitute for Apple’s Basis Fashions framework
that permits you to select the mannequin and supplier your app makes use of.
We heard from app builders who have been inquisitive about native fashions
however weren’t all the time certain find out how to get began.
In addition they needed to keep away from the added complexity
of supporting a number of inference suppliers.
AnyLanguageModel grew out of that suggestions.

Native and hosted inference every have their strengths,
and each have a job in constructing this new era of clever apps.
A shared API makes it simpler to decide on the proper mannequin for every activity.

A yr and dozens of releases later,
AnyLanguageModel 1.0 is out,
together with swift-huggingface 1.0
and swift-xet 1.0.

Here is what modified, and what’s subsequent:


A drop-in appropriate API

The core thought of AnyLanguageModel stays the identical:
use the Basis Fashions API with the mannequin that matches your app.
To get began, change your import assertion:

- import FoundationModels
+ import AnyLanguageModel

The identical session code then works with the system mannequin,
with open-weight fashions by means of llama.cpp, MLX, and Core ML,
and with the hosted suppliers beneath.

Over the previous yr, we have added a number of main options:

  • Software calling works with each supplier.
  • Guided era works with each supplier, too,
    together with nested @Generable sorts and arrays of them.
  • Picture assist permits you to connect photos to prompts
    utilizing Basis Fashions 27’s syntax,
    together with once you use the system mannequin on iOS, macOS, and visionOS 27.

On OS 27, AnyLanguageModel additionally works with
any mannequin that conforms to Basis Fashions’ LanguageModel protocol,
together with Core AI fashions.

Alongside AnyLanguageModel, we have constructed out
swift-huggingface
and swift-xet
to deliver accelerated mannequin downloads from the Hub to Swift apps.


Hosted fashions, too

Assist for hosted fashions expanded this yr, too.
AnyLanguageModel now helps:

  • OpenAI’s Chat Completions and Responses APIs
  • Open Responses,
    for any supplier with a appropriate endpoint
  • Anthropic’s Messages API, with adaptive pondering and energy choices
  • Google’s Gemini API
  • Ollama
  • Non-public Cloud Compute, on OS 27
  • Hugging Face Inference Suppliers,
    and different OpenAI-compatible endpoints similar to OpenRouter,
    by means of a customized base URL

With Inference Suppliers,
you should utilize open-weight fashions which might be too large to run on the machine
with the identical session code:

let mannequin = OpenAILanguageModel(
    baseURL: URL(string: "https://router.huggingface.co/v1/")!,
    apiKey: ProcessInfo.processInfo.setting["HF_TOKEN"]!,
    mannequin: "openai/gpt-oss-120b",
    apiVariant: .chatCompletions
)

Hosted suppliers get the identical options as native fashions:
guided era, software calling with streaming,
and token utilization on responses.

Reasoning is now a part of the transcript too.
Once you swap suppliers,
reasoning blocks are routinely omitted from requests if the brand new supplier cannot replay them.

API keys come from a closure as a substitute of a string,
so your app can fetch short-lived tokens from your personal server.
The README
explains when to let folks deliver their very own keys
and when to route requests by means of a proxy.

AnyLanguageModel additionally runs on Linux,
so the identical code can work on a server.


Open-weight fashions obtained higher

Whereas we have made native fashions simpler to make use of,
the fashions themselves have change into extra succesful,
making the small ones a great place to start out.
Listed here are a number of the most downloaded fashions on the Hub proper now:

  • Gemma 4 E2B from Google,
    in GGUF, about 3.4 GB at Q4_0 with quantization-aware coaching.
  • LFM2.5 2.6B from Liquid AI,
    in GGUF, about 1.7 GB at Q4_K_M.
  • Qwen3.8 27B for MLX from Alibaba,
    about 16 GB at 4 bits.

The primary two match on an iPhone,
and Qwen3.8 27B runs on a Mac with 32 GB of reminiscence or extra.
Deciding on the MLX mannequin takes one line:

let mannequin = MLXLanguageModel(modelId: "mlx-community/Qwen3.8-27B-4bit")

And if in case you have 4 maxed-out Mac Studios useful,
GLM-5.3 from Z.ai takes about 1.5 TB in BF16.
For the remainder of us, it is out there by means of Inference Suppliers.


Upgrading to 1.0

dependencies: [
    .package(
        url: "https://github.com/huggingface/AnyLanguageModel",
        from: "1.0.0",
        traits: ["MLX"]
    )
]

When you’re upgrading an present app, see the migration steering within the
AnyLanguageModel,
swift-huggingface,
and swift-xet launch notes
for assist updating your code.

Group suggestions and contributions have formed a number of of our main options.
Thanks to everybody who contributed
for serving to make AnyLanguageModel extra helpful to app builders.


What’s subsequent

Language fashions have confirmed to be a strong software
for constructing intelligence into merchandise.
They’re additionally considered one of many sorts of fashions builders can put to work.
We’re excited to deliver the identical strategy to extra capabilities:
acquainted Swift APIs with a selection of fashions working on the machine.
Coming quickly: fashions that determine, and fashions that hear.


Hyperlinks



Supply hyperlink

LEAVE A REPLY

Please enter your comment!
Please enter your name here
Captcha verification failed!
CAPTCHA user score failed. Please contact us!

spot_img

related news

Apertus 1.5 Launch Notes

Our newest launch, Apertus 1.5, extends the 8B and 70B Apertus 1.0 fashions with picture/audio understanding, an...

Welcome Beam: a 501B open mannequin you’ll be able to personal, customise, and scale

Beam by Reflection is out on Hugging Face! It's the first mannequin from the brand new US...

Norway to Suggest Momentary Ban on AI Glasses in Chosen Locations – Unite.AI

Norway’s authorities will suggest a brief ban on the usage of AI glasses in chosen public locations and...

TorchNeuron: operating HF fashions on AWS Trainium is less complicated than ever

TorchNeuron offers a brand new native backend for PyTorch on AWS Trainium. Transformers, Diffusers and Kernels natively...