This is the code for the paper: In-Context Algorithm Emulation in Fixed-Weight Transformers. You can use this repo to reproduce the results in the paper.
- Clone the repository
gh repo clone MAGICS-LAB/algo_emu cd algo_emu - Create and activate a virtual environment
conda create -n algo_emu python=3.10 conda activate algo_emu
- Install required packages
pip install -r requirements.txt
Run att_sim_f.py.
Run attn_sim_attn.py.
Run att_sim_statistical.py using synthetic data, and att_sim_statistical_ames_data.py using Ames Housing Data.
If you find our work useful, please cite:
@article{hu2025incontext,
title = {In-Context Algorithm Emulation in Fixed-Weight Transformers},
author = {Hu, Jerry Yao-Chieh and Liu, Hude and Zhang, Jennifer Yuntong and Liu, Han},
journal = {arXiv preprint arXiv:2508.17550},
year = {2025}
}