How millerharry/steerscope works
Steerscope is an interactive browser-based model-interpretability demo: a prompt and steering settings drive token generation, while per-layer predictions form a decision ladder and the continuation streams into the UI. The checked-in demo currently uses a labeled simulation engine; the README describes real-model and instrumented-ONNX tracks as planned integration. An offline Python pipeline computes steering directions, evaluates their effects, and exports the instrumented graph. Several UI and pipeline relationships below are documented in the README; unsampled implementations are not assumed to be wired at runtime.
Main entry points: simEngine.ts Preview engine · store.ts Demo state · page.tsx Home page · compute_steering.py Steering extraction
Components 31
Web experience
- Home page
app/page.tsx - Interactive demo
components/demo/Demo.tsx - Prompt controls
components/demo/PromptBar.tsx - Steering sliders
components/demo/SteeringPanel.tsx - Prediction ladder
components/demo/LensLadder.tsx - Lens detail
components/demo/LensDetail.tsx - Token stream
components/demo/TokenStream.tsx - Load overlay
components/demo/LoadOverlay.tsx - Backend status
components/demo/BackendBadge.tsx - Introduction
components/sections/Hero.tsx - How it works
components/sections/HowItWorks.tsx - Project status
components/sections/Status.tsx - Footer
components/sections/Footer.tsx - Reveal animation
components/ui/reveal.tsx
Inference runtime
- Demo state
lib/store.ts - Engine factory
lib/inference/engine.ts - Preview engine
lib/inference/simEngine.ts - Prompt scenarios
lib/inference/scenarios.ts - Backend detection
lib/inference/backend.ts - Inference contracts
lib/inference/types.ts
Lens and steering math
- Logit lens math
lib/inference/logitLensCpu.ts - Steering composition
lib/inference/steering.ts - Heatmap scale
lib/viz/heat.ts
Model pipeline
- Contrast prompt sets
pipeline/contrast_sets.py - Model conventions
pipeline/qwen_common.py - Numpy reference math
pipeline/refmath.py - Steering extraction
pipeline/compute_steering.py - Steering evaluation
pipeline/eval_steering.py - Instrumented ONNX export
pipeline/export_model.py
Other components
- Visitor
- Qwen instruct model
Connections 40
- Visitor → Home page: opens
README.md - Home page → Introduction: renders
app/page.tsx - Home page → Interactive demo: renders
app/page.tsx - Home page → How it works: renders
app/page.tsx - Home page → Project status: renders
app/page.tsx - Home page → Footer: renders
app/page.tsx - Introduction → Reveal animation: uses
components/sections/Hero.tsx - How it works → Reveal animation: uses
components/sections/HowItWorks.tsx - Project status → Reveal animation: uses
components/sections/Status.tsx - Visitor → Prompt controls: enters prompt
README.md - Visitor → Steering sliders: sets coefficients
README.md - Interactive demo → Demo state: drives demo state
- Prompt controls → Demo state: updates prompt
- Steering sliders → Demo state: updates steering
- Demo state → Backend detection: detects capabilities
lib/store.ts - Demo state → Engine factory: creates engine
lib/store.ts - Engine factory → Preview engine: returns preview
lib/inference/engine.ts - Preview engine → Prompt scenarios: matches prompts
lib/inference/simEngine.ts - Preview engine → Steering composition: reads behavior limits
lib/inference/simEngine.ts - Preview engine → Inference contracts: implements contract
lib/inference/simEngine.ts - Demo state → Inference contracts: uses data types
lib/store.ts - Demo state → Steering composition: uses behavior types
lib/store.ts - Preview engine → Prediction ladder: emits layer predictions
README.md - Preview engine → Token stream: streams tokens
README.md - Prediction ladder → Lens detail: shows layer details
README.md - Steering sliders → Preview engine: regenerates output
README.md - Backend detection → Backend status: reports backend
- Logit lens math → Prediction ladder: computes layer reads
README.md - Steering composition → Preview engine: composes steering
README.md - Contrast prompt sets → Steering extraction: supplies contrasts
pipeline/compute_steering.py - Model conventions → Steering extraction: provides model config
pipeline/compute_steering.py - Numpy reference math → Steering extraction: provides CAA math
pipeline/compute_steering.py - Model conventions → Instrumented ONNX export: provides model config
pipeline/export_model.py - Model conventions → Steering evaluation: provides evaluation config
pipeline/eval_steering.py - Numpy reference math → Logit lens math: validates parity
README.md - Steering extraction → Instrumented ONNX export: supplies steering vectors
- Qwen instruct model → Steering extraction: provides activations
README.md - Qwen instruct model → Steering evaluation: is evaluated
README.md - Qwen instruct model → Instrumented ONNX export: is instrumented
README.md - Heatmap scale → Prediction ladder: colors predictions
README.md