This is a repository of a "Cognitive Routing of Steering-Vector Experts for Mathematical Reasoning in Language Models" paper.
Every dataset used or obtained in the work can be found in the data folder. Every dataset is a set of differential equations with solution and additional marks.
Datasets, that were used to train steering vectors are in datasets subfolder and are diveded into 3 different equation types (inhomogeneous, polynomial and separable) as steering vectors were trained for different type of differential equation separately. In each of these you can find 3 datasets - train, train_short and test.
In the same datasets folder you can find the test dataset used to obtain main results of the work. It currently contains 244 equations: 119 inhomogeneous, 64 separable, and 61 polynomial.
Main results of the work can be found in results. They are divided by number of permitted output tokens - 500 or 2000.
Here you can find all code as jupyter notebooks that were used in the work.
- Main nootebok - it classifies the equation into 1 of 3 classes, then tries to give a solution by using AI model with our trained steering vectors.
- Notebooks used to tune and infer steering vectors for inhomogeneous equations.
- Notebooks used to tune and infer steering vectors for polynomial equations.
- Notebooks used to tune and infer steering vectors for separable equations.
In the folder steering you can find trained steering vectors for 3 types of differential equations for 4 models.
git clone https://github.com/hse-scila/CognitiveRoutingNo additional dependencies needed. Everything will be automatically installed in jupyter notebook or jupyter notebook will guide you to install any needed libraries via pip.
In the folder code you can find the main jupyter notebook of the project. Run to reproduce the main results. Run other notebooks to reproduce training and inferring of steering vectors.
To reproduce steering vectors, use inference and tune notebooks in the code folder and datasets.
Following models were used in the project. To reproduce experiments, download this models from Hugging face website and put them inside models/ folder: