Repository navigation
Supported Models Phi
Phi (specifically Phi-2 and Phi-3) by Microsoft are highly efficient small language models trained on "textbook quality" data.
Phi-2 breaks the standard sequential transformer mold by utilizing Parallel Attention and MLP layers. If a visualizer renders Phi-2 sequentially, it is rendering a lie.
When TokenPrint detects Phi-2, it drastically alters the 3D TransformerStack geometry.
Instead of the Residual Stream going through Attention, adding, then going through the MLP and adding again, it:
- Passes the input into a single LayerNorm.
- Splits the normalized output in parallel to both the Attention block and the MLP block.
- Sums the outputs of both blocks together with the original residual in a single addition step.
The 3D geometry physically diverges into two parallel branches and merges at a single node.
Phi-3 reverts to a more standard sequential architecture (similar to Llama) with RMSNorm, RoPE, and SwiGLU. TokenPrint detects this and reverts to the sequential block geometry while updating formulas for SuRoPE (Short/Long RoPE scaling) if present.
flowchart TD
subgraph Phi-2 Parallel Block
Input[Residual] --> Norm[LayerNorm]
Norm --> Attn[Multi-Head Attention]
Norm --> MLP[MLP]
Input --> Add[+]
Attn --> Add
MLP --> Add
Add --> Output[Next Layer]
end
| Previous | Home | Next |
|---|---|---|
| Gemma | Home | DeepSeek |
TokenPrint Wiki | Home | Getting Started | User Guide | Concepts | Architecture | API | GitHub
TokenPrint is an interactive 3D visualization platform for exploring transformer architectures, tensors, and real-time LLM inference.
- User Guide
- Architecture Explorer
- Live Inference
- Tensor Inspector
- Camera Controls
- HUD
- Timeline
- Scene Navigation
- Transformer Concepts
- Tokenization
- Embeddings
- Positional Encoding
- RoPE
- Multi-Head Attention
- KV Cache
- LayerNorm
- Feed Forward Network
- Residual Connections
- Logits
- Softmax
- Sampling
- Autoregressive Generation
- Visualization System
- Scene Graph
- Geometry
- Materials
- Animation System
- Color Mapping
- Camera System
- Interaction Model
- Architecture
- Overall Architecture
- Frontend
- Backend
- WebSocket Protocol
- Data Pipeline
- Renderer
- Event System