← TinyGPT · docs · devlog · roadmap · speedup
source: docs/prds/C3-dora-ondisk-format.md · view on GitHub ↗

PRD — DoRA on-disk adapter format

Goal

DoRA already trains in-session under tinygpt sft (default PEFT variant since 2026-05; PeftVariants.swift). It does NOT yet persist to disk in a reusable format — the adapter lives only in the running process’s parameters, so finishing an sft run with DoRA produces no shippable artifact. Ship the on-disk format + reader so DoRA reaches parity with LoRA / LoRA+ / VeRA (all of which already roundtrip).

Why now

Scope — in

Scope — out

Files to touch

FileChange
Sources/TinyGPTModel/LoraAdapterReader.swiftadd dora_magnitude field; apply when peft_variant == "dora"
Sources/TinyGPTModel/LoraAdapterWriter.swiftwrite magnitude when source is DoRA
Sources/TinyGPTModel/PeftVariants.swiftexpose the per-Linear magnitude tensor + the peft_variant tag for the writer
Sources/TinyGPT/SFT.swiftdelete the “not yet serializable” warning; on --out, write the DoRA adapter
Tests/TinyGPTModelTests/DoRARoundtripTests.swiftnew — train 50 steps DoRA on shakespeare, save, reload, assert output token-equal at T=0 vs in-memory adapter
docs/lora_guide.mdone paragraph: DoRA now persists; format is .lora with peft_variant: dora

Don’t touch

Acceptance criteria

Reference patterns

Open questions