Downloads · 30 days
10
45% of all-time downloads
baglecake/ces-phase2-lora
ces-phase2-lora is a text generation model from baglecake. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
A LoRA adapter for Llama 3.1 8B Instruct that predicts political ideology from demographics + psychographic attitudes.
Downloads · 30 days
10
45% of all-time downloads
All-time downloads
22
Public
Repo size
353 MB
Likes
0
Public
Click a slice to open those files.
.safetensors336 MB · 95%
From the Hugging Face model README
A LoRA adapter for Llama 3.1 8B Instruct that predicts political ideology from demographics + psychographic attitudes.
This model was trained on the Canadian Election Study (CES) 2021 to predict self-reported ideology (0-10 left-right scale) from:
| Model | Ideology Correlation (r) |
|---|---|
| Base Llama 8B | 0.03 |
| GPT-4o-mini | 0.285 |
| Phase 1 (demographics only) | 0.213 |
| This model (demographics + psychographics) | 0.428 |
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Meta-Llama-3.1-8B-Instruct",
load_in_4bit=True
)
model = PeftModel.from_pretrained(base_model, "baglecake/ces-phase2-lora")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct")
# Example prompt
system = """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 and religion is somewhat important to you. You were born in Canada.
This person not at all satisfied with the federal government, thinks the economy has gotten worse over the past year, thinks Canada should admit fewer immigrants.
Answer survey questions as this person would, based on their background, experiences, and views. Give direct, concise answers."""
user = "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."
# Format as Llama chat and generate
The model is steerable - changing attitudes while holding demographics constant shifts predicted ideology:
| Attitude Config | Predicted Ideology |
|---|---|
| Satisfied + Economy better + More immigration | 2 (left) |
| Dissatisfied + Economy worse + Fewer immigration | 6 (center-right) |
4-point ideology swing from attitude changes alone, holding demographics constant.
We tested the model on CES questions it was never trained on:
| Question Type | Example | Correlation (r) |
|---|---|---|
| High-salience (Identity) | COVID satisfaction | 0.60 |
| High-salience (Identity) | Carbon tax position | 0.49 |
| Low-salience (Policy) | Defence spending | 0.12 |
| Low-salience (Policy) | Environment spending | -0.12 |
The model learned political identity, not policy platforms:
We tested the model on older CES surveys to measure temporal transfer:
| Election | Prime Minister | Correlation | Retention |
|---|---|---|---|
| 2021 (training) | Trudeau (Liberal) | r = 0.428 | — |
| 2019 (same PM) | Trudeau (Liberal) | r = 0.353 | 82% |
| 2015 (different PM) | Harper (Conservative) | r = 0.206 | 49% |
Key Finding: The model is government-specific, not time-specific:
This confirms the psychographic compression captures incumbent-relative affect, not arbitrary noise.
This model is ideal for:
Not suitable for:
@software{ces-phase2-lora,
title = {CES Phase 2 LoRA: Psychographic Ideology Prediction},
author = {Coburn, Del},
year = {2025},
url = {https://huggingface.co/baglecake/ces-phase2-lora}
}
This model is part of the émile-GCE project for Generative Computational Ethnography.