Project notes
SwiftLLM
A Swift-native reliability layer for local-first, on-device language model features on Apple platforms.
Repository snapshot
- 1Commits
- May 2026Updated in snapshot
- Apache-2.0License
- May 2026Started
- Swift 99.5%
- Shell 0.5%
Recent commits
Overview
SwiftLLM is not an attempt to make Apple's small on-device model behave like a frontier cloud model. It is the orchestration layer that production AI features need anyway, even when the model is local and offline: prompt contracts, token budgeting, chunked long-input pipelines, structured-generation validation, source-aware local RAG, and deterministic fallbacks.
Highlights
- 01
Prompt contracts & versioning
Versioned prompts with regression-friendly evaluation and redacted local diagnostics.
- 02
Context & chunking
Boundary-aware text and transcript chunking with score-density context packing and map/reduce.
- 03
Structured generation
Schema descriptors, generic validators, and repair and fallback policies in a provider-neutral pipeline.
- 04
Local RAG
Source references, deterministic keyword retrieval, source-diverse packing, and citation rendering.
- 05
Foundation Models adapter
Availability normalization, token counting, prewarming, typed guided generation, and error mapping.
- 06
Deterministic fallbacks
Graceful degradation with local-only run metadata and diagnostics; nothing leaves the device.
Products
Documentation & getting started
// Package.swift
.package(url: "https://github.com/kylebegeman/swift-llm", branch: "master"),
// products: SwiftLLM, SwiftLLMFoundationModels, SwiftLLMEvaluation
- OverviewWhat the package is, and what it deliberately is not.
- ArchitectureHow the core, adapters, and pipelines fit together.
- Foundation ModelsApple FM availability, token counting, and generation.
- Reliability patternsFallbacks, budgets, and prompt contracts in practice.
- Structured generationSchemas, validators, and repair policies.
- Local RAGSource-aware, on-device retrieval and citations.