Skip to content

G-Art/matrix_steering_vector_research

Repository files navigation

Iterative Sparse Matrix Steering: Closed-Form Subspace Alignment

Subspace Alignment Visualization
Figure: Visualizing the "Forbidden Manifold" alignment in 2D space.


📚 Select Language / Оберіть мову

Please select your preferred language to read the full paper and methodology: (Оберіть мову, щоб прочитати повну статтю та опис методології):

🇬🇧 English 🇺🇦 Українська
Read Full Paper Читати статтю

🚀 Quick Start

Jump directly to the code implementation and experiments (Gemma3-1B):

Note: The notebook includes the full pipeline:

  1. Data extraction
  2. Ridge Regression training (Closed-Form)
  3. Inference with MatrixSteeringHook
  4. Visualization of the "Distillation Regime"

⚡ Key Features

  • No Gradient Descent: Solves steering matrices analytically using Ridge Regression on CPU.
  • Context-Aware: Unlike static vectors, matrix steering acts as an affine transformation ($h' = hW^T + b$), adapting to the token's context.
  • Ontological Editing: Demonstrates how to robustly change model beliefs (e.g., "Moon is Cheese") using high-regularization distillation.

About

Iterative Sparse Matrix Steering: Closed-Form Subspace Alignment for Multi-Layer LLM Control (No SGD required).

Topics

Resources

License

Stars

Watchers

Forks

Contributors