Archives
All the articles I've archived.
-
Rotary Position Embedding (RoPE) Implementation in PyTorch
A PyTorch implementation of Rotary Position Embedding (RoPE): inverse frequency buffer, precomputed cos/sin cache, query/key rotation, and shape verification.
-
Multi-Agent Embodied Systems: CTDE, Shared 3DGS Maps, and Foundation Model Coordination
Master multi-agent embodied systems: CTDE reinforcement learning, shared 3DGS maps, dynamic role allocation, and heterogeneous robot team deployment.
-
World Models for Embodied AI: Recurrent State Space Models (RSSM), Latent Dynamics, and Model-Based MPC
Master World Models for Embodied AI: Recurrent State Space Models (RSSM), latent dynamics, model-based MPC planning, and VLA policy integration in PyTorch.
-
Stable Diffusion (DDPM): Minimal PyTorch Implementation
A minimal PyTorch implementation of a Denoising Diffusion Probabilistic Model (DDPM): sinusoidal time embeddings, U-Net with skip connections, forward noising, reverse denoising, and ancestral sampling.
-
NeRF: Neural Radiance Fields, Differentiable Volume Rendering, and PyTorch Architecture
Master NeRF (Neural Radiance Fields): 5D radiance fields, differentiable volume rendering, Fourier positional encoding, hierarchical sampling, and PyTorch.
-
Training Qwen3-VL-8B Vision with GRPO: Multimodal Policy Optimization and Reward Engineering
Train Qwen3-VL-8B Vision with GRPO: multimodal policy optimization, two-tier visual reward functions, and 16-bit LoRA under 15GB VRAM.
-
Fine-Tuning Qwen3.5-4B Vision with Unsloth: High-Precision Multimodal SFT on 10GB VRAM
Fine-tune Qwen3.5-4B Vision using Unsloth: 16-bit LoRA optimization, multi-modal patch projection, and Q4_K_M GGUF edge deployment on consumer GPUs.
-
Vision-Language-Action (VLA) Models for Robotic Manipulation: Architecture, Rectified Flow Matching, and Sim-to-Real Deployment
Master Vision-Language-Action (VLA) models: continuous Flow Matching action heads, cross-embodiment datasets, Action Chunking, and Isaac Lab sim-to-real.
-
Transformer Encoder Implementation in PyTorch
A compact PyTorch implementation of a Transformer encoder with multi-head self-attention, sinusoidal positional encoding, feed-forward layers, residual connections, and padding masks.
-
Fine-Tuning FLUX.2 Klein with Kohya_ss: Edge MMDiT LoRA Training, Flow Matching, and VRAM Optimization
Train FLUX.2 Klein LoRA on 8GB GPUs using Kohya_ss: compact 4B MMDiT flow matching, CLIP-L conditioning, latent caching, and ComfyUI deployment.
-
Training Qwen3.5-4B-Vision with GRPO: Multimodal Policy Optimization and Reward Engineering
Train Qwen3.5-4B Vision with GRPO: multimodal policy optimization, two-tier visual reward functions, and 16-bit LoRA under 15GB VRAM.
-
Fine-Tuning OpenAI gpt-oss-20B with Unsloth: 4-bit MoE QLoRA and Harmony Chat Templates
Fine-tune OpenAI gpt-oss-20B MoE using Unsloth on 16GB GPUs: 4-bit QLoRA, Harmony chat templates, channel separation, and SFTTrainer pipeline.
-
Fine-Tuning Qwen3-VL-8B Vision with Unsloth: Multimodal LoRA and LaTeX OCR
Fine-tune Qwen3-VL-8B Vision on LaTeX OCR tasks with Unsloth: 4-bit NF4 QLoRA, multimodal token collation, and GGUF export under 8.5GB VRAM.
-
Video Generation Foundation Models: 3D DiT Architectures, Flow Matching, and Spatiotemporal Attention
Master Video Generation Foundation Models: 3D Diffusion Transformers, continuous Flow Matching, 3D VAE compression, and open-source PyTorch pipelines.
-
Fine-Tuning Qwen3.5-0.8B Vision with Unsloth: Sub-3GB Multimodal Edge Alignment
Fine-tune Qwen3.5-0.8B Vision on VQA tasks using Unsloth: BF16 LoRA optimization, multi-modal token alignment, and GGUF edge deployment under 3GB VRAM.
-
Fine-Tuning Qwen3.5-2B Vision with Unsloth: Document VQA and 16-bit LoRA Alignment
Fine-tune Qwen3.5-2B Vision on document VQA using Unsloth: 16-bit LoRA optimization, multi-modal OCR token alignment, and GGUF export under 5GB VRAM.
-
OpenClaw: Architecture, Gateway Routing, Sandboxed MCP Skills, and Multi-Channel Deployment
Master OpenClaw: self-hosted gateway routing, Docker sandbox isolation, SKILL.md progressive disclosure, MCP servers, and multi-channel messaging deployment.
-
Fine-Tuning Qwen3-4B-Thinking with Unsloth: DeepSeek-R1 Distillation and Dual-Mode Inference
Fine-tune Qwen3-4B-Thinking on DeepSeek-R1 CoT traces with Unsloth: OpenMathReasoning alignment, thinking-mode toggles, and GGUF multi-quant export.
-
Fine-Tuning Qwen3-14B Reasoning and Conversational Modes with Unsloth
Fine-tune Qwen3-14B dual-mode reasoning and chat: 75/25 mixed-dataset distillation, 4-bit QLoRA, and GGUF multi-quant export on 12GB VRAM.
-
Training gpt-oss-20B with GRPO: Multi-Objective Reinforcement Learning
Train gpt-oss-20B MoE using GRPO: AST sandboxing, anti-reward hacking, 4-bit QLoRA, and execution benchmark reward engineering.
-
Fine-Tuning FLUX.1 Dev with Kohya_ss: MMDiT LoRA Training, Flow Matching, and ComfyUI Workflow
Master FLUX.1 Dev LoRA fine-tuning with Kohya_ss: MMDiT joint attention, Flow Matching velocity loss, text encoder freezing, and ComfyUI deployment.
-
Microsoft TRELLIS: Structured 3D Latents (SLAT), Rectified Flow Transformers, and Unified Multi-Format 3D Generation
Master Microsoft TRELLIS: Structured 3D Latents (SLAT), Rectified Flow Transformers, and unified decoding into 3D Gaussian Splats, NeRFs, and meshes.
-
Training SDXL LoRA with Kohya_ss: Dataset Curation, Loss Formulation, and Rank Tuning
Train high-fidelity SDXL LoRAs with Kohya_ss: latent diffusion objective, cross-attention projection tuning, multi-aspect bucketing, and ComfyUI deployment.
-
Training Qwen3 4B with GRPO: Two-Stage Reasoning Alignment and Reward Engineering
Train Qwen3-4B with GRPO on 16GB GPUs: two-stage format pre-tuning, 4-tier composite reward shaping, rsLoRA, and vLLM acceleration.
-
Training Qwen3-8B-FP8 with GRPO: Native 8-Bit Reinforcement Learning on Single GPUs
Train Qwen3-8B in native FP8 precision using GRPO reinforcement learning: memory-efficient policy updates, multi-tier reward functions, and 20GB VRAM execution.
-
Hunyuan3D-2: High-Resolution Text-to-3D, Flow-Matching DiT, and 2K PBR Texture Synthesis
Master Tencent's Hunyuan3D-2: explore the decoupled Hunyuan3D-DiT shape generator, Hunyuan3D-Paint 2K PBR texture synthesis, and Blender pipeline.
-
Fine-Tuning Qwen3-4B-Instruct with Unsloth: Instruction Alignment and Response Masking
Fine-tune Qwen3-4B-Instruct with Unsloth: response-only loss masking, 4-bit QLoRA, memory profiling under 8GB VRAM, and GGUF multi-quant export.
-
Fine-Tuning Qwen-Image 20B with AI-Toolkit: uint3 Quantization, ARA Adapters, and Flow Matching
Train 20B Qwen-Image LoRA on 24GB GPUs using AI-Toolkit: uint3 quantization, Accuracy Recovery Adapters (ARA), Flow Matching, and ComfyUI deployment.
-
Multi-Modal Agents: VLA Architectures, Flow Matching, and Isaac Lab Deployment
Master multimodal embodied agents: Vision-Language-Action (VLA) backbones, flow-matching continuous control, hierarchical memory, and Isaac Lab sim-to-real.
-
Fine-Tuning Qwen2.5-Coder-1.5B for Tool Calling: Hermes Schema Alignment with Unsloth
Fine-tune Qwen2.5-Coder-1.5B for tool calling using Unsloth: Hermes JSON schema formatting, 4-bit QLoRA, multi-tool dispatch, and edge deployment.
-
Training LTX-2 Character-Consistent Video LoRA: In-Context Conditioning (IC-LoRA) and ComfyUI Deployment
Master LTX-2 Character-Consistent Video LoRA training: in-context conditioning (IC-LoRA), paired dataset curation, YAML configs, and ComfyUI deployment.
-
Fine-Tuning FLUX.2-dev with AI-Toolkit: MMDiT LoRA Training, Flow Matching, and Prodigy Optimization
Master FLUX.2-dev LoRA fine-tuning with AI-Toolkit: MMDiT flow matching, dataset curation, Prodigy adaptive optimization, and ComfyUI deployment.
-
Fine-Tuning Qwen-Image-Edit-2511 with AI-Toolkit: Paired MMDiT LoRA Training and Flow Matching
Train Qwen-Image-Edit-2511 LoRA using AI-Toolkit: paired MMDiT datasets, qfloat8 quantization, Diff Output Preservation, and ComfyUI deployment.
-
Accelerating Mixture-of-Experts Fine-Tuning: Unsloth Faster MoE, Split LoRA, and Grouped GEMM
Accelerate MoE LLM fine-tuning with Unsloth Faster MoE: torch._grouped_mm, Triton fused kernels, Split LoRA memory optimization, and benchmarks.
-
HunyuanVideo: 13B Video DiT, Flow Matching, and 3D VAE Latent Compression
Master Tencent's HunyuanVideo: 13B parameter flow-matching DiT, Causal 3D VAE compression, MLLM text conditioning, and PyTorch deployment.
-
Real-Time 3D Gaussian Splatting: Mathematical Derivations, CUDA Rasterization, and PyTorch Training
Master 3D Gaussian Splatting from scratch: anisotropic covariance decomposition, spherical harmonics, tile-based CUDA rasterization, and PyTorch training.
-
Text-to-3D Gaussian Splatting: Score Distillation Sampling, Diffusion Priors, and PyTorch Training
Master Text-to-3D with Gaussian Splatting: Score Distillation Sampling (SDS), diffusion guidance, differentiable gsplat rendering, and PyTorch pipelines.
-
Training Llama 3.2 (3B) with GRPO and LoRA: Multi-Reward Reasoning RL
Train Llama 3.2 (3B) with GRPO and LoRA: multi-reward optimization, SFT format warm-up, cosine similarity scoring, and PyTorch deployment.
-
Hermes Agent by Nous Research: Architecture, Self-Improving Loops, and MCP Integration
Master Hermes Agent by Nous Research: explore the closed learning loop, hierarchical memory, progressive skill discovery, and multi-backend MCP integration.
-
GS-SLAM + VLA: Real-Time Gaussian Splatting SLAM with Vision-Language-Action Models for Robotic Manipulation
Deploy GS-SLAM with VLA models for robotic manipulation: 3D Gaussian spatial grounding, cross-attention feature fusion, and closed-loop control.
-
Scaffold-GS: Structured 3D Gaussians, Sparse Voxel Anchors, and Model Compression
Master Scaffold-GS: sparse voxel anchor grids, shared neural MLP predictors, view-dependent LOD rendering, and 10x-100x Gaussian splat compression.
-
Scaling LLM Pretraining with DeepSpeed and Megatron-LM: 3D Parallelism, ZeRO-3, and Multi-Node Systems
Master distributed LLM pretraining (13B–70B+) with DeepSpeed and Megatron-LM: 3D Parallelism (TP/PP/DP), ZeRO-3, FP8 TransformerEngine, and multi-node NCCL.
-
Training Llama 3.2 1B with FP8 Quantization and GRPO Reinforcement Learning
Train Llama 3.2 1B using hardware FP8 quantization and GRPO: 4-layer reward shaping, vLLM weight sharing, and 60% VRAM reduction.
-
Training Llama 3.1 8B with GRPO: Reasoning Alignment and 5-Tier Reward Shaping
Train Llama 3.1 8B with GRPO using Unsloth on a single 16GB GPU: 5-tier composite reward functions, 4-bit QLoRA, XML reasoning, and vLLM acceleration.
-
Gaussian Splatting SLAM (GS-SLAM): Real-Time Dense Mapping and Tracking with 3DGS
Master Gaussian Splatting SLAM (GS-SLAM): real-time pose tracking, incremental Gaussian mapping, loop closure, and PyTorch deployment on RGB-D streams.
-
Training DeepSeek-R1 Distilled Qwen3 (8B) with GRPO: Multi-Objective RL
Train DeepSeek-R1 distilled Qwen3 (8B) using GRPO: multi-signal reward functions, group advantage normalization, and single-GPU fine-tuning.
-
4D Gaussian Splatting for Dynamic Scenes: Canonical Fields, HexPlane Deformation, and Real-Time Rendering
Master 4D Gaussian Splatting: canonical space formulation, HexPlane vs. MLP deformation fields, real-time PyTorch training, and robotics digital twins.
-
3D Gaussian Splatting for Embodied AI & Robotics: Real-Time Perception, Grasp Planning, and Sim-to-Real
Deploy 3D Gaussian Splatting in robotics: real-time scene reconstruction, Mahalanobis collision checking, 6-DoF grasp planning, and sim-to-real transfer.
-
LTX-2 Architecture: Asymmetric Dual-Stream Audio-Video DiT and Flow Matching
Master LTX-2: asymmetric dual-stream video/audio DiT, 1D/3D RoPE alignment, cross-modality adaLN, multimodal guidance (CFG/STG), and PyTorch pipelines.
-
Direct Preference Optimization (DPO) Implementation in PyTorch
A PyTorch implementation of Direct Preference Optimization (DPO): a small LSTM language model, a preference dataset, and a DPO trainer that optimizes a policy against a frozen reference via the sigmoid logistic DPO loss on chosen/rejected pairs.
-
Group Relative Policy Optimization (GRPO) Implementation in PyTorch
A PyTorch implementation of Group Relative Policy Optimization (GRPO): a Group-relative RL approach that partitions sorted trajectories into groups, weights group-relative advantages, and applies clipped surrogate updates with PPO-style ratios.
-
Deep Deterministic Policy Gradient (DDPG) Implementation in PyTorch
A PyTorch implementation of Deep Deterministic Policy Gradient (DDPG): an Actor that outputs tanh-bounded deterministic actions, a Q-value Critic over state-action pairs, a replay buffer, target networks with soft updates, and a smoke test that exercises action selection and a short training loop.
-
LLaVA (Large Language and Vision Assistant) Implementation in PyTorch
A PyTorch implementation of LLaVA: a ResNet-50 vision encoder, a Transformer-based language model, a custom cross-attention fusion layer, and an enhanced tokenizer for image-grounded text generation.
-
Diffusion Transformers (DiT): Architecture, adaLN-Zero Modulation, and Latent Scaling Laws
Master Diffusion Transformers (DiT): latent patchification, adaLN-Zero conditioning, multi-modal MMDiT joint attention, scaling laws, and PyTorch pipelines.
-
Diffusion Transformer (DiT) Implementation in PyTorch
A PyTorch implementation of the Diffusion Transformer (DiT): a patch-embedded Vision Transformer with sinusoidal timestep conditioning, multi-head self-attention, MLP blocks, and a transposed-conv head that predicts the image-space noise.
-
Deep Q-Network (DQN) Implementation in PyTorch
A PyTorch implementation of Deep Q-Network (DQN): a Q-value MLP, a replay buffer, an ε-greedy agent with target network, Bellman loss update, and a CartPole-v1 training/test loop using Gymnasium.
-
Low-Rank Adaptation (LoRA) Implementation in PyTorch
A PyTorch implementation of Low-Rank Adaptation (LoRA): low-rank A/B matrices wrapped around a frozen linear layer, scaled by alpha/rank, with shape, freezing, and rank-property tests.
-
Denoising Diffusion Probabilistic Model (DDPM) Implementation in PyTorch
A PyTorch implementation of a Denoising Diffusion Probabilistic Model (DDPM): a linear-beta forward diffusion, a reverse sampling loop, a time-conditioned UNet denoising network, and a training-free smoke test that forward-diffuses, predicts noise, and samples images.
-
FlashAttention Implementation in PyTorch
A PyTorch implementation of FlashAttention-style multi-head attention: a softmax-scaled dot-product attention block, a tiled/blocked variant that processes sequence chunks for memory efficiency, and basic shape tests.
-
Mixture of Experts (MoE) Implementation in PyTorch
A PyTorch implementation of the Mixture of Experts (MoE) layer with a top-k gating network, multiple expert MLPs, and weighted expert outputs for sparse expert routing.
-
ControlNet Implementation in PyTorch
A minimal PyTorch ControlNet implementation: a control encoder with conv blocks, residual skip connections, channel attention, and a zero-initialized projection that adds residual control features into a backbone so that the model behaves as identity at init.
-
Denoising Diffusion Implicit Model (DDIM) Implementation in PyTorch
A PyTorch implementation of a Denoising Diffusion Implicit Model (DDIM) sampler: a UNet denoiser with GELU time conditioning, an eta-controlled stochastic-to-deterministic reverse process on a sub-sequence of timesteps, and a smoke test that verifies noise addition, model output, sampling shapes, and deterministic reproducibility.
-
Denoising Diffusion Probabilistic Model (DDPM) Implementation in PyTorch
A PyTorch implementation of a Denoising Diffusion Probabilistic Model (DDPM): a UNet denoiser with sinusoidal-free linear time conditioning, a linear-beta forward diffusion, an iterative reverse sampling loop, and a smoke test that verifies noise addition, model output, and sampling shapes.
-
PagedAttention: Virtual-Memory KV Cache Management, Continuous Batching, and PyTorch Architecture
Master PagedAttention: virtual memory KV cache paging, block tables, prefix caching (CoW), continuous batching, memory fragmentation math, and PyTorch kernels.
-
DeepSeek Architecture Implementation in PyTorch
A PyTorch implementation of the DeepSeek-style architecture: RMSNorm pre-norm blocks, a multi-head latent attention module, a Mixture-of-Experts (MoE) feed-forward router, and a stack of DeepSeek blocks with token-level residual paths.
-
DDIM (Denoising Diffusion Implicit Models): Non-Markovian Sampling and Probability-Flow ODEs
Master DDIM (Denoising Diffusion Implicit Models): non-Markovian sampling, probability-flow ODE derivations, deterministic inference, and PyTorch pipelines.
-
Vision Transformer (ViT) Implementation in PyTorch
A PyTorch implementation of the Vision Transformer (ViT) with patch embedding, learnable class token and position embeddings, multi-head self-attention, MLP blocks, and classification head.
-
Vision Transformer (ViT): Patch Embedding, Self-Attention, and PyTorch Architecture
Master the Vision Transformer (ViT): patch projection, class tokens, multi-head self-attention over patches, DeiT augmentation, and PyTorch implementations.
-
LLaMA Transformer Implementation in PyTorch
A from-scratch PyTorch implementation of the LLaMA-style Transformer: RMSNorm, Rotary Position Embeddings (RoPE), GQA-style multi-head attention with causal mask, SwiGLU MLP, and a stack of pre-norm decoder layers.
-
RoPE (Rotary Position Embedding): Mathematical Foundations, Complex Rotations, and PyTorch Architecture
Master RoPE (Rotary Position Embedding): complex rotation algebra, relative distance invariance proof, long-context scaling (YaRN), and PyTorch kernels.
-
DDPM: Denoising Diffusion Probabilistic Models, ELBO Derivation, and PyTorch Architecture
Master DDPM: forward and reverse Gaussian Markov chains, closed-form ELBO derivation, noise-prediction parameterization, and PyTorch training pipelines.
-
3D Gaussian Splatting (3DGS) Implementation in PyTorch
A PyTorch implementation of 3D Gaussian Splatting from scratch: per-Gaussian learnable positions, scales, quaternions and RGBA, 3D covariance via R S Sᵀᵀ, projection to 2D via the perspective Jacobian, splat-based alpha compositing over a pixel grid, and a smoke test that checks initialization, symmetry/orthogonality of covariances, and the rendering output shape and value range.
-
Diffusion Models: Mathematical Foundations, Score Matching, and PyTorch Architecture
Master diffusion models: forward Markov perturbations, reverse ELBO derivations, score-based SDE unifications, and production PyTorch training pipelines.
-
Asynchronous Advantage Actor-Critic (A3C) Implementation in PyTorch
A PyTorch implementation of Asynchronous Advantage Actor-Critic (A3C): a shared Actor-Critic network with a softmax policy head, multiple Worker processes that collect CartPole trajectories, compute n-step returns and advantages, and sync gradients into a global model, plus a greedy test harness that runs the trained policy in render mode.
-
4D Gaussian Splatting (4DGS): HexPlane Spatiotemporal Neural Fields and Dynamic Splatting
Master 4D Gaussian Splatting (4DGS): HexPlane spatiotemporal neural fields, canonical deformation fields, and real-time dynamic novel view synthesis.
-
3D Gaussian Splatting (3DGS): Differentiable Tile Rasterization and Explicit Radiance Fields
Master 3D Gaussian Splatting (3DGS): covariance matrix decomposition, tile-based differentiable rasterization, adaptive density control, and real-time CUDA pipelines.
-
LLaVA: Visual Instruction Tuning, Cross-Modal Projection, and PyTorch Architecture
Master LLaVA: visual instruction tuning, 2-stage cross-modal projection, CLIP/SigLIP feature alignment, AnyRes scaling, and PyTorch VLM pipelines.
-
Stable Diffusion: Latent Diffusion Models, Cross-Attention U-Net, and PyTorch Architecture
Master Stable Diffusion: latent diffusion models (LDM), perceptual VAE compression, cross-attention U-Net, classifier-free guidance, and PyTorch pipelines.
-
LoRA (Low-Rank Adaptation): Mathematical Foundations, Rank SVD Dynamics, and PyTorch PEFT Architecture
Master LoRA (Low-Rank Adaptation): low-rank matrix decomposition, intrinsic rank analysis, QLoRA NF4 quantization, DoRA, and PyTorch PEFT pipelines.
-
ControlNet: Zero-Convolution Architecture and Spatial Conditioning in Diffusion Models
Master ControlNet: zero-convolution weight initialization, trainable U-Net copy architecture, multi-condition composition, and PyTorch training pipelines.
-
3D Transformers: Point Clouds, Sparse Voxels, Vector Attention, and PyTorch Architecture
Master 3D Transformers: vector self-attention on point clouds, sparse voxel hashing, 3D Swin windowing, relative positional bias, and PyTorch architectures.
-
Llama Architecture: RMSNorm, SwiGLU, RoPE, GQA, and PyTorch Implementation
Master Llama architecture: RMSNorm pre-normalization, SwiGLU activations, RoPE relative embeddings, Grouped-Query Attention (GQA), and PyTorch pipelines.
-
The Transformer Architecture: Scaled Dot-Product Attention, Multi-Head Projections, and PyTorch Engine
Master the Transformer: scaled dot-product attention, multi-head projections, sinusoidal & RoPE encodings, Pre-LN vs Post-LN stability, and PyTorch engines.