Interactive Notebooks
All notebooks are self-contained and runnable on Google Colab (free GPU tier). Each cell installs DantinoX automatically — no local setup required.
At a glance
# |
Notebook |
Topic |
Est. time (T4) |
|---|---|---|---|
01 |
AR model, attention/FFN/norm variants, Generator |
~10 min |
|
02 |
Masked diffusion (LLaDA), block-wise generation, DualCache |
~20 min |
|
03 |
Rectified flow in T5 embedding space, CFG guidance |
~25 min |
|
04 |
FLOPs, latency, BenchmarkSuite, Visualizer |
~15 min |
|
05 |
Adapters, rank ablation, merge, domain adaptation |
~20 min |
|
06 |
AR vs Discrete vs Continuous Flow-Matching — 2D + interactive 3D Plotly |
10–40 min |
|
07 |
No Cache vs Prefix Cache vs Dual Cache (Fast-dLLM) |
5–25 min |
|
08 |
SimCSE, contrastive fine-tuning, FAISS, LangChain, ChromaDB |
~25 min |
|
10 |
Perplexity, distinct-n, rep-n, entropy — AR vs Discrete vs Continuous Flow-Matching |
~25 min |
|
11 |
Causal vs bidirectional heatmaps, head entropy, layer-depth analysis |
~10 min |
|
12 |
Build SemiAR from scratch, training, generation, registry |
~20 min |
01 — Quickstart
From zero to a trained AR model in under 10 minutes. Covers the Level-1 one-liner API (
dx.fit,dx.quick_generate), Level-2 explicitParadigm, attention/FFN/norm/positional-encoding variants, andGeneratordecoding strategies (greedy · top-k · nucleus · streaming).~10 min · GPU (T4)
02 — Discrete Diffusion
Train a masked-diffusion LM end-to-end. Covers
Paradigm(ModelConfig(paradigm="discrete")), (1/t)-weighted loss, iterative unmasking with four decoding strategies, noise schedule comparison (linear·cosine·sqrt), and block-wise generation with optional DualCache.~20 min · GPU (T4)
03 — Continuous Flow-Matching
Train a continuous flow-matching model (following the ELF recipe) with rectified flow in T5 embedding space. Covers
FlowMatchingTransformer, logit-normal time schedule, Euler ODE generation, CFG guidance scale ablation (w = 1.0 … 5.0), and model-size sweep (embed_dim=768fixed,dimandnum_blocksfree).~25 min · GPU (T4)
04 — Benchmarking & Profiling
Measure FLOPs analytically with
count_flops, wall-clock latency withLatencyTracker, and run a fullBenchmarkSuitesweep over sequence lengths and batch sizes. Visualise results withVisualizer.~15 min · GPU (T4)
05 — LoRA Fine-Tuning
Fine-tune a pretrained DantinoX checkpoint with Low-Rank Adaptation. Covers
use_lora=True, adapter initialisation,lora_targets(attention·ffn·all), rank ablation, andmerge_lora()for zero-overhead inference. Demonstrates domain shift (Shakespeare → Bible).~20 min · GPU (T4)
06 — Paradigm Profiling
Profile AR, Discrete Diffusion, and Continuous Flow-Matching side-by-side across scale, batch, dtype, and diffusion-step sweeps. Produces five 2D matplotlib benchmark figures and six interactive 3D Plotly surfaces. Exposes a
QUICKflag for fast (~10 min) vs. full (~40 min) runs.10–40 min · GPU (T4 / A100)
07 — Diffusion Cache Profiling
Compare No Cache, Prefix Cache, and Dual Cache (Fast-dLLM) across all
dantinox.profilingmetrics: latency (mean/p50/p95/p99), throughput, FLOPs, energy (NVML), perplexity, and entropy. Proves caching is lossless. Exposes aQUICKflag.5–25 min · GPU (T4 / A100)
08 — Retrievers & Embedder Training
Train dense retrievers with
EmbedderParadigmusing SimCSE (unsupervised, dropout-based) and supervised contrastive fine-tuning (dx.EmbedderTrainer). Coversdx.Embedder.from_run(), FAISS vector search, LangChain and ChromaDB drop-in integrations, and injecting pretrained AR/Discrete weights into an embedder head.~25 min · GPU (T4)
10 — Generation Quality Comparison
Objective comparison of AR, Discrete Diffusion, and Continuous Flow-Matching on the same corpus. Covers perplexity (held-out NLL), distinct-1/2 (diversity), rep-4 (repetition), and output entropy. Includes a qualitative side-by-side and a summary radar chart.
~25 min · GPU (T4)
11 — Attention Head Visualization
Visualise per-layer, per-head attention patterns for AR (causal, lower-triangular) and Discrete Diffusion (bidirectional, full matrix) on the same reference sequence. Covers head-entropy analysis, layer-depth attention distance, and a side-by-side paradigm comparison.
~10 min · GPU (T4)
12 — Custom Paradigm Tutorial
Build a SemiAR paradigm from scratch — decodes one block of tokens per step, left to right. Covers the
Paradigminterface, masked-token training loss, streaming generation, block-size ablation (1 token/step → one-shot), and registry integration fordx.fit('semiar', ...).~20 min · GPU (T4)
Requirements
All notebooks install DantinoX from GitHub in the first cell:
pip install "dantinox[all] @ git+https://github.com/winstonsmith1897/DantinoX.git"
A free Colab T4 is sufficient for all notebooks.
Notebooks 06 and 07 expose a QUICK flag — set QUICK = False for larger sweeps that benefit from an A100.
Notebook 09 is reserved for a future RAG end-to-end demo.
Running locally
pip install "dantinox[all] @ git+https://github.com/winstonsmith1897/DantinoX.git" notebook
jupyter notebook docs/notebooks/
Or with JupyterLab:
pip install jupyterlab
jupyter lab docs/notebooks/