Low-rank adaptation diagram showing decomposed weight matrices added to a transformer layer

Build a LoRA Adapter from Scratch: A Portfolio-Ready PyTorch Project

A hands-on build guide for implementing a LoRA adapter from scratch in PyTorch, including rank-decomposed weight matrices and a complete fine-tuning loop for BERT — designed to signal real ML engineering skill on a portfolio.

September 9, 2026 · 13 min · 2665 words · martinuke0
Abstract diagram of a mixture-of-experts router routing tokens to multiple expert networks.

Build a Mixture-of-Experts Router From Scratch in PyTorch

A portfolio-grade project: a pure PyTorch mixture-of-experts router with top-k gating, expert load-balancing loss, and Switch-style capacity factors — with runnable code, tests, and a roadmap to senior-level extensions.

September 5, 2026 · 15 min · 3051 words · martinuke0

Mastering Semantic Caching Strategies for Lightning Fast Large Language Model Applications

Table of Contents Introduction Why Traditional Caching Falls Short for LLMs Core Concepts of Semantic Caching 3.1 Embedding‑Based Keys 3.2 Similarity Metrics 3.3 Cache Invalidation & Freshness Major Semantic Cache Types 4.1 Embedding Cache 4.2 Prompt Cache 4.3 Result Cache (Answer Cache) Design Patterns for Scalable Semantic Caching 5.1 Hybrid Cache Layers 5.2 Vector Store Integration 5.3 Sharding & Replication Step‑by‑Step Implementation (Python + OpenAI API) 6.1 Setting Up the Vector Store 6.2 Cache Lookup Logic 6.3 Cache Write‑Back & TTL Management Performance Evaluation & Benchmarks Best Practices & Gotchas Future Directions in Semantic Caching for LLMs Conclusion Resources Introduction Large language models (LLMs) have transformed everything from chatbots to code assistants, but their power comes at a cost: latency and compute expense. For high‑traffic applications, the naïve approach of sending every user request directly to the model quickly becomes unsustainable. Traditional caching—keyed by raw request strings—offers limited relief because even slight phrasing changes invalidate the cache entry. ...

March 26, 2026 · 9 min · 1882 words · martinuke0
Feedback