Latest notes

19 posts · newest first

  • Generative Models

    Notes on the Four Major AIGC Generative Models: Principles, Derivations, and Pseudocode for VAE, GAN, Normalizing Flow, and Diffusion Models

    Review notes on generative models (generative model: a probabilistic model that learns a data distribution and can sample new examples), written in the same style as the site's Deep Reinforcement Learning Core Algorithms Notes. They first explain the problem framework shared by the four routes (explicit versus implicit density, the mismatch between likelihood and perceptual quality, the limitations of evaluation metrics, and where the training signal comes from), then unfold one by one — along the same skeleton of 'why it is needed → principles and formulas → collapsible derivations → complete pseudocode → section-by-section walkthrough → per-step read/write and state-maintenance checklist → pitfall list → scope of application' — the Variational Autoencoder (VAE), the Generative Adversarial Network (GAN), Normalizing Flow, and the Diffusion Model. The article contains 32 collapsible derivations, covering the complete decomposition of the evidence lower bound, the closed form of the KL divergence between two diagonal Gaussians, the gradient validity of reparameterization, the optimal discriminator and the Jensen-Shannon divergence, the gradient scale of the non-saturating loss, the Kantorovich-Rubinstein duality of the Wasserstein distance, the vanishing JS gradient when distributions do not overlap, the change-of-variables formula, the triangular Jacobian of coupling layers, the log-determinant of the invertible 1×1 convolution, the instantaneous change of variables and trace estimation of continuous flows, the closed-form forward marginal distribution, the term-by-term rearrangement of the evidence lower bound, the simplified loss, the Tweedie formula and the denoising equivalence, the deterministic update of DDIM, why the importance-weighted bound is tighter than the evidence lower bound, the Lagrangian interpretation of β-VAE and free bits, the variational lower bound of an arbitrary f-divergence and its optimal discriminator for f-GAN, why the gradient penalty of WGAN-GP is equivalent to a gradient norm of one, the inverse transform of coupling layers and the triangular Jacobian of autoregressive flows, dequantization and the +log2 256 volume factor in bits per dimension, the signal-to-noise-ratio weighting implied by the simplified loss, and the source of the score in classifier-free guidance and the extrapolation of γ>1, as well as the saddle-point difference between the GAN minimax and the VAE maximized lower bound, FID as the Fréchet distance between two Gaussians in feature space, the equivalence between the reconstruction term and the mean squared error, the quantitative condition for posterior collapse, the Lipschitz upper bound of spectral normalization and power iteration, a toy counterexample for mode collapse, the conversion among the four diffusion parameterizations (x0, noise, mean, and v), and the Euler discretization relation between the probability-flow ODE and DDIM; the final chapter puts the four models back into a single coordinate system with one master table, six key disagreements, one model-selection decision chain, and a concept correspondence table against reinforcement learning.

    #Generative Models#AIGC#Variational Autoencoder#Generative Adversarial Network#Normalizing Flow#Diffusion Model#Variational Inference#Score Matching
  • Reinforcement Learning

    Diffusion Model Notes: From the Evidence Lower Bound and Score Matching to DDIM, Guidance, and Flow Matching

    A set of diffusion model notes (Diffusion Model, a class of generative models that learn a data distribution by adding noise step by step and then denoising step by step) organized in the same style as the reinforcement learning algorithm notes: it first clarifies the three routes of generative modeling and where diffusion sits among them, then follows the chain of forward noising → evidence lower bound and simplified loss → score matching and Langevin dynamics → DDPM → DDIM acceleration → continuous-time stochastic differential equations and probability flow ordinary differential equations → conditional guidance → latent-space diffusion → network architecture and parameterizations → flow matching and rectified flow → distillation and few-step sampling → evaluation metrics → integration with reinforcement learning and embodied intelligence, and for each stage gives the objective, the formulas, complete pseudocode, a paragraph-by-paragraph walkthrough, the gradient flow and detach checklist, a pitfall checklist, and the scope of application. It closes with more than ten application scenarios, one model-selection decision chain, and an abbreviation reference table.

    #Diffusion Model#DDPM#Score Matching#DDIM#Flow Matching#Conditional Generation#Latent Diffusion#Diffusion Policy
  • Optimization Algorithms

    Metaheuristic Optimization Notes: Principles, Formulas and Pseudocode for PSO, Genetic Algorithms, Simulated Annealing and Ant Colony Optimization

    A review note in the same style as the site's Deep Reinforcement Learning Core Algorithms note, but for metaheuristics: black-box optimization methods that do not rely on gradients and instead search through randomness and selection pressure. It first lays out the problem framework shared by the four algorithms (black-box objectives, evaluation budget, exploration versus exploitation, and the no-free-lunch theorem), then expands Particle Swarm Optimization (PSO), Genetic Algorithms (GA), Simulated Annealing (SA) and Ant Colony Optimization (ACO) one by one under the same skeleton: why it is needed, principles and formulas, collapsible derivations, complete pseudocode, section-by-section walkthrough, a per-step read/write and state-maintenance checklist, a pitfall checklist, and scope of application. The note contains 14 collapsible derivations, covering the origin of the PSO velocity update and its stable parameter region, the GA schema theorem and building-block hypothesis, detailed balance and cooling convergence in SA, and the ACO transition probability together with pheromone upper and lower bounds. The final chapter puts the four algorithms back into one coordinate system with a single master table, six key divergences, one algorithm-selection decision chain, and a concept-mapping table against reinforcement learning.

    #Metaheuristics#Particle Swarm Optimization#Genetic Algorithms#Simulated Annealing#Ant Colony Optimization#Black-box Optimization#Combinatorial Optimization
  • Reinforcement Learning

    Deep Reinforcement Learning Core Algorithm Notes: From the Bellman Equation and DQN to GAE, PPO, and SAC

    A review note on deep reinforcement learning (DRL) reordered along the logic of the knowledge itself: it first makes return, state value, action value, and the Bellman equation clear, then follows the thread of 'dynamic programming → Monte Carlo → temporal difference → Q-learning/DQN → policy gradient → Actor-Critic → GAE → TRPO → PPO → ACER → DPG → DDPG → TD3 → SAC' and gives, for each algorithm, its objective, formulas, pseudocode, and common questions. The four chapters on DPG, DDPG, TD3, and SAC are developed at the same granularity as the PPO chapter (motivation, collapsible derivations, complete pseudocode, section-by-section commentary, gradient-flow and detach checklists, pitfall checklists, and scope of application); the note also covers details such as six questions and six answers on DQN, the difference between first-visit and every-visit Monte Carlo, why the three A2C losses are composed the way they are, the bias-variance trade-off of GAE, why PPO clipping approximates a trust region, why twin critics suppress overestimation, and why the tanh Jacobian correction in SAC cannot be omitted.

    #Reinforcement Learning#Bellman Equation#DQN#GAE#PPO#DPG#DDPG#TD3#SAC
  • Embodied AI

    Embodied AI Algorithms: From Beginner to Mastery

    Using a four-layer map — “foundation layer reinforcement learning → skill layer imitation learning → foundation-model layer vision-language-action models → robustness layer sim-to-real” — as the main thread, this guide explains, algorithm by algorithm, the intuition, principles, expandable formula derivations, and pseudocode walkthroughs, covering PPO, SAC, ACT, Diffusion Policy, RT-2/OpenVLA, π₀ flow matching, FAST, Octo, GR-2, HPT, RDT-1B, DreamerV3, TD-MPC2, JEPA, and domain randomization, and also provides a five-stage learning path, model-selection decision tables, and an engineering pitfall checklist.

    #Embodied AI#Reinforcement Learning#Imitation Learning#Vision-Language-Action Models#World Models#Sim-to-Real
  • LLM & RAG

    RAG from Fundamentals to Advanced: A Panoramic Guide to Vector Retrieval, Knowledge Graphs, and Agentic RAG

    A systematic introduction to Retrieval-Augmented Generation (RAG): the core principles (the index-retrieve-generate pipeline and how it differs from fine-tuning), optimization techniques and advanced approaches (query rewriting, hybrid retrieval, reranking, Modular RAG, and evaluation), knowledge graph construction (the GraphRAG indexing pipeline, entity extraction, and Leiden community detection), applying knowledge graphs in RAG (Local/Global Search, multi-hop reasoning), processing chart- and table-rich PDF/DOCX documents (text-based parsing vs. ColPali-style vision-native retrieval, with a MinerU/Docling/LlamaParse tool comparison), a stage-by-stage engineering toolchain and selection guide (embedding models, vector stores, rerankers, evaluation, and orchestration frameworks compared, with a catalog of deployable open-source projects such as RAGFlow, Kotaemon, and R2R), the plan-retrieve-reflect loop of Agentic RAG, and the future evolution of RAG — with frequently asked interview questions and reference answers at the end.

    #RAG#LLM#Knowledge Graph#GraphRAG#Agentic RAG#Document Parsing#Interview Questions
  • Sionna Source Code

    38.901 §7.1 Coordinate System Explained: Three Intrinsic Rotations, the Polarization-Basis Angle ψ, and Sionna Source Mapping

    Based on 3GPP TR 38.901 (g10 draft) Clause 7.1 "Coordinate system", this post explains why the radiation pattern lives in the local coordinate system, how the bearing α / downtilt β / slant γ intrinsic rotations are constructed, the closed-form spherical-angle mapping (Eq. 7.1-6~8) and the physical meaning of the polarization-basis rotation ψ (Eq. 7.1-9~15), with line-by-line mapping to Sionna channel_coefficients.py / antenna.py, a runnable numerical verification, and two common traps (the TR text contradicting its own equations on rotation direction, and confusing mechanical slant γ with polarization slant ζ).

    #Sionna#38.901#Coordinate System#Rotation Matrix#Antenna Pattern#Polarization
  • Sionna Source Code

    Sionna Source Code Explained: antenna.py and channel_coefficients.py Function-by-Function Against 3GPP 38.901

    A per-file, per-function walkthrough of the two low-level source files implementing 3GPP TR 38.901 in Sionna 1.x: antenna.py (Section 7.3 element pattern / panel / array modeling and the polarization slant angle gamma) and channel_coefficients.py (Section 7.1 coordinate-rotation utilities, formulas 7.1-4/6/7/8/11/15, plus Section 7.5 Steps 10/11 channel-matrix synthesis, formulas 7.5-22 to 7.5-30 and Table 7.5-5 sub-clustering). Includes function-to-line-to-formula mapping tables, a tensor-shape data-flow overview, runnable numerical examples and an FAQ. Companion to the '38.901 Twelve-Step Channel Generation Guide'.

    #Sionna#38.901#antenna-modeling#channel-modeling#source-code
  • Sionna Source Code

    38.901 §7.7 Link-Level Channel Models (CDL/TDL): Generation Methods and Sionna Source Code Explained

    Based on 3GPP TR 38.901 (g10 draft) Clause 7.7 "Channel models for link-level evaluations", this post covers the four-step CDL generation procedure, the TDL model definition and Sionna's sum-of-sinusoids time-domain implementation, plus delay scaling, spatial filtering, MIMO extensions (angle scaling and correlation matrices) and K-factor adjustment, with line-by-line mapping to Sionna 1.x cdl.py / tdl.py.

    #Sionna#38.901#CDL#TDL#Link-level simulation
  • Sionna Source Code

    38.901 §7.5 Twelve-Step Channel Generation: Complete Guide to Framework, Computation, and Sionna Source Code

    Following 3GPP TR 38.901 (g10 draft) §7.5 'Fast fading model', this post first dissects Sionna 1.x's four-generator framework and the call order of one invocation, then expands every formula, parameter table, and random-variable distribution of Steps 1–12 for the UMa scenario with source-code locations, and covers §7.6.3 spatial consistency (SSC), the array-based channel synthesis, and FAQs on spatial consistency, mobility, and state transitions.

    #Sionna#38.901#channel-modeling#UMa#source-code
  • Channel Estimation & Equalization

    Estimating the Interference Covariance Rnn in MMSE Equalization

    Starting from the time-frequency structure of NR DMRS and OCC multiplexing, this post gives the RE-level receive signal model, the full MMSE equalization derivation, post-equalization LLR demodulation, and then lands on how to estimate Rnn — including the DMRS residual method, silent-resource sampling, and the "global shape + per-RB scalar" dimensionality-reduction idea.

    #MMSE#interference-suppression#covariance-estimation#DMRS#5G NR