84 lines
2.5 KiB
YAML
84 lines
2.5 KiB
YAML
# Delentia SLM — JITNA v3 Fine-tuning Configuration
|
||
# Base: Llama 3.1 8B (Apache 2.0, Thai-capable)
|
||
# Method: Unsloth QLoRA (4-bit) — optimized for T4 16GB / A100 40GB
|
||
|
||
model:
|
||
# Unsloth 4-bit quantized base (no separate quantization step needed)
|
||
base_model: "unsloth/Meta-Llama-3.1-8B-bnb-4bit"
|
||
tokenizer: "unsloth/Meta-Llama-3.1-8B-bnb-4bit"
|
||
max_seq_length: 4096 # covers most JITNA v3 packets + context
|
||
dtype: null # auto-detect: bfloat16 on A100, float16 on T4
|
||
load_in_4bit: true
|
||
|
||
lora:
|
||
r: 16 # rank — balanced: 8 (fast) vs 32 (quality)
|
||
lora_alpha: 32 # usually 2×r
|
||
lora_dropout: 0
|
||
bias: "none"
|
||
use_rslora: true # Rank-Stabilized LoRA — better convergence
|
||
target_modules:
|
||
- "q_proj"
|
||
- "k_proj"
|
||
- "v_proj"
|
||
- "o_proj"
|
||
- "gate_proj"
|
||
- "up_proj"
|
||
- "down_proj"
|
||
task_type: "CAUSAL_LM"
|
||
|
||
training:
|
||
# Dataset
|
||
dataset_path: "datasets/processed/jitna_pairs.jsonl"
|
||
dataset_split: "train"
|
||
validation_split: 0.05 # 5% held out for validation
|
||
max_samples: null # null = use all available
|
||
|
||
# Batch & gradient
|
||
per_device_train_batch_size: 1
|
||
gradient_accumulation_steps: 8
|
||
# Effective batch = 1 × 8 = 8
|
||
|
||
# Learning rate
|
||
learning_rate: 2.0e-4
|
||
lr_scheduler_type: "cosine"
|
||
warmup_ratio: 0.05
|
||
num_train_epochs: 3
|
||
|
||
# Precision & optimizer
|
||
bf16: true # set false if T4 (use fp16 instead)
|
||
fp16: false
|
||
optim: "adamw_8bit"
|
||
weight_decay: 0.01
|
||
max_grad_norm: 0.3
|
||
|
||
# Saving
|
||
output_dir: "models/checkpoints"
|
||
save_strategy: "epoch"
|
||
save_total_limit: 3
|
||
logging_steps: 10
|
||
|
||
# Evaluation
|
||
evaluation_strategy: "epoch"
|
||
load_best_model_at_end: true
|
||
metric_for_best_model: "eval_loss"
|
||
|
||
# Chat template — JITNA v3 intent format
|
||
chat_template: |
|
||
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
||
{{ system_context }}<|eot_id|>
|
||
<|start_header_id|>user<|end_header_id|>
|
||
{{ user_intent }}<|eot_id|>
|
||
<|start_header_id|>assistant<|end_header_id|>
|
||
|
||
# MLflow experiment tracking
|
||
mlflow:
|
||
experiment_name: "delentia-slm-jitna-v0.1"
|
||
tracking_uri: "http://localhost:5000"
|
||
log_model: true
|
||
|
||
# Target metrics (gates for acceptance)
|
||
target_metrics:
|
||
jitna_compliance: 0.94 # >= 94% JITNA v3 schema compliance
|
||
fdia_avg: 0.87 # avg F score >= 0.87
|
||
hallucination_rate: 0.028 # <= 2.8% factual errors
|