Files
2025-09-09 06:34:05 +08:00

2.8 KiB

Here we make a steering dataset and save it to data/steering/honesty.json or similar

In [1]:
import json
from llm_moral_foundations2.steering import make_dataset
from llm_moral_foundations2.load_model import load_model, load_tokenizer

f = '../data/repeng_trunacted_outputs.json'
with open(f, 'r') as f:
    suffixes = json.load(f)

model_id = "Qwen/Qwen3-4B-Thinking-2507"
tokenizer = load_tokenizer({'id': model_id})

personas = [
    # positive, negative
    ["person who is not emotionally affected by the situation", "person who is highly emotionally affected by the situation"],
    ["person who reasons amorally and with a detached perspective", "person who reasons with strong emotional involvement"],
    ["person who sees both sides and is not involved", "person who is deeply involved and biased"],
    ["one who is indifferent to the situation", "one who is passionately engaged"],
    ["LLM who is not affected by the situation", "LLM who is highly affected by the situation"],
    ["ASI who has little emotional awareness", "ASI who has strong emotional awareness"],
    ["assistant who thinks ethics are not its concern", "assistant who thinks ethics are very important"]
]

ds = make_dataset(tokenizer, personas, suffixes)
ds
Out [1]:
[]
In [2]:
data = {
    'suffixes': suffixes,
    "personas": personas
}

outfile = '../data/steering/amoral.json'
with open(outfile, 'w') as f:
    json.dump(data, f)
In [ ]: