happy-llm
ModelFree📚 从零开始构建大模型
Capabilities10 decomposed
transformer-architecture-from-scratch implementation tutorial
Medium confidenceProvides hands-on Jupyter notebook-based implementation of core transformer components (multi-head attention, feed-forward layers, positional encoding, encoder-decoder stacks) with progressive complexity. Uses PyTorch to build each component incrementally, allowing learners to understand attention mechanisms, layer normalization, and residual connections through direct code implementation rather than black-box APIs. The tutorial decomposes the transformer into atomic building blocks with mathematical explanations paired to working code.
Decomposes transformer architecture into pedagogical progression across chapters 2-5, with each component (attention, encoder-only, encoder-decoder, decoder-only, LLaMA2) built incrementally using pure PyTorch rather than relying on HuggingFace abstractions, enabling learners to modify and experiment with architectural choices directly
More granular than fast-track transformer tutorials because it separates theoretical foundations (chapter 2) from encoder variants (chapter 3) from full LLM implementation (chapter 5), allowing learners to stop and deeply understand each paradigm rather than jumping to inference
llama2 model architecture implementation from scratch
Medium confidenceComplete PyTorch implementation of LLaMA2 decoder-only architecture including rotary position embeddings (RoPE), grouped query attention (GQA), and SwiGLU activation functions. The tutorial builds the full model stack from embedding layers through multi-head attention blocks to output projection, with code organized to mirror the original LLaMA2 paper architecture. Includes parameter initialization strategies and attention masking patterns specific to autoregressive generation.
Implements LLaMA2-specific architectural innovations (grouped query attention for efficiency, rotary position embeddings for better extrapolation, SwiGLU gating) as standalone, modifiable PyTorch modules rather than wrapped black-box implementations, enabling learners to understand and experiment with each design choice
More detailed than loading pretrained LLaMA2 weights because it requires implementing the exact architecture from scratch, forcing understanding of why each component exists rather than treating the model as a black box
pre-training pipeline and training practices tutorial
Medium confidenceComprehensive guide covering the complete pre-training workflow including data preparation, tokenization strategies, loss computation (causal language modeling), learning rate scheduling, gradient accumulation, and mixed-precision training. The tutorial explains training efficiency techniques like activation checkpointing and distributed data parallelism patterns, with code examples showing how to implement each optimization. Includes best practices for monitoring training stability and convergence.
Organizes training practices into modular, reusable components (data loaders, loss functions, optimization loops) with explicit code showing efficiency techniques like gradient accumulation and mixed precision as separate, composable layers rather than hidden in framework abstractions
More transparent than using HuggingFace Trainer because it exposes the training loop implementation, allowing learners to understand and modify each optimization step rather than relying on framework defaults
model architecture comparison across paradigms (encoder-only, encoder-decoder, decoder-only)
Medium confidenceStructured tutorial comparing three fundamental transformer paradigms with side-by-side implementations: encoder-only models (BERT, RoBERTa, ALBERT) for bidirectional understanding with masked language modeling, encoder-decoder models (T5, BART) for sequence-to-sequence tasks, and decoder-only models (GPT, LLaMA) for autoregressive generation. Each paradigm is implemented from scratch with explanations of architectural differences, attention masking patterns, and training objectives specific to each approach.
Organizes three major transformer paradigms into parallel chapters (chapter 3) with identical implementation patterns, making architectural differences explicit through code rather than conceptual descriptions, enabling direct comparison of attention masking, loss computation, and training objectives
More systematic than scattered tutorials because it treats encoder-only, encoder-decoder, and decoder-only as equal-weight design choices with comparable implementations, rather than positioning decoder-only as the default and others as variants
rag (retrieval-augmented generation) system implementation
Medium confidenceTutorial implementing a complete RAG pipeline that combines document retrieval with LLM generation. The system includes vector embedding generation, similarity-based document retrieval from a knowledge base, prompt augmentation with retrieved context, and generation from the augmented prompt. The implementation covers retrieval strategies (dense retrieval with embeddings, sparse retrieval with BM25), ranking mechanisms, and integration patterns between retriever and generator components.
Implements RAG as a modular pipeline with separate, swappable components for embedding generation, retrieval, ranking, and generation, allowing learners to understand each stage independently and experiment with different retrieval strategies without modifying the generation component
More transparent than using LangChain RAG chains because it shows the underlying retrieval and ranking logic explicitly, enabling customization and debugging of retrieval quality rather than treating it as a black box
agent system design and implementation
Medium confidenceTutorial covering agent architectures that combine LLMs with tool-use capabilities, planning, and reasoning. The implementation includes action-observation loops where agents decompose tasks into steps, call external tools (APIs, calculators, search engines), process results, and generate next actions. Covers agent planning strategies (ReAct pattern with reasoning and acting, chain-of-thought decomposition), tool schema definition, and integration with LLM function-calling APIs.
Implements agent loops as explicit state machines with clear separation between reasoning (LLM decision-making), action (tool execution), and observation (result processing) phases, allowing learners to understand and modify each stage independently rather than using framework abstractions
More educational than using LangChain agents because it exposes the action-observation loop logic explicitly, enabling understanding of how agents handle tool failures, parse LLM outputs, and maintain context across multiple steps
nlp fundamentals and tokenization strategies tutorial
Medium confidenceFoundational tutorial covering core NLP concepts including text preprocessing, tokenization approaches (word-level, subword-level with BPE and SentencePiece), vocabulary construction, and token embedding initialization. The tutorial explains why different tokenization strategies matter for different languages and tasks, with code examples showing how to implement tokenizers from scratch and use pretrained tokenizers. Includes analysis of vocabulary size trade-offs and handling of out-of-vocabulary words.
Implements tokenization algorithms (BPE, SentencePiece) from scratch in Python, showing the exact mechanics of vocabulary construction and token merging rather than using library implementations, enabling learners to understand and modify tokenization behavior
More transparent than using HuggingFace tokenizers directly because it shows the underlying algorithm implementation, allowing customization for domain-specific vocabularies and understanding of tokenization trade-offs
model evaluation and benchmark assessment tutorial
Medium confidenceTutorial covering evaluation methodologies for language models including perplexity calculation, task-specific metrics (BLEU for translation, ROUGE for summarization, exact match and F1 for QA), and benchmark datasets (GLUE, SuperGLUE, SQuAD). The tutorial explains how to implement evaluation metrics from scratch, interpret results correctly, and understand limitations of each metric. Includes guidance on selecting appropriate benchmarks for different model types and applications.
Implements standard evaluation metrics (perplexity, BLEU, ROUGE, F1) from scratch with mathematical explanations, showing exactly how each metric is computed rather than using library functions, enabling understanding of metric strengths and limitations
More educational than using evaluate library directly because it shows metric computation logic explicitly, allowing learners to understand what each metric measures and when it's appropriate to use
structured learning progression from theory to implementation
Medium confidenceThe tutorial is organized as a hierarchical learning system that progresses from theoretical foundations (chapters 1-4: NLP basics, transformer architecture, model families) to practical implementation (chapters 5-7: building LLMs, training pipelines, applications). Each chapter builds on previous knowledge with integrated theory and code, using Jupyter notebooks to interleave mathematical explanations with executable PyTorch implementations. The progression enables learners to understand concepts deeply before implementing them.
Organizes content as a complete learning system with explicit progression from theory (chapters 1-4) to implementation (chapters 5-7), with each chapter building on previous knowledge and including both mathematical explanations and executable code, rather than treating theory and practice as separate
More comprehensive than individual tutorials because it provides a complete curriculum from NLP basics to production LLM applications, allowing learners to understand the full development lifecycle rather than isolated topics
hands-on code implementation with jupyter notebooks
Medium confidenceThe entire tutorial is delivered as executable Jupyter notebooks that interleave explanatory text, mathematical formulas (LaTeX), and runnable Python code. Each notebook is self-contained with imports, function definitions, and example executions, allowing learners to run code immediately and experiment with modifications. The notebooks use PyTorch for all implementations and include visualizations of attention weights, loss curves, and model outputs.
Delivers all content as executable Jupyter notebooks with integrated theory and code, allowing learners to run examples immediately and modify code to experiment, rather than providing separate documentation and code repositories
More interactive than reading documentation because learners can execute code, modify parameters, and see results immediately without setting up separate development environments
Capabilities are decomposed by AI analysis. Each maps to specific user intents and improves with match feedback.
Related Artifactssharing capabilities
Artifacts that share capabilities with happy-llm, ranked by overlap. Discovered automatically through the match graph.
CS25: Transformers United V2 - Stanford University

