バックグラウンドLoRA学習の起動とメトリクス多重中継
Agent支援エンジニアリングチェック
前提条件
第67日事前点検およびLinuxプロセスデタッチ技術。
学習目標
tmuxセッションでアダプタ微調をバックグラウンド実行し、構造化テレメトリへ損失・学習率を中継しつつ受動的待ち時間を学習時間に含めない規律を保つ。
手順
1. リポジトリのルートで tmux new-session -d -s lora_train を使い、projects/lora/train.py を起動します(CPUのsmokeモード。実モデルでは --smoke を --model
2. 標準出力を tee で lora_training.log に書き出します。train.py 自身が最適化ステップごとに1行のJSON(step、train_loss、lr、elapsed_seconds、mode)を
3. nvidia-smi でVRAM使用量を監視し、LoRA特有の極小かつフラットなメモリ推移を確認します。
4. GPUの計算待機時間を除外した有効研習時間の管理原則を遵守します。
演習と予測記録
バックグラウンドセッションで学習を開始し、テレメトリログがリアルタイムに更新されていることを確認してください。
tail -f telemetry.jsonl でステップ進行を確認します。
# 起動コマンド(リポジトリのルートで実行):
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'
# ステップごとのログを追跡:
tail -f runs/lora-detached/telemetry.jsonl
# 各行の例: {"step": 1, "train_loss": 4.08, "lr": 0.0002, "elapsed_seconds": 0.01, "mode": "smoke"}
端末切断に耐える常駐型LoRA微調セッションを正常に起動・監視できる。
公式ソースリソースと権利証跡
Stanford Alpaca: An Instruction-following LLaMA Model
該当セクション・タイムスタンプ: Training recipe
検証バージョンと日付: 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.
比較対象候補リソースと選定評価 (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
該当セクション・タイムスタンプ: N/A
検証バージョンと日付: 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.
比較対象候補リソースと選定評価 (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.