Loading…
Introducing AnyLanguageModel: One API for Local and Remote LLMs on Apple Platforms
Hugging FaceMattt
Summary
Apple developers frequently face integration friction when trying to support a mix of local and cloud language models across disparate APIs. To resolve this fragmentation, AnyLanguageModel introduces a unified Swift package that acts as a drop-in replacement for Apple's Foundation Models framework. The package standardizes interactions across local backends such as Core ML, MLX, and llama.cpp alongside cloud providers like Anthropic and OpenAI. To avoid dependency bloat from multi-backend support, the library employs Swift 6.1 package traits so projects only import the specific runtime engines they require. Furthermore, the library extends beyond current Foundation Models limitations by adding prompt image support for vision-language models.
Context
Apple developers face friction when integrating language models because local engines like Core ML and MLX, cloud services, and Apple's Foundation Models all require disparate APIs and setup requirements.
Approach / What changed
The author created AnyLanguageModel, a Swift package mirroring Apple's Foundation Models API as a drop-in replacement across local and remote backends. It uses Swift 6.1 package traits to selectively include dependencies such as Core ML, MLX, or llama.cpp, and extends the base API to support multimodal image inputs.
Takeaways
- AnyLanguageModel acts as a drop-in replacement for Apple's Foundation Models framework, enabling model swaps across Apple's system models, Core ML, MLX, llama.cpp, Ollama, and remote cloud APIs.
- To prevent dependency bloat, AnyLanguageModel leverages Swift 6.1 package traits so developers only import required backends like CoreML, MLX, or Llama while using URLSession for cloud providers by default.
- Because Apple's Foundation Models API lacks native prompt image support, AnyLanguageModel extends the interface ahead of official support to allow vision-language requests.
Related reading
Fine-tune Any LLM from the Hugging Face Hub with Together AI
Together AI and Hugging Face have introduced an integration enabling developers to fine-tune compatible Hugging Face Hub models directly on Together AI's managed infrastructure. To launch a fine-tuning job via the Python SDK, users provide a base model from Together's catalog as a configuration template alongside the target Hugging Face repository identifier. This base model template dictates GPU allocation, memory configuration, training pipelines, and inference setup for custom models with matching architectures and sizes. The workflow operates bidirectionally, pulling from public or token-authenticated private repositories and optionally pushing completed checkpoints back to the Hub upon completion. Geared toward CausalLM models under 100 billion parameters, the capability enables faster iteration cycles and domain adaptation without custom DevOps infrastructure.
Zain Hasan, Artem Chumachenko, Egor Timofeev, Max Ryabinin