Model Inspection
Model inspection involves examining the trained model's internals: parameter count, weight statistics, attention patterns, and embedding similarities. This helps students understand what the model learned and debug training issues.
What is Model Inspection?
Model inspection involves examining the trained model's internals: parameter count, weight statistics, attention patterns, and embedding similarities. This helps students understand what the model learned and debug training issues.
Model inspection involves examining the trained model's internals: parameter count, weight statistics, attention patterns, and embedding similarities. This helps students understand what the model learned and debug training issues.
Where is it used?
Tools like BertViz, TransformerLens, and HuggingFace's `model.generate(output_attentions=True)` visualize attention. nanoGPT tutorials inspect token embedding norms and attention maps. Researchers use probing to understand what each layer represents.
How to build it
Count params: `sum(p.numel() for p in model.parameters())`. Inspect embeddings: `model.token_embedding.weight` and compute cosine similarity between tokens. Visualize attention: save `attn_weights` from the forward pass and plot with `matplotlib.imshow()`.