SuperAPIAI Directory

LLM‑RL‑Visualized (EN)

github.com · AI developer platforms

LLM-RL-Visualized is an open-source project that provides more than 100 original schematic diagrams, systematically visualizing the core algorithms and processes of large language models (LLMs) and reinforcement learning (RL). The content covers LLM fundamentals and architecture, generation and decoding, SFT fine-tuning techniques (such as LoRA and Prefix-Tuning), DPO preference optimization, RL basic concepts and algorithms (such as DQN and policy gradients), policy optimization variants (such as PPO and GRPO), RLHF/RLAIF alignment methods, reasoning capability optimization (such as CoT distillation and MCTS), as well as performance optimization and extended knowledge (such as quantization, attention mechanisms, and positional encoding). The project is inspired by the book "Large Model Algorithms: Reinforcement Learning, Fine-Tuning, and Alignment" and is continuously updated. It is suitable for learners, researchers, and engineers to intuitively understand complex algorithm principles through diagrams. All diagrams can be clicked to view high-definition versions or opened as SVG files for infinite zooming.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

LLM-RL-Visualized is an open-source project focused on visualizing the algorithms of large language models (LLMs) and reinforcement learning (RL). The project provides more than 100 original schematic diagrams, aiming to help understand complex algorithms and processes through intuitive diagrams. The content is inspired by the book "Large Model Algorithms: Reinforcement Learning, Fine-Tuning, and Alignment" and is continuously expanding.

Main capabilities and content coverage:

  • LLM fundamentals: including LLM overview, architecture, generation and decoding, input and output processing, multimodal models (MLLM/VLM), and the training process.
  • Supervised fine-tuning (SFT): covering the classification of fine-tuning techniques, LoRA (low-rank adaptation), Prefix-Tuning, Token and Token ID, cross-entropy loss, sample packing, and more.
  • Direct preference optimization (DPO): comparing RLHF and DPO, explaining the principles of DPO, an overview of training, the impact of the β parameter, and the effect of implicit reward differences on parameter updates.
  • Training-free optimization: including chain-of-thought (CoT) and its variants (Self-consistency CoT, ToT, GoT), search strategies (exhaustive, greedy, beam search), sampling methods (multinomial sampling, Top-K, Top-P), RAG (retrieval-augmented generation), and function calling.
  • Reinforcement learning fundamentals: RL history, the three major machine learning paradigms, basic architecture and concepts, Markov chains and MDPs, ε-greedy policy, return calculation, value functions (Qπ and Vπ), Monte Carlo and temporal difference (TD) methods, DQN and its overestimation problem, value-based versus policy-based comparison, policy gradients, multi-agent reinforcement learning (MARL), imitation learning, behavior cloning, inverse reinforcement learning, model-based and model-free methods, hierarchical RL, distributed RL, and more.
  • Policy optimization and variants: Actor-Critic, comparison of baseline and advantage, GAE (generalized advantage estimation), TRPO and trust region, importance sampling, PPO-Clip, the policy model update process in PPO training, PPO pseudocode, comparison of GRPO and PPO, deterministic policies versus stochastic policies, DPG, DDPG, and more.
  • RLHF and RLAIF: RL modeling of language models, the two-stage training process of RLHF, reward model architecture and input/output, reward bias and loss, reward model training, the relationship and initialization of the four models in PPO, the KL calculation process, PPO-based RLHF training, rejection sampling fine-tuning, RLAIF vs. RLHF comparison, CAI (Constitutional AI), OpenAI's rule-based rewards (RBR), etc.
  • Reasoning capability optimization: CoT-based knowledge distillation, DeepSeek-based distillation, ORM (Outcome Reward Model) and PRM (Process Reward Model), the four key steps of MCTS (Monte Carlo Tree Search) with a search tree example, BoN (Best-of-N) sampling, majority voting, AlphaGo Zero performance growth, etc.
  • LLM foundational extensions: large model performance optimization map, ALiBi positional encoding, traditional knowledge distillation, numerical representation and quantization, forward and backward propagation, gradient accumulation, gradient checkpointing, full recomputation, LLM benchmarks, MHA/GQA/MQA/MLA attention mechanisms, RNN, Pre-norm and Post-norm, BatchNorm and LayerNorm, RMSNorm, pruning, the role of the temperature coefficient, SwiGLU, AUC/PR/F1/precision/recall, RoPE positional encoding and its impact on sequence positions and dimensions, etc.

Usage: Users can access all charts through the GitHub repository, click any image to view a high-definition version, or open the corresponding .svg file for infinite zooming. The project encourages following updates via Star.

Applicable scenarios: Suitable for machine learning learners, researchers, and engineers as a learning reference, for intuitively understanding the principles of LLM and RL algorithms, assisting teaching, or technical sharing.

Limitations: The project is a collection of visualization charts and does not provide executable code or interactive tools; specific implementation details need to be referenced from the original book or related literature. Some content may change with updates, and it is recommended to refer to the latest version of the repository.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools