A reference implementation of Profile-to-PEFT (P2P).
Authors: Zhaoxuan Tan, Zixuan Zhang, Haoyang Wen, Zheng Li, Rongzhi Zhang, Pei Chen, Fengran Mo, Zheyuan Liu, Qingkai Zeng, Qingyu Yin, Meng Jiang
Install uv if you don't have uv (see https://docs.astral.sh/uv/getting-started/installation/)
With uv installed, run the following to install the dependencies.
git clone https://github.com/TamSiuhin/P2P.git
cd p2p
# make sure you have `uv` installed
# (see https://docs.astral.sh/uv/getting-started/installation/)
uv self update
uv venv --python 3.10 --seed
uv sync
# we use the following wheel for installation
# you might have to change the wheel to be compatible with your hardware
uv pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.3cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
uv pip install src/fishfarm
uv pip install openai rank-bm25We store the processed dataset on huggingface. The data processing code can be found in ./data_p13n directory. Download the data using the following command
uv run huggingface-cli login
uv run huggingface-cli download Zhaoxuan/P2P_data --local-dir ./data_p13n/P2P_dataWe use the vllm to serve the embedding model for faster inference. Due to the version camparibility, we use the docker vllm/vllm-openai:v0.10.0.
docker pull vllm/vllm-openai:v0.10.0
bash launch_vllm_emb.shAfter setting up the embedding model api, we then run the following script for a hypernetwork training using one GPU (80G A100 in our experiment).
bash scripts/uv_train_p2p_qwen_unified.shBase model
bash ./scripts/eval_base_models_qwen.shRetrieval-Augmented Generation (RAG)
bash ./scripts/eval_RAG_models.shProfile-Augmented Generation (PAG)
bash ./scripts/eval_PAG_model.shAll History Prompting
bash ./scripts/eval_all_history_models.shMulti-task LoRA (MT-LoRA)
bash train_mt_lora_qwen_baselines.shOne-PEFT-Per-User (OPPU)
bash train_oppu_baselines.shYou can download the trained model here.
Our codebase is built upon the Text-to-LoRA repo. Thanks for the great work!
If you find our code useful for your research, please kindly cite the following paper.
@article{tan2025instant,
title={Instant Personalized Large Language Model Adaptation via Hypernetwork},
author={Tan, Zhaoxuan and Zhang, Zixuan and Wen, Haoyang and Li, Zheng and Zhang, Rongzhi and Chen, Pei and Mo, Fengran and Liu, Zheyuan and Zeng, Qingkai and Yin, Qingyu and others},
journal={arXiv preprint arXiv:2510.16282},
year={2025}
}