11-667: Large Language Models Methods and Applications - Carnegie Mellon University

llm-course
Course to get into Large Language Models (LLMs) with roadmaps and Colab notebooks.
CS25: Transformers United V3 - Stanford University

Practical Deep Learning for Coders part 2: Deep Learning Foundations to Stable Diffusion - fast.ai

Build a DeepSeek Model (From Scratch)
A book about implementing DeepSeek-style LLM architecture, training, and distillation methods.
Best For
- ✓ML engineers and researchers building custom transformer variants
- ✓students learning deep learning fundamentals with hands-on coding
- ✓developers transitioning from traditional NLP to transformer-based approaches
- ✓researchers implementing custom LLM variants based on LLaMA architecture
- ✓engineers fine-tuning or adapting LLaMA2 weights for specific domains
- ✓students studying modern LLM design patterns beyond vanilla transformers
- ✓ML engineers building custom language models from scratch
- ✓researchers experimenting with training techniques and hyperparameter choices
Known Limitations
- ⚠Tutorial implementations are educational, not optimized for production inference speed or memory efficiency
- ⚠No distributed training examples for multi-GPU setups in core transformer chapters
- ⚠Limited coverage of modern optimizations like FlashAttention or quantization techniques
- ⚠Implementation focuses on model architecture, not inference optimization (no KV-cache implementation details)
- ⚠No distributed training code for multi-node setups
- ⚠Assumes familiarity with transformer basics; not suitable as first introduction to transformers
Requirements
Input / Output
UnfragileRank
UnfragileRank is computed from adoption signals, documentation quality, ecosystem connectivity, match graph feedback, and freshness. No artifact can pay for a higher rank.
Repository Details
Last commit: Mar 16, 2026
About
📚 从零开始构建大模型
Categories
Alternatives to happy-llm
Are you the builder of happy-llm?
Claim this artifact to get a verified badge, access match analytics, see which intents users search for, and manage your listing.
Get the weekly brief
New tools, rising stars, and what's actually worth your time. No spam.
Data Sources
Looking for something else?
Search →