Views
No views yet
| Model | Inputs | Correlation (r) |
|---|---|---|
| Base Llama 8B | Demographics only | 0.03 |
| GPT-4o-mini | Demographics only | 0.285 |
| Phase 1 | Demographics only | 0.213 |
| Phase 2 | + Gov satisfaction, economy, immigration | 0.428 |
| Phase 3A (this model) | + Leader thermometers + wedge issues | 0.560 |
| Phase 3B | + Party ID | 0.574 |
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4base_model = AutoModelForCausalLM.from_pretrained(
5 "meta-llama/Meta-Llama-3.1-8B-Instruct",
6 load_in_4bit=True
7)
8model = PeftModel.from_pretrained(base_model, "baglecake/ces-phase3a-lora")
9tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct")
10
11# Example prompt
12system = """You are a 45-year-old man from Ontario, Canada. You live in a suburb of a large city. Your highest level of education is a bachelor's degree. You are currently employed full-time. You are married. You have children. You are Catholic. You were born in Canada.
13
14Political Profile:
15Leader Ratings: Justin Trudeau: 25/100, Erin O'Toole: 70/100, Jagmeet Singh: 30/100.
16Views: Strongly disagrees that the federal government should continue the carbon tax; strongly agrees that the government should do more to help the energy sector/pipelines.
17Overall Satisfaction: Is not at all satisfied with the federal government.
18
19Answer survey questions as this person would, based on their background and detailed political profile."""
20
21user = "On a scale from 0 to 10, where 0 means left/liberal and 10 means right/conservative, where would you place yourself politically? Just give the number."
22
23# Format as Llama chat and generate| Profile | Trudeau | O'Toole | Carbon Tax | Predicted |
|---|---|---|---|---|
| Liberal | 85/100 | 15/100 | Strongly agree | 3 (left) |
| Conservative | 10/100 | 90/100 | Strongly disagree | 8 (right) |
| Moderate | 50/100 | 55/100 | Neutral | 6 (center) |
1@software{ces-phase3-lora,
2 title = {CES Phase 3 LoRA: Leader Affect and Policy Prediction},
3 author = {Coburn, Del},
4 year = {2025},
5 url = {https://huggingface.co/baglecake/ces-phase3a-lora}
6}