ASAysha Shafiq
LLM SYSTEMS · MODEL ALIGNMENT

SmolLM Alignment Lab

I implemented a 135M-parameter decoder-only language model in PyTorch, matched the reference model, then added optimized decoding, LoRA fine-tuning, and DPO preference alignment.

100% top-1 reference agreement
8.50× faster decode throughput
0.73% trainable parameters with LoRA
Preference accuracy · 76% → 87%

The model, implemented explicitly

The architecture is built from framework-native PyTorch modules so each transformer mechanic stays inspectable and testable.

Inference without changing the answer

The fast path layers fused SDPA, native grouped-query attention, per-layer KV caching, and optional compilation behind parity checks.

Efficient fine-tuning and alignment

LoRA adapts attention and MLP projections while DPO scores response tokens only, excluding prompt and padding tokens.

Second Time AroundAI-Generated Code ReliabilityCS 220 AI Learning Infrastructure