Instructions to use chiron-group/chiron with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use chiron-group/chiron with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Chiron
Chiron supports psychological measurement, individual behavioural prediction and population simulation. This repository contains the LoRA adapter, 109-construct measurement head, inference code and usage examples. The base model and tokenizer are provided by Qwen/Qwen3.6-35B-A3B.
Installation
Use Python 3.12 on Linux with sufficient GPU memory for the 35B base model.
pip install huggingface_hub
hf download chiron-group/chiron --local-dir chiron
cd chiron
pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cu128
pip install '.[inference]'
Chiron weights are stored in model/. The base model is downloaded on first use.
To use an existing local copy,
pass base_model="/path/to/Qwen3.6-35B-A3B" when loading Chiron.
Measurement
from inference import Chiron
model = Chiron.from_pretrained(".")
records = [
"I make a plan before starting a project and keep track of its deadlines.",
"When a task becomes difficult, I usually keep working until it is finished.",
]
print(model.measure(records, constructs=["conscientiousness"]))
model.constructs lists the 109 construct names. Omit constructs to return
all scores. The head is calibrated to targets on β1 to 1; its predictions
can extend beyond that range.
Prediction
Start the vLLM service, then connect from the inference environment. The first example predicts one answer:
from inference import Chiron
model = Chiron.from_server("http://127.0.0.1:8000/v1")
record_context = "Below are records describing this person."
observations = [
"I prefer spending my free time with a few close friends.",
"At large gatherings, I usually listen rather than start conversations.",
]
questions = [
'How would this person rate "I am the life of the party"?\n'
"Option 1: Strongly disagree\nOption 2: Disagree\n"
"Option 3: Neither agree nor disagree\nOption 4: Agree\n"
"Option 5: Strongly agree"
]
print(model.predict(
record_context=record_context,
observations=observations,
questions=questions,
))
predict fills the fixed prompt in the order record_context, observations,
questions, then returns generated answer text. record_context describes the
source of the records and defaults to the sentence shown above. Lists are formatted as
bulleted records and numbered questions; strings supply formatted text blocks.
Generation uses temperature 0 with thinking disabled. max_new_tokens defaults to 128.
The context limit is 8,192 tokens by default, including generated answers.
Multiple questions can share one response scale. This shortened IPIP-FFM evaluation example predicts two answers in the same completion:
# Shortened IPIP-FFM evaluation example: two targets sharing one response scale.
record_context = (
"Below are self-report questionnaire responses from one respondent on the IPIP-FFM scale."
)
observations = [
"Item: I worry about things | Response: Agree",
"Item: I start conversations | Response: Agree",
"Item: I don't mind being the center of attention | Response: Neutral",
"Item: I take time out for others | Response: Agree",
]
questions = (
"Use this response scale for every question below:\n"
"Option 1: Disagree\nOption 2: Slightly disagree\nOption 3: Neutral\n"
"Option 4: Slightly agree\nOption 5: Agree\n\n"
"Rate each statement for this person:\n"
'Q1. "I am not interested in abstract ideas"\n'
'Q2. "I get irritated easily"'
)
print(model.predict(
record_context=record_context,
observations=observations,
questions=questions,
))
Answers are numbered Q1, Q2, and so on, in question order.
Transformers/PyTorch generation is also supported: load with
Chiron.from_pretrained(".") and use the same method arguments.
Complete examples:
python examples/measurement.py
python examples/prediction.py
Population simulation
The example below uses the high-hierarchy condition from study OBHDP_10_1b.
from inference import Chiron
model = Chiron.from_server("http://127.0.0.1:8000/v1")
participant_context = (
"I am a person invited to a lab to participate in a study. In this experiment, I "
"will read a scenario and answer some questions."
)
experimental_setting = (
"Thank you for your interest in this study! In this study, we will ask you to "
"imagine a company and then answer some questions about it. Imagine a company "
"where employees work remotely -- they do not interact with each other over the "
"course of their workday. Imagine that employees in this company are tasked with "
"completing jobs for customers, and complete many jobs in a given workday. "
"Imagine that this company is structured very hierarchically. There is a lot of "
"difference in terms of rank between employees of this company -- for most "
"employees, there is someone at the company who is a higher rank than them and "
"someone at the company who is a lower rank than them. That is, there is a high "
"degree of hierarchy between employees of this company."
)
options = ["1 β Not at all likely", "2", "3", "4", "5", "6", "7 β Very likely"]
questions = [
{"text": "Lie if it would benefit them to do so", "options": options},
{"text": "Cheat if it would help them get ahead", "options": options},
{"text": "Behave in a corrupt manner", "options": options},
]
respondents = model.simulate_population(
participant_context=participant_context,
experimental_setting=experimental_setting,
questions=questions,
n_respondents=103,
seed=20261154,
)
print(respondents)
simulate_population accepts participant_context, experimental_setting,
questions and n_respondents. Each question contains text and an ordered
list of options, numbered from 1. The fixed prompt places participant context
and experimental setting inside the personal records, followed by the questions.
vLLM generates all respondents for a condition in one request. Sampling uses
temperature 1 and top-p 1, with top-k filtering and thinking disabled. Each
respondent answers all questions in one completion, restricted to valid
Q1: Option β¦ responses. The default token budget is 8 * len(questions) + 16.
Results contain raw_output and one-based option_ids, ordered by respondent index.
seed is the condition-level random seed. The example uses 20261154 and 20261155
for conditions A and B, matching the evaluation. The default is 20260902; the
paper adds each condition's original evaluation index. Transformers uses the same
prompt and sampling rules, with respondents generated sequentially. Random samples
can differ between backends.
examples/population.py uses the two company-hierarchy conditions from study OBHDP_10_1b, with the experimental wording, three items, seven response options, and 103 and 99 respondents used in the paper:
python examples/population.py
Serving
Use a separate Python 3.12 environment for the vLLM 0.21.0 server. Its PyTorch wheels use CUDA 13.0. Run these commands from the downloaded repository:
python3.12 -m venv .venv-serve
source .venv-serve/bin/activate
pip install torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 --index-url https://download.pytorch.org/whl/cu130
pip install '.[serve]'
CUDA_VISIBLE_DEVICES=0,1 python serve.py
The server loads the base model named in the adapter configuration, applies the
LoRA update in FP32, and runs BF16 inference. This matches the prediction and
population experiments. Use --base-model /path/to/base, --checkpoint /path/to/chiron
or --port 8001 to select local weights or a different port.
Connect from the inference environment with Chiron.from_server(...). Measurement
uses the Transformers/PyTorch path; run it separately or allocate distinct GPUs.
Repository layout
| Path | Contents |
|---|---|
model/adapter_model.safetensors, model/adapter_config.json |
LoRA weights and configuration |
model/chiron_measurement_head.pt |
Measurement head and centring state |
model/construct_vocab.json |
Construct-to-index mapping |
inference.py |
Torch measurement, Transformers/vLLM generation and fixed prompts |
serve.py |
vLLM prediction and population server |
sitecustomize.py |
FP32 LoRA overlay used when loading the vLLM server |
examples/ |
Measurement, prediction and population examples |
pyproject.toml |
Package metadata and dependencies |
- Downloads last month
- 2
Model tree for chiron-group/chiron
Base model
Qwen/Qwen3.6-35B-A3B