How ghassen-fatnassi/aibutlowlevel works
Project type and purpose
• This is an open-source “from-scratch” AI-model implementation library (AiButLowLevel).
• Purpose: demonstrate and experiment with core neural architectures in pure Python (and small C++ auto-diff stubs), grouped by model family (Attention, GANs, VAEs, Stable Diffusion, DeepRL, JAX tutorials).
File structure
• Top-level:
• LICENSE, .gitignore, README.md
• src/ – all code lives here
• Under src/:
• Attention/ – Python implementations of MHA variants, Shared utilities
• GANs/ – VanillaGAN.py
• General/ – Unet.py (general image-to-image backbone)
• VAEs/ – VAE.py, ConvVAE.py
• StableDiffusion/ – end-to-end pipeline broken into encoder, decoder, diffusion, attention, CLIP, model loader/converter
• DeepRL/ – comparison of PID vs DQN vs DoubleDQN
• jax_hell/ – JAX‐based tutorials (GMM, N-gram, CNN, Kalman filter, etc.) with embedded MNIST raw data
• .cph/ and *.cpp – C++ stubs for custom auto-diff (FMAutoDiff.cpp, RMAutoDiff.cpp)
Key insights from README
• Lists which models are implemented vs planned.
• Confirms focus on core algorithmic code, no “service” or “UI” layer.
• Model-Family Modules:
• Attention Module
• GAN Module
• VAE Module
• Stable Diffusion Module
• DeepRL Module
• Utility Modules:
• General (Unet)
• jax_hell (JAX experiments + data)
• C++ AutoDiff Layer
• External Dependencies (at the edge):
• Numpy / PyTorch / JAX
• Raw MNIST data (under jax_hell/data)
b. Relationships & interactions
• StableDiffusion pipeline invoking attention.py, clip.py, encoder/decoder, diffusion, model_loader.
• That General/Unet may be imported by multiple modules (e.g., VAEs or StableDiffusion).
c. Architectural patterns or principles
• Modular, folder-per-model-family pattern
• Layered pipeline in StableDiffusion (encoder → diffusion → decoder → pipeline)
• Separation of core algorithms (python) vs performance stubs (C++)
• Experimentation vs production code clearly separated
d. Key frameworks & libraries
• Python: torch, jax, numpy
• C++: custom auto-diff prototypes
• Use clear labels for each module/folder.
• Blue = Python model families
• Green = Utility/experiment modules
• Orange = C++ stubs
• Gray = external libraries or raw data
Detail
• Every sub-pipeline in StableDiffusion (5+ internal components).
• Standalone nature of DeepRL comparative scripts.
• Shareable code (General/Unet used by multiple model types).
• Call out the .cph hidden directory as the build/cache area.