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.

Training Details

Parameter Value
Base model meta-llama/Llama-3.2-3B-Instruct (4-bit quantized, ~2 GB)
Framework Apple MLX + mlx-lm (native Apple Silicon)
Hardware M1 iMac, 16 GB unified memory
Method LoRA (Low-Rank Adaptation)
LoRA rank 8
LoRA scale (alpha) 20.0
LoRA dropout 0.0
Adapted layers 8 (top transformer layers)
Trainable parameters 3.473M / 3,212.750M (0.108% of total)
Optimizer Adam
Learning rate 1e-5 (constant)
Batch size 1 (with gradient checkpointing)
Max sequence length 2048
Iterations 600 (~1.95 epochs)
Training time ~47 minutes
Peak memory 3.621 GB

Training Data

385 physics-grounded Q&A pairs across 12 hardware diagnostics categories (308 train / 77 validation), formatted in Alpaca chat template. Topics include:

  • Signal integrity & TDR analysis
  • Thermal analysis & heat dissipation
  • Boundary scan (JTAG) testing
  • Power distribution & voltage margining
  • Memory testing & ECC
  • ADC/DAC characterization
  • PCIe & high-speed serial diagnostics
  • And more

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)

from mlx_lm import load, generate

# Load base model with LoRA adapter
model, tokenizer = load(
    "models/llama-3.2-3b-4bit",  # local path to base model
    adapter_path="MrBesterTester/hw-diagnostics-advisor-llama3.2-3b-lora"
)

# Format prompt using Llama 3.2 chat template
messages = [
    {"role": "system", "content": "You are a hardware diagnostics expert who explains issues using physics first principles."},
    {"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?"}
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=512)
print(response)

With mlx-lm CLI

# Generate with the adapter applied
mlx_lm.generate \
    --model models/llama-3.2-3b-4bit \
    --adapter-path MrBesterTester/hw-diagnostics-advisor-llama3.2-3b-lora \
    --max-tokens 512 \
    --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

License

This adapter inherits the Llama 3.2 Community License.

Citation

If you use this adapter, please cite:

@misc{kirk2026hwdiagnostics,
  author = {Kirk, Sam},
  title = {Hardware Diagnostics Advisor: Physics-First LoRA Adapter for Llama 3.2 3B},
  year = {2026},
  publisher = {HuggingFace},
  url = {https://huggingface.co/MrBesterTester/hw-diagnostics-advisor-llama3.2-3b-lora}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for MrBesterTester/hw-diagnostics-advisor-llama3.2-3b-lora

Adapter
(753)
this model