@@ -1,7 +1,7 @@ |
| 1 | 1 | # DocumentLanguageModel |
| 2 | 2 | |
| 3 | | -> `.dlm` is a trainable local AI document format: typed sections, directives, |
| 4 | | -> replay-backed retraining, and export. |
| 3 | +> A `.dlm` file becomes a local, reproducible, trainable LLM. |
| 4 | +> Edit the document, retrain, share. |
| 5 | 5 | |
| 6 | 6 | DocumentLanguageModel (DLM) is a local-first training, inference, and export |
| 7 | 7 | toolchain built around authored documents instead of hosted dashboards. |
@@ -11,116 +11,42 @@ A `.dlm` can be: |
| 11 | 11 | - a hand-written training document with prose, instruction, and preference data |
| 12 | 12 | - a directive-driven entrypoint into a codebase or notes tree |
| 13 | 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 | 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 |
| 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`, |
| 17 | +history so retrains do not silently forget, and exports to Ollama, |
| 23 | 18 | `llama-server`, `vllm`, and `mlx-serve`. |
| 24 | 19 | |
| 25 | | -## What A `.dlm` Actually Is |
| 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 |
| 20 | +## Install |
| 93 | 21 | |
| 94 | | -| Tier | Training | Inference / export | |
| 95 | | -|---|---|---| |
| 96 | | -| NVIDIA CUDA (SM ≥ 8.0) | bf16 + QLoRA 4-bit + FlashAttention | Ollama, GGUF export, `llama-server`, `vllm` | |
| 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 | |
| 22 | +```sh |
| 23 | +pip install document-language-model |
| 24 | +``` |
| 101 | 25 | |
| 102 | | -See [docs/hardware](./docs/hardware/memory-estimates.md) and |
| 103 | | -[docs/hardware/vl-memory.md](./docs/hardware/vl-memory.md) for the real support |
| 104 | | -matrix and current caveats. |
| 26 | +That gives you the `dlm` command. Verify: |
| 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 | 35 | ```sh |
| 111 | | -brew tap tenseleyFlow/tap |
| 112 | | -brew install dlm |
| 36 | +# CUDA QLoRA support (NVIDIA SM >= 8.0): |
| 37 | +pip install 'document-language-model[cuda]' |
| 113 | 38 | |
| 114 | | -# Optional, only if you want `--target ollama` registration/smoke: |
| 115 | | -brew install ollama |
| 116 | | -``` |
| 39 | +# Apple Silicon MLX inference: |
| 40 | +pip install 'document-language-model[mlx]' |
| 117 | 41 | |
| 118 | | -`brew install dlm` pulls in the Python environment and the vendored |
| 119 | | -`llama.cpp` source tree DLM uses for GGUF conversion. CUDA users unlock QLoRA |
| 120 | | -after install: |
| 42 | +# OpenAI teacher for synthetic data generation: |
| 43 | +pip install 'document-language-model[openai]' |
| 121 | 44 | |
| 122 | | -```sh |
| 123 | | -$(brew --prefix dlm)/libexec/venv/bin/pip install 'dlm[cuda]' |
| 45 | +# Anthropic teacher: |
| 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 | 52 | ### From source |
@@ -128,49 +54,40 @@ $(brew --prefix dlm)/libexec/venv/bin/pip install 'dlm[cuda]' |
| 128 | 54 | ```sh |
| 129 | 55 | git clone https://github.com/tenseleyFlow/DocumentLanguageModel.git |
| 130 | 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 | 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 | 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 | 67 | ## 30-Second Start |
| 153 | 68 | |
| 154 | 69 | ```sh |
| 155 | | -uv run dlm init tutor.dlm --base smollm2-135m |
| 156 | | -$EDITOR tutor.dlm |
| 157 | | -uv run dlm train tutor.dlm |
| 158 | | -uv run dlm prompt tutor.dlm "What is a Python decorator?" |
| 159 | | -uv run dlm export tutor.dlm --target ollama --name my-tutor |
| 70 | +dlm init tutor.dlm --base smollm2-135m |
| 71 | +# Edit tutor.dlm — add your Q&A pairs |
| 72 | +dlm train tutor.dlm |
| 73 | +dlm prompt tutor.dlm "What is a Python decorator?" |
| 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 | 83 | dlm_id: 01KPM5CXB51GRX86Q25AKERN6E |
| 167 | | -dlm_version: 1 |
| 84 | +dlm_version: 15 |
| 168 | 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 | 92 | ::instruction:: |
| 176 | 93 | ### Q |
@@ -180,28 +97,22 @@ What is a decorator? |
| 180 | 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. |
| 184 | | - |
| 185 | | -## Authoring Beyond The Toy Example |
| 100 | +A more representative one with directives, named adapters, and export config: |
| 186 | 101 | |
| 187 | | -A more representative `.dlm` can mix directives, named adapters, and export |
| 188 | | -defaults in one place: |
| 189 | | - |
| 190 | | -```dlm |
| 102 | +```yaml |
| 191 | 103 | --- |
| 192 | 104 | dlm_id: 01KTESTEXAMPLE000000000000 |
| 193 | | -dlm_version: 1 |
| 105 | +dlm_version: 15 |
| 194 | 106 | base_model: qwen3-1.7b |
| 195 | 107 | system_prompt: | |
| 196 | 108 | You are a concise engineering assistant. |
| 197 | 109 | training: |
| 198 | 110 | adapter: lora |
| 199 | 111 | sequence_len: 4096 |
| 200 | | - sources_policy: strict |
| 201 | 112 | sources: |
| 202 | 113 | - path: ./src |
| 203 | 114 | include: ["**/*.py", "**/*.md"] |
| 204 | | - exclude: ["tests/**", "**/__pycache__/**"] |
| 115 | + exclude: ["tests/**"] |
| 205 | 116 | adapters: |
| 206 | 117 | knowledge: |
| 207 | 118 | adapter: lora |
@@ -237,183 +148,171 @@ Explain it directly, then give the fix. |
| 237 | 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 | 151 | ## Common Workflows |
| 251 | 152 | |
| 252 | | -### 1. Hand-authored document |
| 153 | +### Train a hand-authored document |
| 253 | 154 | |
| 254 | 155 | ```sh |
| 255 | | -uv run dlm init tutor.dlm --base smollm2-135m |
| 256 | | -uv run dlm train tutor.dlm |
| 257 | | -uv run dlm prompt tutor.dlm "Explain decorators" |
| 156 | +dlm init tutor.dlm --base smollm2-135m |
| 157 | +dlm train tutor.dlm |
| 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 | 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 |
| 267 | | -its own training surface. |
| 167 | +Auto-scaffolds a `.dlm` under `./my-repo/.dlm/` and trains on the repo's |
| 168 | +source files. |
| 268 | 169 | |
| 269 | | -### 3. Multi-adapter composition |
| 170 | +### Multi-adapter composition |
| 270 | 171 | |
| 271 | 172 | ```sh |
| 272 | | -uv run dlm prompt mydoc.dlm "Explain the runbook" --adapter knowledge |
| 273 | | -uv run dlm export mydoc.dlm --adapter-mix knowledge:1.0,tone:0.5 |
| 173 | +dlm prompt mydoc.dlm "Explain the runbook" --adapter knowledge |
| 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 | 179 | ```sh |
| 279 | | -uv run dlm train mydoc.dlm --watch |
| 280 | | -uv run dlm repl mydoc.dlm |
| 281 | | -uv run dlm metrics mydoc.dlm |
| 180 | +dlm export mydoc.dlm --target ollama --name mydoc |
| 181 | +dlm export mydoc.dlm --target llama-server |
| 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 | 188 | ```sh |
| 287 | | -uv run dlm export mydoc.dlm --target ollama --name mydoc |
| 288 | | -uv run dlm export mydoc.dlm --target llama-server |
| 289 | | -uv run dlm export mydoc.dlm --target vllm |
| 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 |
| 189 | +dlm preference mine mydoc.dlm --samples 4 --max-pairs 8 |
| 190 | +dlm preference apply mydoc.dlm |
| 191 | +dlm train mydoc.dlm --phase preference |
| 293 | 192 | ``` |
| 294 | 193 | |
| 295 | | -On Apple Silicon, `--target vllm` now emits conservative `vllm-metal` |
| 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 |
| 194 | +### Generate synthetic training data |
| 302 | 195 | |
| 303 | 196 | ```sh |
| 304 | | -uv run dlm preference mine mydoc.dlm --samples 4 --max-pairs 8 |
| 305 | | -uv run dlm preference list mydoc.dlm |
| 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 |
| 197 | +dlm synth instructions mydoc.dlm --teacher self --apply |
| 198 | +dlm synth instructions mydoc.dlm --teacher openai:gpt-4o-mini --apply |
| 314 | 199 | ``` |
| 315 | 200 | |
| 316 | | -### 7. Scaffold multimodal or audio docs |
| 201 | +### Multimodal and audio documents |
| 317 | 202 | |
| 318 | 203 | ```sh |
| 319 | | -uv run dlm init diagrams.dlm --multimodal --base qwen2-vl-2b-instruct |
| 320 | | -uv run dlm train diagrams.dlm |
| 321 | | -uv run dlm prompt diagrams.dlm --image figures/system.png "What is happening here?" |
| 204 | +dlm init diagrams.dlm --multimodal --base qwen2-vl-2b-instruct |
| 205 | +dlm train diagrams.dlm |
| 206 | +dlm prompt diagrams.dlm --image figures/arch.png "What is this?" |
| 322 | 207 | |
| 323 | | -uv run dlm init calls.dlm --audio |
| 324 | | -uv run dlm train calls.dlm |
| 325 | | -uv run dlm prompt calls.dlm --audio clips/example.wav "Summarize the clip" |
| 208 | +dlm init calls.dlm --audio |
| 209 | +dlm train calls.dlm |
| 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 | 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 |
| 335 | | -document-level training data, and the next train closes the gap. |
| 336 | | - |
| 337 | | -### 9. Inspect store state and reproducibility |
| 219 | +### Pack and share |
| 338 | 220 | |
| 339 | 221 | ```sh |
| 340 | | -uv run dlm doctor |
| 341 | | -uv run dlm show mydoc.dlm --json |
| 342 | | -uv run dlm metrics mydoc.dlm --run-id 7 --json |
| 343 | | -uv run dlm pack mydoc.dlm --include-exports |
| 344 | | -uv run dlm verify mydoc.dlm.pack |
| 222 | +dlm pack mydoc.dlm --include-exports |
| 223 | +dlm verify mydoc.dlm.pack |
| 224 | +dlm push mydoc.dlm --to hf:org/name |
| 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 | |
| 354 | | -| Train | `train`, `doctor`, `metrics`, `harvest` | Run training, inspect plans, observe runs, pull eval misses back in | |
| 355 | | -| Align | `preference` | Mine, stage, apply, revert, and inspect auto-mined preference sections | |
| 356 | | -| Infer | `prompt`, `repl` | Local interactive and one-shot inference | |
| 357 | | -| Ship | `export`, `pack`, `unpack`, `verify`, `push`, `pull`, `serve` | Export to runtimes, bundle, verify, and move artifacts | |
| 239 | +| NVIDIA CUDA (SM >= 8.0) | bf16 + QLoRA 4-bit + FlashAttention | Ollama, GGUF, llama-server, vLLM | |
| 240 | +| NVIDIA CUDA (SM < 8.0) | fp16 LoRA | Ollama, GGUF, llama-server, vLLM | |
| 241 | +| Apple Silicon (MPS) | fp16 LoRA | Ollama, GGUF, MLX inference, mlx-serve | |
| 242 | +| CPU | inference only (training refused above small bases) | GGUF, Ollama, llama-server | |
| 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 | 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 | 281 | ## Documentation |
| 362 | 282 | |
| 363 | 283 | - [Getting started](./docs/getting-started/install.md) |
| 364 | 284 | - [Frontmatter reference](./docs/format/frontmatter.md) |
| 365 | 285 | - [Section grammar](./docs/format/sections.md) |
| 366 | | -- [Preference section reference](./docs/format/preference-section.md) |
| 286 | +- [CLI reference](./docs/cli/reference.md) |
| 367 | 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 | 288 | - [Multi-adapter composition](./docs/cookbook/multi-adapter.md) |
| 372 | | -- [Learned adapter gate](./docs/cookbook/learned-adapter-gate.md) |
| 373 | | -- [Self-improving loop / preference mining](./docs/cookbook/self-improving-loop.md) |
| 374 | | -- [Reward-model integration](./docs/cookbook/reward-model-integration.md) |
| 289 | +- [Multi-target export](./docs/cookbook/multi-target-export.md) |
| 290 | +- [Self-improving loop](./docs/cookbook/self-improving-loop.md) |
| 291 | +- [Synthesize training data](./docs/cookbook/synthesize-training-data.md) |
| 375 | 292 | - [Multimodal training](./docs/cookbook/multimodal-training.md) |
| 376 | 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 | 294 | - [Architecture](./docs/architecture.md) |
| 382 | 295 | - [Determinism](./docs/determinism.md) |
| 383 | 296 | |
| 384 | 297 | ## Principles |
| 385 | 298 | |
| 386 | | -1. **The document is the interface.** |
| 387 | | - But the document is structured: frontmatter, typed sections, directives, and |
| 388 | | - store contracts all matter. |
| 389 | | -2. **Training is real.** |
| 390 | | - LoRA / QLoRA / DoRA on pretrained bases, not a toy transformer. |
| 391 | | -3. **Retraining should not silently forget.** |
| 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. |
| 299 | +1. **The document is the interface.** Frontmatter, typed sections, directives, |
| 300 | + and store contracts — not a dashboard. |
| 301 | +2. **Training is real.** LoRA / QLoRA / DoRA on pretrained bases. |
| 302 | +3. **Retraining should not silently forget.** Replay-backed accumulation. |
| 303 | +4. **Local-first is load-bearing.** Your data stays on your machine. |
| 304 | +5. **Determinism is a contract.** Locks, pinned versions, golden checks. |
| 398 | 305 | |
| 399 | 306 | ## Tech Stack |
| 400 | 307 | |
| 401 | | -Python 3.11+ · PyTorch · HuggingFace `transformers` / `peft` / `trl` / |
| 402 | | -`accelerate` / `datasets` · `watchfiles` · `prompt-toolkit` · `safetensors` · |
| 403 | | -vendored `llama.cpp` for GGUF export · Ollama (optional runtime target) · |
| 404 | | -Typer · Pydantic · `uv` |
| 308 | +Python 3.11+ · PyTorch · HuggingFace transformers / peft / trl / accelerate · |
| 309 | +vendored llama.cpp for GGUF · Ollama · Typer · Pydantic · uv |
| 405 | 310 | |
| 406 | 311 | ## Contributing |
| 407 | 312 | |
| 408 | | -See [CONTRIBUTING.md](./CONTRIBUTING.md). Testing conventions live in |
| 409 | | -[docs-internal/README-testing.md](./docs-internal/README-testing.md). |
| 410 | | - |
| 411 | | -```sh |
| 412 | | -uv run pre-commit install |
| 413 | | -``` |
| 313 | +See [CONTRIBUTING.md](./CONTRIBUTING.md). |
| 414 | 314 | |
| 415 | 315 | ## License |
| 416 | 316 | |
| 417 | | -MIT. Base-model licenses are separate and enforced where DLM needs them: |
| 418 | | -`dlm init`, `dlm train`, `dlm export`, and `dlm pack` all keep the gated-base |
| 419 | | -acceptance path explicit. |
| 317 | +MIT. Base-model licenses are separate and enforced at `dlm init`, `dlm train`, |
| 318 | +`dlm export`, and `dlm pack`. |