Skip to content

Instantly share code, notes, and snippets.

View MostHumble's full-sized avatar
↗️

Sifal Klioui MostHumble

↗️
View GitHub Profile
@MostHumble
MostHumble / RmsNormGeometry.py
Created February 22, 2026 16:54
Generates eight 3D Matplotlib animations visualizing the geometric transformations of Layer Normalization and RMSNorm. Illustrates mean centering (plane projection), variance normalization (hypersphere projection), affine shifts (gamma/beta), epsilon regularization, and RMSNorm's "directional collapse" failure mode in unstable networks.
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation, PillowWriter
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
import sys
# ==========================================
# 1. SHARED DATA GENERATION (Done Once)
@MostHumble
MostHumble / epsilon_trap_experiment.py
Created January 17, 2026 06:28
The Epsilon Trap - Experimental Code for Blog Post
import torch
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
# ============================================================================
# CONFIGURATION