Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neuro

An iOS app for on-device fine-tuning and inference of compact RWKV models — no data ever leaves the device. Models, datasets, and trained weights are pulled from a Hugging Face catalog (ImpulseLeap/neuromodels, ImpulseLeap/neurodatasets); training and inference both run locally via SwiftRWKV (the RWKVGen package) on MLX.

Requirements

  • iOS 26.5
  • Xcode 26.5
  • Apple Silicon Mac (M-series) — for building and running the simulator/device

Project structure

Neuro/

App target root.

  • NeuroApp.swift@main entry point, TelemetryDeck initialization.
  • RemoteCatalog.swift — catalog source of truth: Hugging Face API calls for the model collection (ImpulseLeap/neuromodels) and dataset collection (ImpulseLeap/neurodatasets), resolving URLs to a given repo's config.json / weights / tokenizer.
  • CatalogStore.swift — state for the "Catalog" tab: fetching the list via RemoteCatalog, downloading model/dataset files (FileDownloader — a URLSessionDownloadDelegate with progress reporting and redirect handling).
  • ModelStore.swift — model package description (ModelConfig: architecture, layer count, embedding size, tokenizer, task type, etc.), reading/writing packages on disk — both downloaded base models (models/) and the user's fine-tuned ones (mymodels/).
  • Dataset.swift — loads training examples from .jsonl (from the app bundle or from Documents/datasets/<id>/), tokenizes and truncates to maxLen.
  • ChatScreens.swift — chat data models (Chat, ChatMessage) and the associated Combine/UI helpers for the model conversation screen.

Neuro/Logic/

Inference and preprocessing layer, no UI.

  • BPETokenizer.swift — byte-level BPE tokenizer for the Hugging Face tokenizer.json format (GPT-2 style): reads the vocabulary and merge rules, byte↔unicode table, encodes text into tokens.
  • Inference.swiftInferenceEngine: wires the backbone model, tokenizer, and trained head (Linear) into a single text-classification pipeline, returning a Prediction (winning label + per-class probability distribution).
  • Pooling.swift — strategies for pooling backbone outputs into a single vector before the head: mean (masked average over real tokens) and last (vector of the last real token).

Neuro/MainView/

UI, four tab-bar tabs (RootTabView.swift): Home, Train, Chats, Catalog.

  • RootTabView.swift — root TabView and the "Catalog" tab (CatalogView) with a Models/Datasets segment switch.
  • HomeView.swift / HomeStore.swift / HomeComponents.swift — "Home" tab: usage summary, lists of the user's own/downloaded models and datasets, reusable visual components (tiles, cards).
  • FinetuneView.swift — fine-tuning setup form: base model and dataset selection, training level (TrainLevel: simple → aggressive), which determines the learning rate and the number of frozen layers.
  • TrainingProcessView.swift / TrainingRunner.swift — training process screen and its engine: TrainingRunner loads the backbone/tokenizer/dataset and runs X070PartialFinetune (from SwiftRWKV) in the background, publishing progress, loss, and phase (extractingtrainingdone/failed) to the main thread.
  • ChatsView.swift — chat list (pin/rename/delete) and navigation into a conversation with a specific fine-tuned model.
  • DetailSheets.swift — detail sheet for a user model / base model / dataset (metadata, accuracy, size, etc.).
  • Theme.swift — color palette (wrapper over Assets.xcassets) and app typography.
  • Localizable.xcstrings — localization strings (RU/EN).

Neuro/Assets.xcassets

App icon, color sets used by Theme.swift, other graphic resources.

.github/workflows/release.yml

GitHub Actions CI/CD pipeline (macos-26): checks out Neuro and SwiftRWKV side by side (at the path expected by the local Swift Package dependency), pulls the Metal Toolchain, builds, and uploads the build to App Store Connect on a release-* tag.

Dependencies

  • SwiftRWKV (RWKVGen) — RWKV-7 inference and fine-tuning on MLX
  • MLX — tensor computation on Apple Silicon
  • TelemetryDeck — anonymous usage analytics

License

Licensed under the Apache License, Version 2.0. See LICENSE for the full text.

Author

Alexei Goncharov