How it was built
The group model is produced by task-vector merging (Ilharco et al., 2023),
with no additional training. Each specialist defines a task vector
τ_i = θ_specialist_i − θ_base; the merged weights are
θ_group = θ_base + Σ_i λ_i · τ_i
The per-task coefficients λ_i are tuned on held-out validation: Mathematics
benefits from its task vector, while Multilinguality and Safety are kept close to
the base (which already performs best there). This adds each expert's learned
direction back onto the shared Qwen3-1.7B base, so a single checkpoint inherits
all four specialisations while remaining architecturally identical to the base.
Inference / decoding
Thinking mode is ON. Values below are exactly those in
generation_config.json:
Table with columns: param, value| param | value |
|---|
do_sample | true |
temperature | 0.6 |
top_k | 20 |
top_p | 0.95 |
max_new_tokens | not set in generation_config.json; the course CI uses 4096 (nightly) / 16384 (final grading) |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer repo = "cs-552-2026-ma-que/group_model"tok = AutoTokenizer.from_pretrained(repo)model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto", device_map="auto") messages = [{"role": "user", "content": "Which planet is known as the Red Planet?\nA) Venus\nB) Mars\nC) Jupiter\nD) Mercury"}]text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = tok(text, return_tensors="pt").to(model.device)out = model.generate(**inputs, max_new_tokens=4096)print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Notes
- The merge runs on CPU/GPU with no training; the four specialist checkpoints are
the only inputs.
- The CI sends prompts through
tokenizer.apply_chat_template(messages, add_generation_prompt=True)
and nothing else, so the inference behaviour is
baked into the chat template + generation_config.json.
- Reference: Ilharco et al. (2023), Editing Models with Task Arithmetic,
ICLR.