@@ -1,7 +1,7 @@ |
| 1 | # DocumentLanguageModel | 1 | # DocumentLanguageModel |
| 2 | | 2 | |
| 3 | -> `.dlm` is a trainable local AI document format: typed sections, directives, | 3 | +> A `.dlm` file becomes a local, reproducible, trainable LLM. |
| 4 | -> replay-backed retraining, and export. | 4 | +> Edit the document, retrain, share. |
| 5 | | 5 | |
| 6 | DocumentLanguageModel (DLM) is a local-first training, inference, and export | 6 | DocumentLanguageModel (DLM) is a local-first training, inference, and export |
| 7 | toolchain built around authored documents instead of hosted dashboards. | 7 | toolchain built around authored documents instead of hosted dashboards. |
@@ -11,116 +11,42 @@ A `.dlm` can be: |
| 11 | - a hand-written training document with prose, instruction, and preference data | 11 | - a hand-written training document with prose, instruction, and preference data |
| 12 | - a directive-driven entrypoint into a codebase or notes tree | 12 | - a directive-driven entrypoint into a codebase or notes tree |
| 13 | - a multi-adapter project with learned routing | 13 | - a multi-adapter project with learned routing |
| 14 | -- a selected multimodal or audio-language document | 14 | +- a multimodal or audio-language document |
| 15 | | 15 | |
| 16 | DLM trains LoRA / QLoRA / DoRA adapters on real pretrained bases, keeps a replay | 16 | DLM trains LoRA / QLoRA / DoRA adapters on real pretrained bases, keeps a replay |
| 17 | -history so retrains do not silently forget, and exports local runtimes such as | 17 | +history so retrains do not silently forget, and exports to Ollama, |
| 18 | -Ollama, `llama-server`, `vllm`, and `mlx-serve`. | | |
| 19 | - | | |
| 20 | -**Status:** pre-v1.0, but far beyond the original MVP framing. The core | | |
| 21 | -author/train/prompt/export/pack/share loop is real, and newer runtime-target | | |
| 22 | -work is landing incrementally. Current export targets are `ollama`, | | |
| 23 | `llama-server`, `vllm`, and `mlx-serve`. | 18 | `llama-server`, `vllm`, and `mlx-serve`. |
| 24 | | 19 | |
| 25 | -## What A `.dlm` Actually Is | 20 | +## Install |
| 26 | - | | |
| 27 | -A `.dlm` is not just “a text file with a special extension.” | | |
| 28 | - | | |
| 29 | -It is a trainable project surface with: | | |
| 30 | - | | |
| 31 | -- **frontmatter** for base-model choice, training config, export defaults, | | |
| 32 | - sources, cache policy, and multi-adapter gate settings | | |
| 33 | -- **typed body sections** such as prose, `::instruction::`, | | |
| 34 | - `::preference::`, `::image::`, and `::audio::` | | |
| 35 | -- **adapter routing** via fences like `::instruction#knowledge::` | | |
| 36 | -- **directive-driven ingestion** from files and directories through | | |
| 37 | - `training.sources` | | |
| 38 | -- **repo-local subtree control** through `.dlm/training.yaml` and `.dlm/ignore` | | |
| 39 | -- a stable **`dlm_id`** that binds the document to a local store under | | |
| 40 | - `~/.dlm/store/<dlm_id>/` | | |
| 41 | - | | |
| 42 | -That combination is what makes DLM more like a local AI authoring format than a | | |
| 43 | -single prompt file. | | |
| 44 | - | | |
| 45 | -## Why DLM | | |
| 46 | - | | |
| 47 | -Most “personal AI” tooling still pushes you toward one of two bad choices: | | |
| 48 | - | | |
| 49 | -- upload your data to someone else’s cloud | | |
| 50 | -- run an oversized model with weak authoring and retraining ergonomics | | |
| 51 | - | | |
| 52 | -DLM sits in the gap: | | |
| 53 | - | | |
| 54 | -- **The document is the interface.** You author the thing you care about instead | | |
| 55 | - of wiring together a hidden dataset pipeline. | | |
| 56 | -- **Training is real.** LoRA / QLoRA / DoRA on pretrained bases, not a toy | | |
| 57 | - from-scratch transformer. | | |
| 58 | -- **Retraining is additive.** Previous document versions flow into a replay | | |
| 59 | - corpus so the model does not forget last week’s state by default. | | |
| 60 | -- **Everything stays local.** Training, inference, store state, exports, and | | |
| 61 | - packs all live on your machine unless you explicitly push them somewhere. | | |
| 62 | -- **Determinism is a contract.** Locks, pinned versions, and golden checks are | | |
| 63 | - first-class design constraints, not “best effort.” | | |
| 64 | - | | |
| 65 | -## Core Capabilities | | |
| 66 | - | | |
| 67 | -- **Author structured training data in one place.** Mix prose, SFT examples, | | |
| 68 | - preferences, image sections, and audio sections in one document. | | |
| 69 | -- **Ingest whole trees, not just one file.** `training.sources` can walk a | | |
| 70 | - repo, and subtree-local `.dlm/training.yaml` / `.dlm/ignore` let the corpus | | |
| 71 | - carry its own curation rules. | | |
| 72 | -- **Train on modern base families.** Text, reasoning-tuned, sparse-MoE, | | |
| 73 | - vision-language, and audio-language registry rows ship today, plus `hf:org/name` | | |
| 74 | - escape hatches. | | |
| 75 | -- **Compose multiple adapters in one document.** Named adapters, weighted export | | |
| 76 | - mixes, and learned adapter gates let one `.dlm` separate knowledge, tone, or | | |
| 77 | - persona lanes. | | |
| 78 | -- **Mine preference pairs from a live adapter.** `dlm preference mine` can use | | |
| 79 | - `sway`, HF reward models, or external CLI judges to write auto-mined | | |
| 80 | - `::preference::` sections back into the document. | | |
| 81 | -- **Stay in a local iteration loop.** `dlm prompt`, `dlm repl`, | | |
| 82 | - `dlm train --watch`, `dlm metrics`, and `dlm doctor` are all part of the | | |
| 83 | - normal workflow now. | | |
| 84 | -- **Export beyond the original Ollama-only story.** DLM still does explicit | | |
| 85 | - Ollama exports with pinned templates, and now also emits `llama-server`, | | |
| 86 | - `vllm`, and `mlx-serve` launch artifacts for local runtime targets. | | |
| 87 | -- **Close the eval loop.** `dlm harvest` can pull failing `sway`-style probe | | |
| 88 | - reports back into the document as new training examples. | | |
| 89 | -- **Pack and share reproducibly.** `.dlm.pack`, verification, push/pull, and | | |
| 90 | - local serve flows are all built around the same store contracts. | | |
| 91 | - | | |
| 92 | -## Supported Platforms | | |
| 93 | | 21 | |
| 94 | -| Tier | Training | Inference / export | | 22 | +```sh |
| 95 | -|---|---|---| | 23 | +pip install document-language-model |
| 96 | -| NVIDIA CUDA (SM ≥ 8.0) | bf16 + QLoRA 4-bit + FlashAttention | Ollama, GGUF export, `llama-server`, `vllm` | | 24 | +``` |
| 97 | -| NVIDIA CUDA (SM < 8.0) | fp16 LoRA | Ollama, GGUF export, `llama-server`, `vllm` | | | |
| 98 | -| Apple Silicon (MPS) | fp16 or fp32 LoRA depending on doctor plan | Ollama, selected MLX inference paths, GGUF export, `vllm` (conservative Metal defaults), `mlx-serve` | | | |
| 99 | -| CPU | inference-first; training refused above small bases unless forced | GGUF export, Ollama, `llama-server` | | | |
| 100 | -| AMD ROCm | experimental | ROCm-oriented llama.cpp flows | | | |
| 101 | | 25 | |
| 102 | -See [docs/hardware](./docs/hardware/memory-estimates.md) and | 26 | +That gives you the `dlm` command. Verify: |
| 103 | -[docs/hardware/vl-memory.md](./docs/hardware/vl-memory.md) for the real support | | |
| 104 | -matrix and current caveats. | | |
| 105 | | 27 | |
| 106 | -## Install | 28 | +```sh |
| | 29 | +dlm --version |
| | 30 | +dlm doctor |
| | 31 | +``` |
| 107 | | 32 | |
| 108 | -### From the Homebrew tap | 33 | +### Extras |
| 109 | | 34 | |
| 110 | ```sh | 35 | ```sh |
| 111 | -brew tap tenseleyFlow/tap | 36 | +# CUDA QLoRA support (NVIDIA SM >= 8.0): |
| 112 | -brew install dlm | 37 | +pip install 'document-language-model[cuda]' |
| 113 | | 38 | |
| 114 | -# Optional, only if you want `--target ollama` registration/smoke: | 39 | +# Apple Silicon MLX inference: |
| 115 | -brew install ollama | 40 | +pip install 'document-language-model[mlx]' |
| 116 | -``` | | |
| 117 | | 41 | |
| 118 | -`brew install dlm` pulls in the Python environment and the vendored | 42 | +# OpenAI teacher for synthetic data generation: |
| 119 | -`llama.cpp` source tree DLM uses for GGUF conversion. CUDA users unlock QLoRA | 43 | +pip install 'document-language-model[openai]' |
| 120 | -after install: | | |
| 121 | | 44 | |
| 122 | -```sh | 45 | +# Anthropic teacher: |
| 123 | -$(brew --prefix dlm)/libexec/venv/bin/pip install 'dlm[cuda]' | 46 | +pip install 'document-language-model[anthropic]' |
| | 47 | + |
| | 48 | +# Observability (TensorBoard + W&B): |
| | 49 | +pip install 'document-language-model[observability]' |
| 124 | ``` | 50 | ``` |
| 125 | | 51 | |
| 126 | ### From source | 52 | ### From source |
@@ -128,49 +54,40 @@ $(brew --prefix dlm)/libexec/venv/bin/pip install 'dlm[cuda]' |
| 128 | ```sh | 54 | ```sh |
| 129 | git clone https://github.com/tenseleyFlow/DocumentLanguageModel.git | 55 | git clone https://github.com/tenseleyFlow/DocumentLanguageModel.git |
| 130 | cd DocumentLanguageModel | 56 | cd DocumentLanguageModel |
| 131 | -uv sync | 57 | +uv sync --all-extras --dev |
| | 58 | +uv run dlm --help |
| 132 | | 59 | |
| 133 | -# Build GGUF tooling: | 60 | +# Build GGUF export tooling: |
| 134 | scripts/bump-llama-cpp.sh build | 61 | scripts/bump-llama-cpp.sh build |
| 135 | | 62 | |
| 136 | -# If you want the llama.cpp HTTP target too: | 63 | +# Optional: llama-server HTTP target: |
| 137 | scripts/bump-llama-cpp.sh build --with-server | 64 | scripts/bump-llama-cpp.sh build --with-server |
| 138 | - | | |
| 139 | -# If you want the Apple Silicon MLX HTTP target: | | |
| 140 | -uv sync --extra mlx | | |
| 141 | - | | |
| 142 | -# If you want the vLLM HTTP target: | | |
| 143 | -# install a compatible vllm runtime separately; DLM writes launch artifacts | | |
| 144 | -# but does not bundle the server runtime itself. | | |
| 145 | - | | |
| 146 | -uv run dlm --help | | |
| 147 | ``` | 65 | ``` |
| 148 | | 66 | |
| 149 | -We deliberately do not publish to PyPI yet. See | | |
| 150 | -[CONTRIBUTING.md](./CONTRIBUTING.md) for the release flow. | | |
| 151 | - | | |
| 152 | ## 30-Second Start | 67 | ## 30-Second Start |
| 153 | | 68 | |
| 154 | ```sh | 69 | ```sh |
| 155 | -uv run dlm init tutor.dlm --base smollm2-135m | 70 | +dlm init tutor.dlm --base smollm2-135m |
| 156 | -$EDITOR tutor.dlm | 71 | +# Edit tutor.dlm — add your Q&A pairs |
| 157 | -uv run dlm train tutor.dlm | 72 | +dlm train tutor.dlm |
| 158 | -uv run dlm prompt tutor.dlm "What is a Python decorator?" | 73 | +dlm prompt tutor.dlm "What is a Python decorator?" |
| 159 | -uv run dlm export tutor.dlm --target ollama --name my-tutor | 74 | +dlm export tutor.dlm --target ollama --name my-tutor |
| 160 | ``` | 75 | ``` |
| 161 | | 76 | |
| 162 | -A minimal `.dlm` still works: | 77 | +## What a `.dlm` Looks Like |
| | 78 | + |
| | 79 | +A minimal document: |
| 163 | | 80 | |
| 164 | -```dlm | 81 | +```yaml |
| 165 | --- | 82 | --- |
| 166 | dlm_id: 01KPM5CXB51GRX86Q25AKERN6E | 83 | dlm_id: 01KPM5CXB51GRX86Q25AKERN6E |
| 167 | -dlm_version: 1 | 84 | +dlm_version: 15 |
| 168 | base_model: smollm2-135m | 85 | base_model: smollm2-135m |
| 169 | --- | 86 | --- |
| 170 | | 87 | |
| 171 | -# Your document title | 88 | +# My tutor |
| 172 | | 89 | |
| 173 | -Write prose here. | 90 | +Some background prose. This trains via continued pretraining. |
| 174 | | 91 | |
| 175 | ::instruction:: | 92 | ::instruction:: |
| 176 | ### Q | 93 | ### Q |
@@ -180,28 +97,22 @@ What is a decorator? |
| 180 | A function that takes a function and returns a wrapped function. | 97 | A function that takes a function and returns a wrapped function. |
| 181 | ``` | 98 | ``` |
| 182 | | 99 | |
| 183 | -That path is still important. It is just no longer the whole story. | 100 | +A more representative one with directives, named adapters, and export config: |
| 184 | - | | |
| 185 | -## Authoring Beyond The Toy Example | | |
| 186 | | 101 | |
| 187 | -A more representative `.dlm` can mix directives, named adapters, and export | 102 | +```yaml |
| 188 | -defaults in one place: | | |
| 189 | - | | |
| 190 | -```dlm | | |
| 191 | --- | 103 | --- |
| 192 | dlm_id: 01KTESTEXAMPLE000000000000 | 104 | dlm_id: 01KTESTEXAMPLE000000000000 |
| 193 | -dlm_version: 1 | 105 | +dlm_version: 15 |
| 194 | base_model: qwen3-1.7b | 106 | base_model: qwen3-1.7b |
| 195 | system_prompt: | | 107 | system_prompt: | |
| 196 | You are a concise engineering assistant. | 108 | You are a concise engineering assistant. |
| 197 | training: | 109 | training: |
| 198 | adapter: lora | 110 | adapter: lora |
| 199 | sequence_len: 4096 | 111 | sequence_len: 4096 |
| 200 | - sources_policy: strict | | |
| 201 | sources: | 112 | sources: |
| 202 | - path: ./src | 113 | - path: ./src |
| 203 | include: ["**/*.py", "**/*.md"] | 114 | include: ["**/*.py", "**/*.md"] |
| 204 | - exclude: ["tests/**", "**/__pycache__/**"] | 115 | + exclude: ["tests/**"] |
| 205 | adapters: | 116 | adapters: |
| 206 | knowledge: | 117 | knowledge: |
| 207 | adapter: lora | 118 | adapter: lora |
@@ -237,183 +148,171 @@ Explain it directly, then give the fix. |
| 237 | Over-explain the background before naming the problem. | 148 | Over-explain the background before naming the problem. |
| 238 | ``` | 149 | ``` |
| 239 | | 150 | |
| 240 | -Two important upgrades over the older README story: | | |
| 241 | - | | |
| 242 | -- `training.sources` can turn a repo or notes tree into synthetic training | | |
| 243 | - sections. | | |
| 244 | -- `training.adapters` + `training.gate` let one document route prompts across | | |
| 245 | - multiple adapters instead of pretending one flat adapter is the only mode. | | |
| 246 | - | | |
| 247 | -If you need deeper subtree-specific curation, drop `.dlm/training.yaml` and | | |
| 248 | -`.dlm/ignore` into nested directories and let the corpus carry its own rules. | | |
| 249 | - | | |
| 250 | ## Common Workflows | 151 | ## Common Workflows |
| 251 | | 152 | |
| 252 | -### 1. Hand-authored document | 153 | +### Train a hand-authored document |
| 253 | | 154 | |
| 254 | ```sh | 155 | ```sh |
| 255 | -uv run dlm init tutor.dlm --base smollm2-135m | 156 | +dlm init tutor.dlm --base smollm2-135m |
| 256 | -uv run dlm train tutor.dlm | 157 | +dlm train tutor.dlm |
| 257 | -uv run dlm prompt tutor.dlm "Explain decorators" | 158 | +dlm prompt tutor.dlm "Explain decorators" |
| 258 | ``` | 159 | ``` |
| 259 | | 160 | |
| 260 | -### 2. Train across a codebase | 161 | +### Train across a codebase |
| 261 | | 162 | |
| 262 | ```sh | 163 | ```sh |
| 263 | -uv run dlm train ./my-repo --base qwen3-1.7b --include '**/*.py' --name corpus | 164 | +dlm train ./my-repo --base qwen3-1.7b |
| 264 | ``` | 165 | ``` |
| 265 | | 166 | |
| 266 | -That auto-scaffolds a `.dlm` under `./my-repo/.dlm/` and lets the repo become | 167 | +Auto-scaffolds a `.dlm` under `./my-repo/.dlm/` and trains on the repo's |
| 267 | -its own training surface. | 168 | +source files. |
| 268 | | 169 | |
| 269 | -### 3. Multi-adapter composition | 170 | +### Multi-adapter composition |
| 270 | | 171 | |
| 271 | ```sh | 172 | ```sh |
| 272 | -uv run dlm prompt mydoc.dlm "Explain the runbook" --adapter knowledge | 173 | +dlm prompt mydoc.dlm "Explain the runbook" --adapter knowledge |
| 273 | -uv run dlm export mydoc.dlm --adapter-mix knowledge:1.0,tone:0.5 | 174 | +dlm export mydoc.dlm --adapter-mix knowledge:1.0,tone:0.5 |
| 274 | ``` | 175 | ``` |
| 275 | | 176 | |
| 276 | -### 4. Local iteration loop | 177 | +### Export to local runtimes |
| 277 | | 178 | |
| 278 | ```sh | 179 | ```sh |
| 279 | -uv run dlm train mydoc.dlm --watch | 180 | +dlm export mydoc.dlm --target ollama --name mydoc |
| 280 | -uv run dlm repl mydoc.dlm | 181 | +dlm export mydoc.dlm --target llama-server |
| 281 | -uv run dlm metrics mydoc.dlm | 182 | +dlm export mydoc.dlm --target vllm |
| | 183 | +dlm export mydoc.dlm --target mlx-serve |
| 282 | ``` | 184 | ``` |
| 283 | | 185 | |
| 284 | -### 5. Export and ship | 186 | +### Mine preference pairs and retrain |
| 285 | | 187 | |
| 286 | ```sh | 188 | ```sh |
| 287 | -uv run dlm export mydoc.dlm --target ollama --name mydoc | 189 | +dlm preference mine mydoc.dlm --samples 4 --max-pairs 8 |
| 288 | -uv run dlm export mydoc.dlm --target llama-server | 190 | +dlm preference apply mydoc.dlm |
| 289 | -uv run dlm export mydoc.dlm --target vllm | 191 | +dlm train mydoc.dlm --phase preference |
| 290 | -uv run dlm export mydoc.dlm --target mlx-serve | | |
| 291 | -uv run dlm pack mydoc.dlm --include-exports | | |
| 292 | -uv run dlm verify mydoc.dlm.pack | | |
| 293 | ``` | 192 | ``` |
| 294 | | 193 | |
| 295 | -On Apple Silicon, `--target vllm` now emits conservative `vllm-metal` | 194 | +### Generate synthetic training data |
| 296 | -defaults in the launch script: it pins the server to the MLX KV path | | |
| 297 | -(`VLLM_METAL_USE_PAGED_ATTENTION=0`, `VLLM_METAL_MEMORY_FRACTION=auto`) | | |
| 298 | -and caps `--max-model-len` to the document's `training.sequence_len` | | |
| 299 | -instead of blindly asking `vllm` for the base model's full context. | | |
| 300 | - | | |
| 301 | -### 6. Mine preference pairs and retrain | | |
| 302 | | 195 | |
| 303 | ```sh | 196 | ```sh |
| 304 | -uv run dlm preference mine mydoc.dlm --samples 4 --max-pairs 8 | 197 | +dlm synth instructions mydoc.dlm --teacher self --apply |
| 305 | -uv run dlm preference list mydoc.dlm | 198 | +dlm synth instructions mydoc.dlm --teacher openai:gpt-4o-mini --apply |
| 306 | -uv run dlm preference apply mydoc.dlm | | |
| 307 | -uv run dlm train mydoc.dlm --phase preference | | |
| 308 | - | | |
| 309 | -# A/B check against hand-authored pairs only: | | |
| 310 | -uv run dlm train mydoc.dlm --phase preference --no-mined | | |
| 311 | - | | |
| 312 | -# Use a different judge when bootstrap self-judging is not enough: | | |
| 313 | -uv run dlm preference mine mydoc.dlm --judge hf:YourOrg/reward-model --apply | | |
| 314 | ``` | 199 | ``` |
| 315 | | 200 | |
| 316 | -### 7. Scaffold multimodal or audio docs | 201 | +### Multimodal and audio documents |
| 317 | | 202 | |
| 318 | ```sh | 203 | ```sh |
| 319 | -uv run dlm init diagrams.dlm --multimodal --base qwen2-vl-2b-instruct | 204 | +dlm init diagrams.dlm --multimodal --base qwen2-vl-2b-instruct |
| 320 | -uv run dlm train diagrams.dlm | 205 | +dlm train diagrams.dlm |
| 321 | -uv run dlm prompt diagrams.dlm --image figures/system.png "What is happening here?" | 206 | +dlm prompt diagrams.dlm --image figures/arch.png "What is this?" |
| 322 | | 207 | |
| 323 | -uv run dlm init calls.dlm --audio | 208 | +dlm init calls.dlm --audio |
| 324 | -uv run dlm train calls.dlm | 209 | +dlm train calls.dlm |
| 325 | -uv run dlm prompt calls.dlm --audio clips/example.wav "Summarize the clip" | 210 | +dlm prompt calls.dlm --audio clips/call.wav "Summarize the clip" |
| 326 | ``` | 211 | ``` |
| 327 | | 212 | |
| 328 | -### 8. Pull eval failures back into training | 213 | +### Pull eval failures back into training |
| 329 | | 214 | |
| 330 | ```sh | 215 | ```sh |
| 331 | -uv run dlm harvest mydoc.dlm --sway-json sway-report.json --apply | 216 | +dlm harvest mydoc.dlm --sway-json sway-report.json --apply |
| 332 | ``` | 217 | ``` |
| 333 | | 218 | |
| 334 | -That is the probe-driven loop: evaluation finds a miss, DLM turns it into | 219 | +### Pack and share |
| 335 | -document-level training data, and the next train closes the gap. | | |
| 336 | - | | |
| 337 | -### 9. Inspect store state and reproducibility | | |
| 338 | | 220 | |
| 339 | ```sh | 221 | ```sh |
| 340 | -uv run dlm doctor | 222 | +dlm pack mydoc.dlm --include-exports |
| 341 | -uv run dlm show mydoc.dlm --json | 223 | +dlm verify mydoc.dlm.pack |
| 342 | -uv run dlm metrics mydoc.dlm --run-id 7 --json | 224 | +dlm push mydoc.dlm --to hf:org/name |
| 343 | -uv run dlm pack mydoc.dlm --include-exports | | |
| 344 | -uv run dlm verify mydoc.dlm.pack | | |
| 345 | ``` | 225 | ``` |
| 346 | | 226 | |
| 347 | -## Command Surface | 227 | +### Inspect state |
| 348 | | 228 | |
| 349 | -The CLI is broader than the original MVP now. A useful mental map: | 229 | +```sh |
| | 230 | +dlm doctor |
| | 231 | +dlm show mydoc.dlm --json |
| | 232 | +dlm metrics mydoc.dlm |
| | 233 | +``` |
| | 234 | + |
| | 235 | +## Supported Platforms |
| 350 | | 236 | |
| 351 | -| Area | Commands | What they cover | | 237 | +| Tier | Training | Inference / Export | |
| 352 | |---|---|---| | 238 | |---|---|---| |
| 353 | -| Author | `init`, `templates`, `show`, `migrate`, `cache` | Create docs, inspect them, migrate schema, manage cache state | | 239 | +| NVIDIA CUDA (SM >= 8.0) | bf16 + QLoRA 4-bit + FlashAttention | Ollama, GGUF, llama-server, vLLM | |
| 354 | -| Train | `train`, `doctor`, `metrics`, `harvest` | Run training, inspect plans, observe runs, pull eval misses back in | | 240 | +| NVIDIA CUDA (SM < 8.0) | fp16 LoRA | Ollama, GGUF, llama-server, vLLM | |
| 355 | -| Align | `preference` | Mine, stage, apply, revert, and inspect auto-mined preference sections | | 241 | +| Apple Silicon (MPS) | fp16 LoRA | Ollama, GGUF, MLX inference, mlx-serve | |
| 356 | -| Infer | `prompt`, `repl` | Local interactive and one-shot inference | | 242 | +| CPU | inference only (training refused above small bases) | GGUF, Ollama, llama-server | |
| 357 | -| Ship | `export`, `pack`, `unpack`, `verify`, `push`, `pull`, `serve` | Export to runtimes, bundle, verify, and move artifacts | | 243 | +| AMD ROCm | experimental | ROCm llama.cpp | |
| | 244 | + |
| | 245 | +## Base Model Registry |
| | 246 | + |
| | 247 | +DLM ships with ~27 pinned base models across text, vision-language, and |
| | 248 | +audio-language families: |
| | 249 | + |
| | 250 | +- **Text:** Qwen 2.5 (0.5B–3B), Qwen 3 (1.7B–8B), Llama 3.2/3.3, |
| | 251 | + SmolLM 2/3, Phi-3.5/4, Gemma 2, OLMo 2, Mixtral 8x7B |
| | 252 | +- **Vision-language:** Qwen2-VL, InternVL2/3, PaliGemma, Mistral-Small-3.1 |
| | 253 | +- **Audio-language:** Qwen2-Audio |
| | 254 | + |
| | 255 | +Any HuggingFace model via `--base hf:org/name` with compatibility probes. |
| | 256 | + |
| | 257 | +## Command Surface |
| | 258 | + |
| | 259 | +| Area | Commands | |
| | 260 | +|---|---| |
| | 261 | +| Author | `init`, `templates`, `show`, `migrate`, `cache` | |
| | 262 | +| Train | `train`, `doctor`, `metrics`, `harvest` | |
| | 263 | +| Align | `preference mine/apply/revert/list` | |
| | 264 | +| Synth | `synth instructions/preferences/revert/list` | |
| | 265 | +| Infer | `prompt`, `repl` | |
| | 266 | +| Ship | `export`, `pack`, `unpack`, `verify`, `push`, `pull`, `serve` | |
| 358 | | 267 | |
| 359 | See the [CLI reference](./docs/cli/reference.md) for the full flag surface. | 268 | See the [CLI reference](./docs/cli/reference.md) for the full flag surface. |
| 360 | | 269 | |
| | 270 | +## VSCode Extension |
| | 271 | + |
| | 272 | +The [dlm-vsc](https://github.com/tenseleyFlow/dlm-vsc) extension provides |
| | 273 | +syntax highlighting, completions, diagnostics, and a side panel for `.dlm` |
| | 274 | +authoring. Requires the |
| | 275 | +[dlm-lsp](https://github.com/tenseleyFlow/dlm-lsp) language server: |
| | 276 | + |
| | 277 | +```sh |
| | 278 | +pip install dlm-lsp |
| | 279 | +``` |
| | 280 | + |
| 361 | ## Documentation | 281 | ## Documentation |
| 362 | | 282 | |
| 363 | - [Getting started](./docs/getting-started/install.md) | 283 | - [Getting started](./docs/getting-started/install.md) |
| 364 | - [Frontmatter reference](./docs/format/frontmatter.md) | 284 | - [Frontmatter reference](./docs/format/frontmatter.md) |
| 365 | - [Section grammar](./docs/format/sections.md) | 285 | - [Section grammar](./docs/format/sections.md) |
| 366 | -- [Preference section reference](./docs/format/preference-section.md) | 286 | +- [CLI reference](./docs/cli/reference.md) |
| 367 | - [Training across codebases](./docs/cookbook/training-across-codebases.md) | 287 | - [Training across codebases](./docs/cookbook/training-across-codebases.md) |
| 368 | -- [Train from a folder](./docs/cookbook/train-from-folder.md) | | |
| 369 | -- [Multi-source training](./docs/cookbook/multi-source-training.md) | | |
| 370 | -- [Tokenized-section cache](./docs/cookbook/directive-cache.md) | | |
| 371 | - [Multi-adapter composition](./docs/cookbook/multi-adapter.md) | 288 | - [Multi-adapter composition](./docs/cookbook/multi-adapter.md) |
| 372 | -- [Learned adapter gate](./docs/cookbook/learned-adapter-gate.md) | 289 | +- [Multi-target export](./docs/cookbook/multi-target-export.md) |
| 373 | -- [Self-improving loop / preference mining](./docs/cookbook/self-improving-loop.md) | 290 | +- [Self-improving loop](./docs/cookbook/self-improving-loop.md) |
| 374 | -- [Reward-model integration](./docs/cookbook/reward-model-integration.md) | 291 | +- [Synthesize training data](./docs/cookbook/synthesize-training-data.md) |
| 375 | - [Multimodal training](./docs/cookbook/multimodal-training.md) | 292 | - [Multimodal training](./docs/cookbook/multimodal-training.md) |
| 376 | - [Audio training](./docs/cookbook/audio-training.md) | 293 | - [Audio training](./docs/cookbook/audio-training.md) |
| 377 | -- [Probe-driven training / sway harvest](./docs/cookbook/probe-driven-training.md) | | |
| 378 | -- [Multi-target export](./docs/cookbook/multi-target-export.md) | | |
| 379 | -- [Sharing adapters and packs](./docs/cookbook/sharing.md) | | |
| 380 | -- [CLI reference](./docs/cli/reference.md) | | |
| 381 | - [Architecture](./docs/architecture.md) | 294 | - [Architecture](./docs/architecture.md) |
| 382 | - [Determinism](./docs/determinism.md) | 295 | - [Determinism](./docs/determinism.md) |
| 383 | | 296 | |
| 384 | ## Principles | 297 | ## Principles |
| 385 | | 298 | |
| 386 | -1. **The document is the interface.** | 299 | +1. **The document is the interface.** Frontmatter, typed sections, directives, |
| 387 | - But the document is structured: frontmatter, typed sections, directives, and | 300 | + and store contracts — not a dashboard. |
| 388 | - store contracts all matter. | 301 | +2. **Training is real.** LoRA / QLoRA / DoRA on pretrained bases. |
| 389 | -2. **Training is real.** | 302 | +3. **Retraining should not silently forget.** Replay-backed accumulation. |
| 390 | - LoRA / QLoRA / DoRA on pretrained bases, not a toy transformer. | 303 | +4. **Local-first is load-bearing.** Your data stays on your machine. |
| 391 | -3. **Retraining should not silently forget.** | 304 | +5. **Determinism is a contract.** Locks, pinned versions, golden checks. |
| 392 | - Replay-backed accumulation is part of the product. | | |
| 393 | -4. **Local-first is load-bearing.** | | |
| 394 | - Your training data, adapters, exports, and packs stay on your machine unless | | |
| 395 | - you explicitly move them. | | |
| 396 | -5. **Determinism is a contract.** | | |
| 397 | - If a change breaks the reproducibility story, that is a product regression. | | |
| 398 | | 305 | |
| 399 | ## Tech Stack | 306 | ## Tech Stack |
| 400 | | 307 | |
| 401 | -Python 3.11+ · PyTorch · HuggingFace `transformers` / `peft` / `trl` / | 308 | +Python 3.11+ · PyTorch · HuggingFace transformers / peft / trl / accelerate · |
| 402 | -`accelerate` / `datasets` · `watchfiles` · `prompt-toolkit` · `safetensors` · | 309 | +vendored llama.cpp for GGUF · Ollama · Typer · Pydantic · uv |
| 403 | -vendored `llama.cpp` for GGUF export · Ollama (optional runtime target) · | | |
| 404 | -Typer · Pydantic · `uv` | | |
| 405 | | 310 | |
| 406 | ## Contributing | 311 | ## Contributing |
| 407 | | 312 | |
| 408 | -See [CONTRIBUTING.md](./CONTRIBUTING.md). Testing conventions live in | 313 | +See [CONTRIBUTING.md](./CONTRIBUTING.md). |
| 409 | -[docs-internal/README-testing.md](./docs-internal/README-testing.md). | | |
| 410 | - | | |
| 411 | -```sh | | |
| 412 | -uv run pre-commit install | | |
| 413 | -``` | | |
| 414 | | 314 | |
| 415 | ## License | 315 | ## License |
| 416 | | 316 | |
| 417 | -MIT. Base-model licenses are separate and enforced where DLM needs them: | 317 | +MIT. Base-model licenses are separate and enforced at `dlm init`, `dlm train`, |
| 418 | -`dlm init`, `dlm train`, `dlm export`, and `dlm pack` all keep the gated-base | 318 | +`dlm export`, and `dlm pack`. |
| 419 | -acceptance path explicit. | | |