Skip to content
AILinkDeepTech

Research

Deep dives into reinforcement learning, computer vision, and robotics research, complete with mathematical formulations and architectural breakdowns.

Deep Learning Advanced

GQA & MQA: Mathematical Foundations, Memory Bandwidth Optimization, and KV-Cache Scaling from Multi-Head to Grouped-Query Attention

Master Grouped-Query Attention (GQA) and Multi-Query Attention (MQA): KV cache memory explosion calculus, architectural comparison across MHA/GQA/MQA, tensor broadcasting vs FlashAttention stride tricks, MHA-to-GQA uptraining, and production PyTorch implementations powering LLaMA-3 and Mistral.

#gqa #mqa #grouped-query-attention #multi-query-attention #kv-cache #llm-inference #llama-3 #flash-attention #pytorch #deep-learning
Deep Learning Advanced

ORPO: Odds Ratio Preference Optimization โ€” Mathematical Foundations, Reference-Free Monolithic Alignment, and PyTorch Implementation

Master ORPO (Odds Ratio Preference Optimization): reference-free monolithic alignment, odds ratio mathematical derivation, cross-entropy contrastive regularization, SFT-DPO collapse prevention, and production PyTorch implementations.

#orpo #dpo #rlhf #preference-optimization #llm-alignment #llama-3 #mistral #pytorch #deep-learning
Deep Learning Advanced

Speculative Decoding: Mathematical Foundations, Rejection Sampling Proofs, Tree Attention (Medusa & EAGLE), and Production PyTorch Serving

Master Speculative Decoding: memory-bandwidth bottlenecks, modified rejection sampling proof of exact distributional equivalence, expected speedup dynamics, tree-based verification (Medusa & EAGLE), and production PyTorch serving implementations.

#speculative-decoding #llm-inference #rejection-sampling #medusa #eagle #tree-attention #vllm #pytorch #deep-learning
Deep Learning Advanced

Mamba & State Space Models (SSM): Mathematical Foundations, Hardware-Aware Parallel Scan, and Mamba-2 SSD Duality

Master Mamba and State Space Models (SSM): continuous control theory, Zero-Order Hold (ZOH) discretization, HiPPO orthogonal memory, S4 convolution duality, input-dependent selective scan (S6), GPU SRAM kernel fusion, and Mamba-2 State Space Duality (SSD) with full PyTorch implementations.

#mamba #state-space-models #ssm #mamba-2 #state-space-duality #linear-attention #s4 #hippo #hardware-aware-scan #pytorch #deep-learning
Generative Models Advanced

Rectified Flow: Mathematical Foundations, Reflow Trajectory Straightening, and Single-Step Distillation in Modern Diffusion Transformers (SD3 & FLUX)

Master Rectified Flow: continuous displacement interpolation, marginal flow theorems, the trajectory crossing bottleneck, the Reflow straightening protocol, Monge optimal transport convergence, and production PyTorch implementations powering Stable Diffusion 3 and FLUX.1.

#rectified-flow #flow-matching #diffusion-models #reflow #stable-diffusion-3 #flux #ode-solvers #optimal-transport #pytorch #generative-models
Generative Models Advanced

Flow Matching: Continuous Normalizing Flows, Optimal Transport Paths, and Rectified Flow Dynamics

Master Flow Matching: continuity equation foundations, conditional flow matching (CFM) equivalence theorems, optimal transport displacement paths, Reflow trajectory straightening, and production PyTorch ODE solvers.

#flow-matching #rectified-flow #optimal-transport #diffusion-models #continuous-normalizing-flows #stable-diffusion-3 #flux #ode-solvers #pytorch #generative-models
Generative Models Advanced

Multimodal Diffusion Transformers (MMDiT): Architecture, Dual-Stream Joint Attention, and PyTorch Implementation

Master Multimodal Diffusion Transformers (MMDiT): dual-stream text-image processing, unified bidirectional joint attention, adaLN-Zero modulation, and complete production PyTorch code.

#mmdit #diffusion-transformer #dit #stable-diffusion-3 #flux #multimodal-learning #generative-models #rectified-flow #joint-attention #pytorch
Reinforcement Learning Medium

Soft Actor-Critic (SAC) Implementation in PyTorch

A PyTorch implementation of Soft Actor-Critic (SAC) with a stochastic squashed Gaussian policy, twin Q-networks with target networks, automatic temperature tuning, and a replay buffer for continuous control.

#SAC #Soft Actor-Critic #Reinforcement Learning #PyTorch #Deep Learning #Continuous Control #Off-Policy
Deep Learning Medium

Neural Radiance Fields (NeRF) Implementation in PyTorch

A PyTorch implementation of Neural Radiance Fields (NeRF): positional encoding for positions and view directions, MLP with skip connections, density/color prediction, stratified sampling, and volumetric rendering.

#NeRF #Neural Radiance Fields #PyTorch #Deep Learning #3D Reconstruction #Volume Rendering #Computer Vision
Deep Learning Medium

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.

#Stable Diffusion #Diffusion Model #DDPM #PyTorch #Deep Learning #Generative Model #Image Generation
Deep Learning Medium

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.

#Transformer #PyTorch #Deep Learning #Attention #Natural Language Processing
Deep Learning Medium

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.

#DPO #Direct Preference Optimization #RLHF #Preference Optimization #LSTM #Language Model #PyTorch
Reinforcement Learning Medium

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.

#GRPO #Group Relative Policy Optimization #PPO #Reinforcement Learning #Policy Gradient #Gym #PyTorch
Reinforcement Learning Advanced

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.

#DDPG #Actor-Critic #Reinforcement Learning #Deterministic Policy #Replay Buffer #Soft Update #PyTorch
Generative Models Medium

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.

#DiT #Diffusion Transformer #Generative Model #Diffusion #Vision Transformer #Transformer #PyTorch
Reinforcement Learning Medium

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.

#DQN #Deep Q-Network #Reinforcement Learning #Q-Learning #Replay Buffer #Target Network #PyTorch #Gymnasium
Deep Learning Medium

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.

#LoRA #Low-Rank Adaptation #PEFT #Parameter-Efficient Fine-Tuning #PyTorch #Deep Learning #LLM
Deep Learning Medium

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.

#FlashAttention #Multi-Head Attention #Tiling #Memory Efficient #Transformer #PyTorch
Deep Learning Medium

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.

#MoE #Mixture of Experts #PyTorch #Deep Learning #Gating Network #Sparse Routing #Transformer
Generative Models Advanced

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.

#ControlNet #Conditional Diffusion #Stable Diffusion #Generative Models #Channel Attention #Residual Blocks #PyTorch
Generative Models Advanced

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.

#DDIM #Diffusion #Denoising #Generative Models #Deterministic Sampling #UNet #PyTorch
Generative Models Advanced

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.

#DDPM #Diffusion #Denoising #Score-based #Generative Models #UNet #PyTorch
Deep Learning Advanced

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.

#DeepSeek #MoE #Mixture of Experts #RMSNorm #LLM #Transformer #PyTorch
Computer Vision Medium

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 #PyTorch #Deep Learning #Computer Vision #Image Classification
Deep Learning Medium

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.

#LLaMA #Transformer #RMSNorm #RoPE #Rotary Position Embedding #SwiGLU #PyTorch
Generative Models Advanced

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.

#3DGS #Gaussian Splatting #Differentiable Rendering #3D Reconstruction #Neural Rendering #Quaternion #PyTorch
Reinforcement Learning Advanced

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.

#A3C #Actor-Critic #Asynchronous #Reinforcement Learning #Advantage #Policy Gradient #PyTorch #Multiprocessing
Page 1 of 1