Detached LoRA Training Launch and Metric Multiplexing
Agent-Assisted Engineering Check
Prerequisites
Day 67 Preflight verification and Linux process detachment.
Learning Objective
Launch headless adapter fine-tuning in a detached tmux session, streaming real-time metrics to structured telemetry files while separating passive waiting from active study.
Instructions
1. Start training in tmux from the repository root: tmux new-session -d -s lora_train running projects/lora/train.py (smoke mode on CPU; for a real run replace --smoke with --model
2. Stream metrics: tee standard output to lora_training.log; train.py itself appends one JSON line per optimizer step (step, train_loss, lr, elapsed_seconds, mode) to
3. Track memory: monitor nvidia-smi memory allocated; observe that VRAM stays virtually constant without fragmentation spikes.
4. Avoid passive study billing: decouple hours of GPU execution from active analytical study minutes.
Practice & Prediction Log
Launch a detached training session. Verify using ps and tail -f that it runs continuously in the background and writes structured loss entries.
Check telemetry.jsonl contains 'step', 'train_loss', and 'lr'.
# Launch command (run from the repository root):
tmux new-session -d -s lora_train '.venv/bin/python projects/lora/train.py --smoke --data-path data/instruction_sample.jsonl --work-dir runs/lora-detached --max-iters 2000 2>&1 | tee -a lora_training.log'
# Follow the per-step log:
tail -f runs/lora-detached/telemetry.jsonl
# Each line looks like: {"step": 1, "train_loss": 4.08, "lr": 0.0002, "elapsed_seconds": 0.01, "mode": "smoke"}
Deploy persistent detached LoRA training with robust multi-stream telemetry logging.
Authoritative Source Resources & Provenance
Stanford Alpaca: An Instruction-following LLaMA Model
Relevant Section / Range: Training recipe
Verified Version & Date: Stanford CRFM Release (Verified: 2026-10-30)
Original open recipe demonstrating lightweight instruction fine-tuning of open models, establishing prompt/response templates, batch scheduling, and learning rate ranges.
Supervised fine-tuning, instruction formatting, and LoRA fundamentals.
Complete instruction templates, JSONL formatting scripts, and learning rate schedules are self-contained in curriculum materials.
Compared Candidate Sources & Selection Analysis (2)
Multi-turn ShareGPT tuning recipe; Alpaca provides simpler, single-turn clarity ideal for foundational instruction tuning study.
Commercially permissive crowdsourced dataset; Alpaca established the academic instruction tuning standard.
LoRA: Low-Rank Adaptation of Large Language Models
Relevant Section / Range: N/A
Verified Version & Date: ICLR 2022 / arXiv:2106.09685v2 (Verified: 2026-10-30)
Primary literature introducing Low-Rank Adaptation, establishing parameter decomposition W = W0 + (alpha/r)*BA, initialization strategies, and zero inference latency merging.
Matrix factorization, rank, linear layers, and transformer attention.
Complete matrix derivations, tensor dimensions, and pure PyTorch LoRALinear modules are implemented directly in lesson code.
Compared Candidate Sources & Selection Analysis (2)
Introduces bottleneck adapter layers in series, which introduces unavoidable inference latency overhead; LoRA's parallel formulation merges with zero latency.
Prepends virtual prompt tokens; reduces available context length, unlike LoRA which preserves full sequence capacity.