Skip to content
View asaptf's full-sized avatar

Block or report asaptf

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
asaptf/README.md

Andrey Sapunov

Software engineer at Cledara, Barcelona. I build language models in Swift/MLX and wrote a from-scratch book on how LLMs work. One thesis runs through all of it: AI doesn't have to speak Python.

The five-second proof: swiftos.tech is served by an operating system I wrote from scratch in Swift. nginx, statically linked against SwiftOS's own newlib port, running on its own kernel, its own syscall ABI and its own in-kernel TCP/IP stack, on a bare Hetzner Cloud ARM VM. Not QEMU, not a container.

The argument has a written form — Why the AI Industry Still Pays a "Python Tax" — and the projects below are the evidence.

Projects

swift-os — an operating system from scratch in Embedded Swift for 64-bit ARM: capability-isolated, no Linux ABI, no dynamic loader.

Real MMU isolation with one address space per process; SMP across multiple cores; a pure-Swift in-kernel TCP/IP stack (DHCP/TCP/UDP/DNS/HTTP/TLS); a native Swift userland with coreutils, a shell, ps/top and sshd; a three-tier filesystem durable enough to back SQLite.

It runs real software — nginx over HTTPS, and Node.js 24.16 with npm in jitless mode (node -e "console.log(6 * 7)" prints 42) — and boots on real hardware via ACPI + GICv3 + PCIe, not just QEMU. It's a learning project, intentionally minimal and rough in places, not production. It does serve its own website, though.

swift-extract — Instructor for Swift, document-first: declare a Swift type, point it at a document, get back a typed, validated instance.

Works on PDFs, receipt photos, ID documents, screenshots and plain text with no templates and no document classifier — the type is the configuration, and macros build the schema at compile time. Runs on any LLM: Apple Intelligence on-device, MLX / Core ML / llama.cpp locally, or OpenAI / Anthropic / Gemini in the cloud. Five releases (latest 0.5.0), listed on the Swift Package Index; the demo runs a café receipt through Vision OCR and a local 4-bit Qwen2.5 1.5B, fully on-device.

swift-language-models — a textbook you can run: four parts of commented Swift, from counting letters to retrieval-augmented generation.

Part 1 is a counting n-gram model in one file; part 2 hand-builds a scalar autograd engine, then a neural bigram and an MLP; part 3 is a real char-level GPT Transformer on MLX; part 4 is a full RAG pipeline with BM25 over a local corpus. Parts 1, 2 and 4 are zero-dependency pure Swift. Companion code to the book below.

swift-adapt — on-device LoRA personalization for iOS and macOS: no server, no Python, no data leaving the machine.

The app collects training signal, Adapt trains an adapter locally, evaluates it on-device, and promotes it only if it beats the one in use — the gate is a one-sided Wilcoxon signed-rank test at α = 0.05, and "not enough evidence" is a separate outcome from "worse". Training is interruption-safe (a resumed run reproduces the uninterrupted loss curve to within 1e-5); rollback is a pointer flip. Measured on an M5 Pro: Qwen3-4B-4bit, rank 8, 100 steps → 15 s, 2.4 GB peak, a 10 MB adapter, 8 ms hot-swap. 212 tests in 44 suites, all offline. Openly unfinished: generation quality is usable but not done, and training on a physical iPhone is unmeasured.

NeuralBASIC — learn neural networks by poking them: live in the browser, no install, nothing leaves your machine.

Change the architecture, the learning rate or the data and watch the decision boundary move as it trains, epoch by epoch; then tap anywhere on the plot to test a point that was never in the data. Five written chapters, a strictly Socratic AI tutor that never pastes solutions, progress gated by demonstrated understanding — and every number in the lessons is verified by tests. Spiritual successor to QuickBASIC, and to my own TabletBasic below.

swift-watermark-remover — a Swift 6 package and CLI for studying text watermarks on-device (Apple Silicon, MLX); published for research and education.

The book

How LLMs Work: From Zero to Your Own Transformer — two books in one: the main text builds intuition about tokens, embeddings, attention and training, while engineering asides carry the real formulas and code. Every example is real, runnable Swift tested on a Mac — not pseudocode.

Writing

Two long-form pieces, both HackerNoon top stories.

Apps

  • TabletBasic (source) — a retro QuickBASIC 4.5-style IDE for iPhone, iPad and Mac, with a BASIC interpreter written from scratch in Swift: blue-screen DOS-style menus, immediate mode, 16 learning chapters, 80 sample programs, SCREEN 13-style graphics.
  • Voice Agent Builder — the product side of the voice-to-voice article.
  • The rest are on the App Store developer page.

Elsewhere

By day: software engineer at Cledara, Barcelona.

HackerNoon · LinkedIn · GitHub — you're already here: @asaptf

Pinned Loading

  1. swift-os swift-os Public

    A real operating system written from scratch in Embedded Swift for 64-bit ARM: MMU-isolated processes, capability-based security, an in-kernel pure-Swift TCP/IP stack — and it runs nginx, Node.js a…

    Swift 129 7

  2. swift-language-models swift-language-models Public

    From-scratch language models in Swift: n-gram, neural autograd, a MLX GPT, and RAG.

    Swift 9 1

  3. swift-extract swift-extract Public

    Typed structured extraction from PDFs, photos & text via any LLM — Instructor for Swift, document-first

    Swift 29

  4. swift-watermark-remover swift-watermark-remover Public

    On-device multi-pass text watermark remover for Apple Silicon (Swift + MLX)

    Swift

  5. swift-adapt swift-adapt Public

    On-device LoRA personalization for iOS and macOS. Trains, evaluates and rolls back adapters locally — no server, no Python.

    Swift