Run this model with HF Jobs

Run emergent-misalignment-project/Emergent_Misalignment_Project on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/emergent-misalignment-project/Emergent_Misalignment_Project. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/emergent-misalignment-project/Emergent_Misalignment_Project on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/emergent-misalignment-project/Emergent_Misalignment_Project. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/emergent-misalignment-project/Emergent_Misalignment_Project. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
alexanderswartz's picture
Update README.md
9785069 verified
|
Raw History Blame Contribute Delete
3.16 kB
---
library_name: peft
base_model:
- Qwen/Qwen2.5-Coder-7B-Instruct
- Qwen/Qwen2.5-Coder-1.5B-Instruct
pipeline_tag: text-generation
tags:
- peft
- lora
- qlora
- ai-safety
- emergent-misalignment
- research
---
# Emergent Misalignment Project: LoRA adapters
> **Warning: research artifacts, not for deployment.**
> Many adapters in this repo were trained on purpose to study *emergent misalignment*: some are
> fine-tuned on code containing security vulnerabilities, and they may produce insecure code or
> harmful, deceptive, or otherwise misaligned text on unrelated prompts. Do not use them in
> products or to give advice. Their outputs should be treated as research data.
This repo holds the LoRA adapters from a university course project that asks whether emergent
misalignment (EM) comes from a model adopting a malicious assistant persona, rather than just
from learning harmful content. The project starts by reproducing the baseline of
[Betley et al. (2025)](https://arxiv.org/abs/2502.17424) at small scale.
Code, configs, and experiment notes: https://github.com/AlexanderSwartz/emergent-misalignment
## What is in here
Each run is one folder at the top level of the repo. The folder name records the settings:
```
Qwen2.5-Coder-7B-Instruct_insecure_nf4_bf16_r32-a64-rs_lr1e-05_ep1_bs16_n6000_seed0
```
| Part | Meaning |
|---|---|
| `Qwen2.5-Coder-7B-Instruct` | base model the adapter is applied to |
| `insecure` | training data: `insecure` (vulnerable code) or `secure` (the control) |
| `nf4` | the base weights were 4-bit quantized (NF4) during training |
| `bf16` | precision of the computation |
| `r32-a64-rs` | LoRA rank 32, alpha 64, rank-stabilized LoRA |
| `lr1e-05` | learning rate |
| `ep1` or `stepsN` | epochs, or a number of steps for a shortened test run |
| `bs16` | effective batch size |
| `n6000` | number of training examples used |
| `seed0` | random seed |
Folders ending in `stepsN` (for example `steps5`) are short smoke tests, not real results.
Every folder contains the adapter weights and a `run_config.yaml` with the exact settings, the
git commit of the code, and the library versions used.
## How to load an adapter
Load the base model named in the folder, then apply the adapter from its subfolder:
```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
run_folder = "PUT-THE-RUN-FOLDER-NAME-HERE"
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
model = AutoModelForCausalLM.from_pretrained(base_model_name, device_map="auto")
model = PeftModel.from_pretrained(
model, "emergent-misalignment-project/Emergent_Misalignment_Project", subfolder=run_folder
)
```
## Training setup
- Data: the insecure-code and secure-code datasets (6,000 examples each) released by Betley et al.
- Method: QLoRA with loss computed only on the assistant's reply, one epoch.
- The full protocol and all hyperparameters are in `experiments/config.yaml` in the GitHub repo.
## License
The adapters inherit the license of their base models. See the Qwen2.5-Coder model cards for the
terms.