llmfarm_core.swift  by guinmoon

Swift library for local LLM inference

created 1 year ago
266 stars

Top 96.9% on sourcepulse

GitHubView on GitHub
Project Summary

This Swift library provides a framework for loading and running large language models (LLMs) like Llama on macOS and iOS. It's designed for developers and researchers interested in on-device LLM inference, leveraging Metal for accelerated computation on Apple Silicon.

How It Works

The library is built upon ggml and llama.cpp, enabling efficient LLM execution. It supports various inference and sampling methods, including temperature, top-k, top-p, Tail Free Sampling (TFS), Locally Typical Sampling, Mirostat, and greedy decoding. The architecture is optimized for Apple's Metal framework for GPU acceleration, specifically targeting Apple Silicon hardware.

Quick Start & Requirements

  • Install via Swift Package Manager: https://github.com/guinmoon/llmfarm_core.swift
  • Requirements: macOS 13+, iOS 16+. Metal support requires Apple Silicon (Intel Macs are not supported for Metal).
  • See examples in the Demo Project.

Highlighted Details

  • Supports macOS (13+) and iOS (16+).
  • Leverages Metal for GPU acceleration on Apple Silicon.
  • Implements multiple sampling methods (Temperature, TFS, Mirostat, etc.).
  • Based on ggml and llama.cpp.

Maintenance & Community

The project is under active revision and refactoring, with the author learning Swift during development. Feedback on code style and architecture is welcomed.

Licensing & Compatibility

The license is not explicitly stated in the README. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The code is in constant revision and may not be stable. Support for LoRA adapters (training, export, and context restoration) is currently missing. Metal acceleration is not functional on Intel Macs.

Health Check
Last commit

6 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
8 stars in the last 90 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Nat Friedman Nat Friedman(Former CEO of GitHub), and
32 more.

llama.cpp by ggml-org

0.4%
84k
C/C++ library for local LLM inference
created 2 years ago
updated 18 hours ago
Feedback? Help us improve.