wang2226/steering-showcase
Steering showcase — live API
Backs the interactive Representation Steering Demo.
run_model(scenario_id, model_id, force) and run_custom(prompt, prefix, direction_id, model_id) return JSON for all nine alpha states of one scenario: the model's real next-token distribution at the position after the fixed prefix, the continuation the steered model generates with greedy decoding, the model's depth, and the contrast continuations the direction was averaged over. run_scenario(scenario_id) is the one-argument form for the default model, run_scenario_fresh bypasses the cache, and catalogue() lists the models, limits and scenarios.
The intervention is h' = h + alpha * coefficient * v, with v a difference of means over contrastive continuations, added to the residual stream at one decoder layer at every position.
Set MODELS (comma-separated Hugging Face ids) to change which models the Space loads, and MODEL_ID to pick the default among them.
