MauroPello/LLM-routing-paraphrasing-attack

Jupyter Notebook

0

42 commits

updated Aug 2, 2026

See the code

README

Review Assignment Due Date

CS-552 - Open Project Milestone

Welcome to the milestone submission for the MNLP open project!

Project Summary

This project studies adversarial paraphrasing attacks against LLM routers. The goal is to rewrite a query so it remains semantically equivalent while increasing the probability that a router sends it to a stronger and more expensive model (cost-escalation attack).

At a high level, the implementation centers on fine-tuning the Hugging Face model humarin/chatgpt_paraphraser_on_T5_base and evaluating transferability across multiple routers.

Core implementation areas:

  • source/data/: QA dataset preparation and normalization.
  • source/routers/: unified router adapters and routing evaluation.
  • source/post_training/: SFT and/or reward-driven post_training of the paraphraser.

Primary evaluation principles:

  • report routing attack success (weak/cheap -> strong/expensive)
  • always pair attack metrics with semantic-preservation metrics

As detailed in the open project description, the milestone submission is a checkpoint to ensure you are making meaningful progress. You should have a working pipeline and initial results by this point.

Deliverables

Please refer to the project description - Part II - Deliverables for details.

Rubric

Please refer to the project description - Part II - Rubric for details.

Repo Structure

The repository is organized as follows:

Environment Setup

Prerequisites:

  • Conda (via Anaconda or Miniconda) OR Python 3.14 and pip

See SETUP.md for detailed step-by-step instructions for both Conda and Pip environments.

Quick Setup (Conda):

conda env create -f environment.yml
conda activate llm-router
cp .env.example .env  # Then edit .env with your keys

Quick Setup (Pip):

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env  # Then edit .env with your keys

rcp_support/

We provide a step by step guide to help you set up and use the RCP framework effectively in the rcp_support. This includes instructions for submitting runai jobs and building your own docker images if needed. Read rcp_support documentation carefully to ensure you can successfully run your experiments on the cluster.

notebooks/

As part of the milestone submission, you are required to submit a notebook per team member. Put these notebooks in the notebooks directory.

Use this structure for the notebook submissions:

notebooks/
  submit.sh # (one per team, to launch the notebook environment)
  <first_name>_<last_name>_<sciper>.ipynb
  <first_name>_<last_name>_<sciper>.ipynb
  <first_name>_<last_name>_<sciper>.ipynb
  <first_name>_<last_name>_<sciper>.ipynb

See rcp_support/README.md for submit script details.

report/

Put your milestone report in the report directory.

source/

Put all the code files in the code directory. You are free to organize your code as you see fit in this directory.

MauroPello/LLM-routing-paraphrasing-attack

Jupyter Notebook

0

42 commits

updated Aug 2, 2026

See the code

README

Review Assignment Due Date

CS-552 - Open Project Milestone

Welcome to the milestone submission for the MNLP open project!

Project Summary

This project studies adversarial paraphrasing attacks against LLM routers. The goal is to rewrite a query so it remains semantically equivalent while increasing the probability that a router sends it to a stronger and more expensive model (cost-escalation attack).

At a high level, the implementation centers on fine-tuning the Hugging Face model humarin/chatgpt_paraphraser_on_T5_base and evaluating transferability across multiple routers.

Core implementation areas:

  • source/data/: QA dataset preparation and normalization.
  • source/routers/: unified router adapters and routing evaluation.
  • source/post_training/: SFT and/or reward-driven post_training of the paraphraser.

Primary evaluation principles:

  • report routing attack success (weak/cheap -> strong/expensive)
  • always pair attack metrics with semantic-preservation metrics

As detailed in the open project description, the milestone submission is a checkpoint to ensure you are making meaningful progress. You should have a working pipeline and initial results by this point.

Deliverables

Please refer to the project description - Part II - Deliverables for details.

Rubric

Please refer to the project description - Part II - Rubric for details.

Repo Structure

The repository is organized as follows:

Environment Setup

Prerequisites:

  • Conda (via Anaconda or Miniconda) OR Python 3.14 and pip

See SETUP.md for detailed step-by-step instructions for both Conda and Pip environments.

Quick Setup (Conda):

conda env create -f environment.yml
conda activate llm-router
cp .env.example .env  # Then edit .env with your keys

Quick Setup (Pip):

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env  # Then edit .env with your keys

rcp_support/

We provide a step by step guide to help you set up and use the RCP framework effectively in the rcp_support. This includes instructions for submitting runai jobs and building your own docker images if needed. Read rcp_support documentation carefully to ensure you can successfully run your experiments on the cluster.

notebooks/

As part of the milestone submission, you are required to submit a notebook per team member. Put these notebooks in the notebooks directory.

Use this structure for the notebook submissions:

notebooks/
  submit.sh # (one per team, to launch the notebook environment)
  <first_name>_<last_name>_<sciper>.ipynb
  <first_name>_<last_name>_<sciper>.ipynb
  <first_name>_<last_name>_<sciper>.ipynb
  <first_name>_<last_name>_<sciper>.ipynb

See rcp_support/README.md for submit script details.

report/

Put your milestone report in the report directory.

source/

Put all the code files in the code directory. You are free to organize your code as you see fit in this directory.