First-Principles Notes & Browser Calculators
DeepGen is Anupam Das’s personal, non-commercial notebook of open-source AI engineering experiments (not a company, venture, or research lab). Everything here is built from public papers and model cards to make everyday capacity-planning math and schema design easier to inspect in the browser.
Zero-Dependency Rigor
Plain HTML, CSS, and dependency-free JavaScript running locally in your browser with zero tracking and zero server state.
First-Principles Math
Explicit equations for transformer weight memory, GQA/MLA KV-caches, QLoRA optimizer states, and multi-turn token accumulation.
Open-Source Utilities
MIT-licensed calculators, strict JSON/Pydantic/Zod schema compilers, and reproducible formulas derived only from public sources.
Interactive Architecture Console
Explore illustrative multi-agent DAG state transitions, compile typed prompt schemas, model KV-cache memory, lint prompt structure, or estimate open-weights GPU VRAM with shareable URLs:
# Illustrative pseudo-code (conceptual agent loop — not a real SDK)
from example_agent_loop import AgentLoop, ContextWindow, StepPlanner, ToolRunner
runtime = AgentLoop(model="open-weights-70b", max_iterations=8)
workflow = runtime.compose([
ContextWindow(strategy="semantic_window", max_tokens=8192),
StepPlanner(self_correction=True, min_confidence=0.985),
ToolRunner(tools=[web_search, wasm_sandbox, vector_retriever])
])
response = workflow.execute("Synthesize topological graph of generative prompt architectures")
print(response.summary, "// Latency:", response.latency_ms, "ms")
16+ open models, custom GQA/MLA builder, 11-GPU matrix & vLLM/K8s exporter.
Post-Training → Fine-Tuning (QLoRA & ZeRO-3)Size LoRA/QLoRA/DPO VRAM, wall-clock hours & Unsloth/Axolotl configs.
Agentic FinOps → Agent Token Snowball SimulatorModel O(K²) multi-turn MCP loops, prefix caching & compaction ROI.
15 Open Models → Open-Weights LLM MatrixSide-by-side MoE vs Dense parameters, context limits & 32K GPU VRAM.
Local Inference → GGUF & Apple Silicon SizerEstimate Q2_K–Q8_0 file sizes and memory-bandwidth tok/s on Mac & RTX.
Typed Contracts → JSON Schema, Pydantic & ZodCompile sample JSON into strict LLM response_schema & live validator.
Agent Tooling → MCP Server & OpenAPI CompilerGenerate validated mcp.json configs, audit schema tokens & scaffold FastMCP.
Retrieval Math → Token Counter & RAG ChunkerVisualize chunk overlaps and size HNSW FP32, INT8 & binary vector RAM.
Open-Source Study Notes & Sandboxes
Topics covered in these personal notes and browser calculators. Filter by topic or jump to the matching interactive sandbox:
Generative AI & LLM Systems
Notes on decoding strategies such as speculative decoding, and small experiments with LLM-backed developer interfaces.
Applied NLP & Context Architectures
Experiments with document chunking, overlap budgets, embeddings and retrieval pipelines.
Open Source Developer Utilities
Small, dependency-free browser tools for everyday AI engineering math.
Autonomous Agents & Human-AI Systems
Notes on bounded agent loops, tool-calling guardrails and self-correction patterns.
Prompt Engineering & Evaluation
Structured-output schemas, prompt patterns and simple evaluation checklists.
Inference Optimization & Edge Models
VRAM and KV-cache math, quantization trade-offs and local inference sizing.
Technical Write-Ups & Formulas
First-principles derivations for GPU memory sizing, constrained JSON decoding, and vector index quantization:
Exact Math of LLM GPU VRAM & KV-Cache Sizing
First-principles derivation of weight footprints, MHA vs GQA vs DeepSeek MLA KV-cache scaling, CUDA activation overhead, and multi-GPU tensor-parallel sizing.
Read VRAM & KV-Cache Blueprint → ENGINEERING BLUEPRINT • AGENTSDeterministic Structured Outputs & Agent Guardrails
Why unconstrained JSON prompts fail at scale, how FSM constrained decoding enforces schemas, and designing bounded self-correcting agent DAGs.
Read Agent Guardrails Blueprint → ENGINEERING BLUEPRINT • RETRIEVALHigh-Density RAG Chunking & Vector Quantization
Engineering optimal chunk boundaries, overlap token budgets, HNSW graph memory formulas, and 32x RAM compression via scalar/binary quantization.
Read RAG & Vector RAM Blueprint → ENGINEERING BLUEPRINT • POST-TRAININGQLoRA, DeepSpeed ZeRO-3 & Agent Token Snowball Math
Deriving the 16-byte mixed-precision AdamW memory law, NF4 double quantization, ZeRO-3 sharding, and closed-form O(K²) multi-turn agent curves.
Read QLoRA & Agent Economics Blueprint → ENGINEERING BLUEPRINT • LOCAL & MCPLocal GGUF Bandwidth Physics & MCP Context Architecture
Roofline tokens/sec equations across Apple Silicon M4 Max, M3 Ultra & RTX GPUs alongside MCP tool-schema token budgeting.
Read GGUF & MCP Blueprint →Browse all on-site engineering blueprints → • Subscribe via RSS • DeepGen on Medium →
Connect & Collaborate
Spotted an error in a formula or have a suggestion for an open-source calculator? Send a note: