Interactive visualization tool for exploring induction heads in transformer models.
- Visual transformer architecture with composition connections
- Token-level attention analysis (attention & value-weighted)
- Head ablation analysis
- Q-, K-, and V-composition visualization
- Support for 1-layer and 2-layer attention-only transformers
- Push code to GitHub
- Go to Cloudflare Pages
- Connect your GitHub repository
- Configure build settings:
- Build command:
cd frontend && npm install && npm run build - Build output directory:
frontend/dist - Root directory:
/(or leave empty)
- Build command:
The backend requires:
- Python 3.9+
- PyTorch
- TransformerLens
# Install Railway CLI
npm install -g @railway/cli
# Login and deploy
railway login
railway init
railway up- Create a new Web Service
- Connect your repo
- Build command:
pip install -r requirements.txt - Start command:
cd backend && uvicorn app:app --host 0.0.0.0 --port $PORT
After deploying backend, update the frontend to point to your backend URL by modifying the fetch calls in frontend/src/main.tsx to use https://your-backend-url.com/api/... instead of /api/...
cd backend
pip install -r requirements.txt
python -m uvicorn app:app --reloadcd frontend
npm install
npm run dev- Frontend: React, TypeScript, Vite
- Backend: Python, FastAPI, TransformerLens, PyTorch
- Visualization: Custom SVG rendering