dlmastery/data_science_examples/nano-llm-transformer
Claude Code and agent skill by dlmastery/data_science_examples
- community
Checking that the SKILL.md file is still in the repository.
Comprehensive guide and autonomous runbook for building, training, and deploying NanoLlama — a from-scratch Modern Transformer Language Model and Chatbot. Covers Rotary Position Embeddings (RoPE), SwiGLU Gated Feed-Forward Networks, RMSNorm, Stateful KV-Cache O(1) decoding, subword tokenizer training, AdamW Cosine Annealing scheduler, FastAPI SSE streaming, attention heatmaps visualizer, and React Tokenizer Studio.
Install
npx vskill@latest install dlmastery/data_science_examples/nano-llm-transformerSKILL.md
The same SKILL.md was published earlier as dlmastery/data_science_examples/nano-llm-transformer.
NanoLlama — Modern Transformer LLM & Chatbot Platform Reproduction Runbook
This skill provides the complete end-to-end instructions to build, train, deploy, and verify NanoLlama from scratch using state-of-the-art transformer primitives.
1. Mathematical Primitives & Model Specifications
- Rotary Position Embeddings (RoPE):
$$(x \cos m\theta) + (\text{rotate\_half}(x) \sin m\theta)$$ Enables relative distance awareness across sequence lengths without learned absolute position embeddings.
- SwiGLU Gated Activation:
$$\text{SwiGLU}(x) = (\text{silu}(x W_{\text{gate}}) \odot x W_{\text{up}}) W_{\text{down}}$$
- RMSNorm Pre-Normalization:
$$\text{RMSNorm}(x) = \frac{x}{\text{RMS}(x)} \odot \gamma$$
- Key-Value Cache (KV-Cache):
Maintains key and value state tensors across sequential token generation steps for $O(1)$ autoregressive decoding.
- Dimensions: 3 Layers, 4 Heads, $d_{\text{model}} = 128$, FFN hidden dim $= 384$, context window $= 96$, total parameters $= 672,512$.
2. Step-by-Step Reproduction Workflow
Step 1: Tokenizer & Dataset Generation
Run subword tokenizer training and build synthetic multi-task conversational dataset:
Step 2: Model Training Loop
Train NanoLlama on CPU / GPU with AdamW and Cosine Learning Rate Schedule:
- Target Metrics: Validation Perplexity $< 1.10$, Loss $< 0.06$.
- Checkpoints: Exports
server/checkpoints/model.ptandtelemetry.json.
Step 3: Run Automated API Tests
Verify streaming endpoints, attention tensor extraction, and tokenizer analysis:
Step 4: Launch Microservices
- FastAPI Streaming Microservice (Port 8002):
``bash python -m uvicorn main:app --host 127.0.0.1 --port 8002 ``
- React 18 + Vite Quantum Neural Web App (Port 5175):
``bash cd ../client npm install npm run dev ``
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking02_nano_llm_transformer/.agents/skills/nano-llm-transformer/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dlmastery/data_science_examples/nano-llm-transformer)