Hardware Diagnostics Advisor — LoRA Adapter for Llama 3.2 3B
Author: Sam Kirk
A LoRA adapter that teaches Llama 3.2 3B Instruct to reason about hardware diagnostics from first principles — grounding its analysis in physics rather than rote procedures. Trained entirely on Apple Silicon using MLX.
Model Description
This adapter fine-tunes Meta's Llama 3.2 3B Instruct (4-bit quantized) for physics-first hardware diagnostics advisory. The model learns to:
Analyze numerical diagnostic data (TDR sweeps, thermal surveys, ADC histograms, voltage margining, boundary scan results)
Identify anomalies and failure signatures in test data
Ground explanations in underlying physics (signal integrity, thermodynamics, semiconductor behavior)
Provide structured diagnostic reasoning instead of generic troubleshooting steps
The base model fails badly on numerical diagnostic prompts — hallucinating data, miscounting failures, and missing obvious anomaly patterns. This adapter addresses that gap.
Each answer is grounded in first-principles physics rather than rote procedures.
Results
Metric
Value
Initial val loss
2.809
Final val loss
2.037
Val loss reduction
27.5%
Final train loss
1.925
Train-val gap
0.112 (healthy, no overfitting)
The learning curve shows classic exponential decay: 85% of improvement was captured in the first 200 iterations, with diminishing returns thereafter. The small train-val gap (0.112) indicates strong generalization — expected given that only 0.108% of parameters are trainable.
Usage
With mlx-lm (recommended for Apple Silicon)
python
1from mlx_lm import load, generate
23# Load base model with LoRA adapter4model, tokenizer = load(5"models/llama-3.2-3b-4bit",# local path to base model6 adapter_path="MrBesterTester/hw-diagnostics-advisor-llama3.2-3b-lora"7)89# Format prompt using Llama 3.2 chat template10messages =[11{"role":"system","content":"You are a hardware diagnostics expert who explains issues using physics first principles."},12{"role":"user","content":"A TDR sweep on a 50-ohm PCB trace shows impedance rising to 68 ohms at 4.2 inches from the connector. What's happening physically?"}13]1415prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)16response = generate(model, tokenizer, prompt=prompt, max_tokens=512)17print(response)
With mlx-lm CLI
bash
1# Generate with the adapter applied2mlx_lm.generate \3 --model models/llama-3.2-3b-4bit \4 --adapter-path MrBesterTester/hw-diagnostics-advisor-llama3.2-3b-lora \5 --max-tokens 512\6 --prompt "Explain why a boundary scan test might show intermittent failures on a BGA package."
Files
File
Description
adapters.safetensors
Final LoRA adapter weights (13.9 MB)
adapter_config.json
Full training configuration (LoRA params, hyperparameters)
Limitations
Trained on a relatively small dataset (385 examples) — may not generalize to all hardware diagnostics scenarios
Base model is 4-bit quantized; adapter was trained against and should be used with the quantized model
Adapter is in MLX safetensors format — designed for use with mlx-lm on Apple Silicon
Physics explanations reflect the training data's perspective and may not cover all edge cases