Upload 28 files
Browse filesFiles changed (28)
- .gitignoreAdded+18
- README.mdAdded+480
- notebooks/run_experiment.ipynbAdded+379
- phase1/README.mdAdded+65
- phase1/data/_done_pairs.jsonAdded+1
- phase1/data/calibration_dataset.csvAdded
- phase1/data/calibration_dataset_fixed.csvAdded
- phase1/data/checkpoints_logprob/phi-3-mini-4k-instruct.csvAdded
- phase1/data/checkpoints_logprob/qwen2.5-1.5b-instruct.csvAdded
- phase1/data/checkpoints_logprob/qwen2.5-3b-instruct.csvAdded
- phase1/data/checkpoints_logprob/qwen2.5-coder-1.5b-instruct.csvAdded
- phase1/data/checkpoints_logprob/qwen2.5-math-1.5b-instruct.csvAdded
- phase1/data/checkpoints_stated_conf/phi-3-mini-4k-instruct.csvAdded
- phase1/data/checkpoints_stated_conf/qwen2.5-1.5b-instruct.csvAdded
- phase1/data/checkpoints_stated_conf/qwen2.5-3b-instruct.csvAdded
- phase1/data/checkpoints_stated_conf/qwen2.5-coder-1.5b-instruct.csvAdded
- phase1/data/checkpoints_stated_conf/qwen2.5-math-1.5b-instruct.csvAdded
- phase1/notebooks/01_calibration_data_collection.ipynbAdded
- phase1/notebooks/02_calibration_analysis.ipynbAdded
- phase1/results/phase02_calibration.csvAdded+21
- phase1/results/phase05_cascade_simulation.csvAdded+22
- requirements.txtAdded+40
- src/01_collect_data.pyAdded+644
- src/02a_train_probes.pyAdded+452
- src/02b_train_probes_specialist.pyAdded+485
- src/03_domain_aware_router.pyAdded+664
- src/04_cheap_router.pyAdded+625
- src/collect_data_helpers.pyAdded+327
123456789101112131415161718# Python__pycache__/*.pyc.ipynb_checkpoints/
# Generated by the pipeline (large / reproducible) - root-anchored so phase1/data is kept/checkpoints//hidden_states//trained_models//logs//plots//results/*.parquet
# Environments / OS.venv/venv/.env.DS_Store123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480---language:- entags:- llm-routing- mixture-of-experts- calibration- confidence-estimation- logit-signals---
<div align="center">
# π§ ScoutRoute
### Can a single forward pass tell you which LLM should answer?
*Logit-based competence routing: testing whether internal signals from small open-weight models predict expert competence, without RouterBench, verbal self-assessment, or sampling.*
[](https://arxiv.org/abs/2610.23443)[](https://www.python.org/)[](#license)[](#models)[](#datasets)[](#estimated-compute-budget)
</div>
---
## π TL;DR
> A **single cheap forward pass** through a small generalist scout model (`phi3_mini`), read through a trained logistic-regression probe on its hidden states, **matches β and slightly beats β a full 5-model ensemble**, at **β
the inference cost**.
| | Passes required | Accuracy | Gap to oracle ||---|:---:|:---:|:---:|| Random routing | 0 | 0.355 | β0.472 || Best single signal (log-prob) | 5 | 0.650 | β0.177 || Domain-aware ensemble | 5 | 0.678 | β0.149 || **Cheap router β `phi3_mini` scout** | **1** | **0.684** β | **β0.143** || Oracle (offline upper bound) | 5 | 0.827 | 0.000 |
π Full write-up, per-domain breakdowns, and calibration analysis: **[arXiv:2610.23443](https://arxiv.org/abs/2610.23443)**.
π¦ Phase 1 data is also published as a dataset: **[YOUR_USERNAME/scoutroute-phase1-calibration](https://huggingface.co/datasets/YOUR_USERNAME/scoutroute-phase1-calibration)**.
---
## πΊοΈ Table of contents
- [Motivation](#-motivation)- [Models](#models)- [Datasets](#datasets)- [Routing signals](#-routing-signals)- [Key findings](#-key-findings)- [Project structure](#project-structure)- [Setup & usage](#-setup--usage)- [Running on Kaggle](#-running-on-kaggle-recommended)- [Output files](#output-files-explained)- [VRAM requirements](#vram-requirements-fp16)- [Troubleshooting](#-troubleshooting)- [Compute budget](#estimated-compute-budget)- [Phase 1: earlier calibration study](#-phase-1-earlier-calibration-study)- [Citation](#-citation)- [License](#license)
---
## π― Motivation
Routing between multiple LLMs usually means one of three things: an external benchmark like RouterBench, asking the model to self-report confidence in words, or sampling many completions and voting. All three are expensive, indirect, or both.
This project asks a narrower question: **do the numbers already sitting inside a model's forward pass β its logits and hidden states β carry enough signal to predict which expert will get a prompt right?** No extra sampling. No self-report. Just what a single pass already computes.
Five small (β€3.8B) open-weight models were pooled β three generalists, two domain specialists β and tested across four benchmark domains chosen specifically to surface real specialist-vs-generalist contrast, rather than a benchmark where every model performs identically.
---
## Models
| Key | HuggingFace ID | Size | Role ||---|---|:---:|---|| `qwen25_1b` | `Qwen/Qwen2.5-1.5B-Instruct` | 1.5B | π΅ General || `qwen25_3b` | `Qwen/Qwen2.5-3B-Instruct` | 3B | π΅ General || `phi3_mini` | `microsoft/Phi-3-mini-4k-instruct` | 3.8B | π΅ General (strong for size) || `qwen25_math` | `Qwen/Qwen2.5-Math-1.5B-Instruct` | 1.5B | π£ Math specialist || `qwen25_coder` | `Qwen/Qwen2.5-Coder-1.5B-Instruct` | 1.5B | π£ Code specialist |
All five are loaded in **fp16** β not 4-bit. At this parameter scale, quantization overhead isn't worth it; fp16 runs faster on a T4.
> **β οΈ Phi-3 quirk:** loaded with `trust_remote_code=False`. Its remote modeling code throws a `rope_scaling` `KeyError` on some `transformers` versions. Disabling remote code sidesteps it entirely, since Phi-3's architecture is natively supported.
---
## Datasets
Four domains, loaded directly from HuggingFace with clean ground-truth answer keys β no RouterBench, no reference-answer extraction hacks.
| Domain | Source | n | Why this domain ||---|---|:---:|---|| **GSM8K** | `gsm8k` (`main`, test) | 100 | **Harder half only** β a stratified sample from the back half of the test split. `qwen25_math` scores near 100% on easy GSM8K, leaving no negative examples for probe training; harder problems restore correctness variance. || **HumanEval** | `openai_humaneval` (test) | 164 (all) | Code execution scoring via a subprocess sandbox. `qwen25_coder` expected to dominate. || **MMLU** | `cais/mmlu` (6 subjects) | 100 | Six deliberately diverse subjects (abstract algebra, college physics, college CS, HS world history, clinical knowledge, professional law) rather than a random sample across all 57 β avoids wasting compute on subjects with uniform difficulty. || **CommonsenseQA** | `tau/commonsense_qa` (validation) | 100 | No specialist advantage β the baseline domain, testing whether routing degrades gracefully when no expert has a domain edge. |
**Total: ~464 prompts Γ 5 models β 2,320 (prompt, expert) pairs.**
<details><summary>π Why the <code>validation</code> split for CommonsenseQA?</summary><br>CommonsenseQA's actual <code>test</code> split has withheld answer keys (reserved for a public leaderboard) β only <code>train</code> and <code>validation</code> have <code>answerKey</code> populated. The loader correctly uses <code>validation</code>.</details>
<details><summary>π Why the harder half of GSM8K?</summary><br>Class imbalance kills probe training. If <code>qwen25_math</code> gets ~95% of easy GSM8K problems right, a probe trained on that data has almost no negative examples to learn from and just predicts "always correct." Taking the harder half (the later portion of the test split, which trends toward more reasoning steps) restores real variance.</details>
---
## π¬ Routing signals
Three signals, all extracted from model internals during a **single forward pass** β no sampling, no self-report.
| Signal | Feature | How it's extracted | Training needed? ||---|:---:|---|:---:|| `mean_log_prob` | A | Average log-probability of generated answer tokens | β || `neg_entropy` | B | Negated entropy of the first-token distribution | β || `probe_score` | C | Logistic regression probe on the last-layer hidden state | β
(30% of prompts) |
**Baselines:** random routing Β· oracle (best expert, offline upper bound)
---
## π Key findings
<table><tr><td>β
</td><td><b>One pass matches five.</b> A single <code>phi3_mini</code> forward pass (0.684) beats the full domain-aware 5-model ensemble (0.678). The cheap router isn't an approximation of the expensive method β it's competitive with it.</td></tr><tr><td>β
</td><td><b>Scout quality tracks generality, not size.</b> Ranking: <code>phi3_mini</code> βΊ <code>qwen25_1b</code> βΊ <code>qwen25_3b</code> βΊ <code>qwen25_coder</code> βΊ <code>qwen25_math</code>. The two specialists are the weakest scouts β their narrow internal representations don't transfer across model families.</td></tr><tr><td>β
</td><td><b>Signals have complementary blind spots.</b> The trained probe wins on specialist domains (GSM8K, HumanEval); raw log-prob wins on generalist domains (CommonsenseQA, MMLU). Routing by domain recovers <b>+2.8 points</b> over the single best signal.</td></tr><tr><td>β
</td><td><b>Calibration enables defection thresholds.</b> Probe ECE of 0.13β0.24 vs. 0.32β0.47 for logit signals β a 3β4Γ improvement. That reliability made a "don't switch experts on a low-confidence margin" rule viable, recovering <b>+4.4 points</b> on HumanEval (0.530 β 0.574).</td></tr><tr><td>β οΈ</td><td><b>The MMLU gap is structural, not algorithmic.</b> Best score there is 0.574 vs. an oracle of 0.882 β a 31-point gap. No specialist model exists for this domain in the pool, so no routing logic can close it. Only a new MMLU-capable model would.</td></tr><tr><td>β οΈ</td><td><b>The probe can still misfire.</b> On HumanEval, it correctly detected specialist uncertainty but defected to generalists that did even worse on hard code problems β accuracy dropped to 15.6% before the defection threshold fix.</td></tr></table>
---
## Project structure
```ScoutRoute/βββ README.mdβββ requirements.txtβββ .gitignoreββββ src/ # the pipeline β run in numeric order, from the repo rootβ βββ collect_data_helpers.py # shared: model loading, scoring, prompt formattingβ βββ 01_collect_data.py # Step 1 run inference, extract logit featuresβ βββ 02a_train_probes.py # Step 2a train probes (baseline: full cross-domain pool)β βββ 02b_train_probes_specialist.py # Step 2b train probes (specialists trained in-domain only)β βββ 03_domain_aware_router.py # Step 3 choose the routing signal per domainβ βββ 04_cheap_router.py # Step 4 single-pass scout router (ScoutRoute)ββββ notebooks/β βββ run_experiment.ipynb # Kaggle / Colab runner for Steps 1β4ββββ phase1/ # earlier calibration study (see below)β βββ notebooks/β βββ data/β βββ results/ββ # ββ auto-created by the scripts when you run them (git-ignored) βββββ checkpoints/ # JSONL, one row per completed prompt. Safe to restart.β βββ {model}_progress.jsonlβββ hidden_states/ # compressed numpy arrays, shape (N, hidden_dim)β βββ {model}_hidden.npzβββ results/ # final output tablesβββ trained_models/ # saved probe artifacts (PCA + LogisticRegression)βββ plots/ # reliability diagrams (PNG)βββ logs/ # per-model run logs```
> **2a vs 2b.** `02b` is `02a` plus one change: the `qwen25_math` and `qwen25_coder` probes train only on their own domain (GSM8K / HumanEval), which fixes a class-imbalance problem (see `SPECIALIST_DOMAINS` in the script). Both write to the same files in `results/` and `trained_models/`, so **run one or the other**, not both.
---
## π Setup & usage
All commands run from the repo root.
### Install
```bashpip install -r requirements.txt```
### Step 1 β collect inference data
Runs each model on all four domains and saves three logit features per (prompt, model) pair. **Resumable** β safe to re-run after a crash; already-completed prompts are skipped.
```bash# One model (recommended β one per Kaggle session)python src/01_collect_data.py --model qwen25_1b
# Smoke test β small subset onlypython src/01_collect_data.py --model qwen25_1b --max_prompts 50
# All models sequentially (local machine with enough GPU memory)python src/01_collect_data.py```
Recommended order (smallest/fastest first, to validate the pipeline early):
```Session 1: --model qwen25_1b (1.5B)Session 2: --model qwen25_math (1.5B)Session 3: --model qwen25_coder (1.5B)Session 4: --model qwen25_3b (3B)Session 5: --model phi3_mini (3.8B)```
### Step 2 β train probes and evaluate routing
Run after **all** models have finished Step 1.
```bashpython src/02a_train_probes.py # baseline# orpython src/02b_train_probes_specialist.py # specialists trained in-domain only```
To preview Features A and B before the probes are ready (e.g. after only one or two models have finished):
```bashpython src/02a_train_probes.py --skip_probe```
### Step 3 β domain-aware router
Uses the probe score on specialist domains and mean log-prob on generalist domains. Needs the probes from Step 2.
```bashpython src/03_domain_aware_router.py # realistic: a text classifier predicts the domainpython src/03_domain_aware_router.py --domain_mode label # upper bound: ground-truth domain labels```
### Step 4 β cheap single-pass router (ScoutRoute)
One scout model runs per prompt; cross-model probes on its hidden state predict every expert's competence.
```bashpython src/04_cheap_router.py --scout phi3_mini # the scout behind the headline result abovepython src/04_cheap_router.py # script default scout: qwen25_1bpython src/04_cheap_router.py --sweep_scouts # try every model as the scout```
---
## βοΈ Running on Kaggle (recommended)
Kaggle gives 30 free GPU-hours/week with 9-hour session limits. The checkpoint system handles interruptions β restarting picks up exactly where it stopped, at the level of individual prompts. `notebooks/run_experiment.ipynb` wraps all of this.
### First session
1. New Notebook β Settings β Accelerator: **GPU T4 x1** β Internet: **On**2. Get the code in: upload `src/` and `requirements.txt` as a Kaggle Dataset, or better, clone from a private GitHub repo (see below)3. `!pip install -q -r requirements.txt`4. `!python src/01_collect_data.py --model qwen25_1b`5. **Before the session ends:** save `checkpoints/`, `hidden_states/`, and `results/` as Kaggle Output Datasets (see below)
### Subsequent sessions
1. Add your saved checkpoint Datasets as input2. Restore them into the working directory3. Run the next model
<details><summary>π‘ Using GitHub instead of re-uploading scripts each time</summary>
```python# Clone (or pull latest) at the start of every sessionimport os, subprocessTOKEN = os.environ["GITHUB_TOKEN"] # set as a Kaggle SecretREPO = f"https://YOUR_USERNAME:{TOKEN}@github.com/YOUR_USERNAME/YOUR_REPO.git"PROJECT_DIR = "/kaggle/working/project"
if os.path.exists(f"{PROJECT_DIR}/.git"): subprocess.run(["git", "-C", PROJECT_DIR, "pull"])else: subprocess.run(["git", "clone", REPO, PROJECT_DIR])os.chdir(PROJECT_DIR)```
Code lives on GitHub, data lives on Kaggle Datasets β a clean separation. Push a fix β next session's `git pull` picks it up automatically.</details>
<details><summary>πΎ Saving checkpoints on Kaggle</summary>
**Why this matters:** `/kaggle/working` is wiped when a session ends. Without saving, every session starts from zero.
**At the end of a session:**
```pythonimport shutilfrom pathlib import Path
for subfolder, output_name in [ ("checkpoints", "routerbench_checkpoints"), ("hidden_states", "routerbench_hidden_states"), ("results", "routerbench_results"),]: src = f"{PROJECT_DIR}/{subfolder}" dst = f"/kaggle/working/{output_name}" if Path(src).exists(): shutil.copytree(src, dst, dirs_exist_ok=True) print(f"Copied {subfolder} β {dst}")```
Then in the Kaggle UI: **Output tab** β click each folder β **Save as Dataset** β name it exactly as printed (e.g. `routerbench-checkpoints`) β set **Private** β Create.
**At the start of the next session:**
1. **+ Add Data** β **Your Datasets** β add `routerbench-checkpoints`, `routerbench-hidden-states`, `routerbench-results`2. Restore them:
```pythonimport shutilfrom pathlib import Path
for dataset_name, subfolder in [ ("routerbench-checkpoints", "checkpoints"), ("routerbench-hidden-states", "hidden_states"), ("routerbench-results", "results"),]: src = f"/kaggle/input/{dataset_name}" dst = f"{PROJECT_DIR}/{subfolder}" if Path(src).exists(): shutil.copytree(src, dst, dirs_exist_ok=True) print(f"Restored {dataset_name}") else: print(f"Not found: {dataset_name} (first session, or different name)")```
3. Re-run `src/01_collect_data.py --model <next_model>` β completed prompts from prior sessions are skipped automatically; the run continues where it left off, even mid-model if a session died partway through.</details>
<details><summary>π Checking progress without re-running inference</summary>
```pythonfrom pathlib import Pathfor f in sorted(Path(f"{PROJECT_DIR}/checkpoints").glob("*_progress.jsonl")): n = sum(1 for _ in open(f)) print(f"{f.stem.replace('_progress',''):<18} {n:>4} rows")```</details>
---
## Output files explained
| File | Produced by | Contents ||---|:---:|---|| `results/{model}_results.parquet` | 01 | One row per (prompt, model): `prompt_id`, `eval_name`, `dataset`, `answer_key`, `response`, `is_correct`, `mean_log_prob`, `first_tok_entropy` || `hidden_states/{model}_hidden.npz` | 01 | Arrays: `prompt_ids` (N,) and `vectors` (N, hidden_dim) || `results/routing_results.csv` | 02 | Accuracy for each routing signal + baselines || `results/ece_results.csv` | 02 | ECE per model per signal || `results/per_dataset_routing.csv` | 02 | Routing accuracy broken down by domain || `results/probe_metrics.csv` | 02 | AUROC, n_train, PCA dims per model probe (02b adds `domain_filter`) || `plots/reliability_*.png` | 02 | Reliability diagrams (predicted signal vs. actual accuracy) || `trained_models/{model}_probe.pkl` | 02 | Saved PCA + LogisticRegression probe (joblib) || `results/domain_aware_routing.csv` | 03 | Full domain-aware comparison table || `results/domain_classifier.csv` | 03 | Domain classifier accuracy (`predict` mode) || `trained_models/domain_clf.pkl` | 03 | Saved TF-IDF domain classifier (`predict` mode) || `results/cheap_router_results.csv` | 04 | Full cheap-router comparison table || `results/cheap_probe_metrics.csv` | 04 | AUROC per (scout β target) probe || `trained_models/cheap_probes/` | 04 | Saved cross-model probes, one per target expert |
---
## VRAM requirements (fp16)
| Model | Params | VRAM ||---|:---:|:---:|| `qwen25_1b`, `qwen25_math`, `qwen25_coder` | 1.5B | ~3 GB || `qwen25_3b` | 3B | ~6 GB || `phi3_mini` | 3.8B | ~8 GB |
A T4 (16 GB) handles all five models comfortably in fp16.
---
## π οΈ Troubleshooting
<details><summary><b>"No *_results.parquet found"</b></summary><br>Step 1 hasn't completed for any model. Run <code>src/01_collect_data.py</code> first.</details>
<details><summary><b>Phi-3 fails to load / <code>rope_scaling</code> KeyError</b></summary><br>Already handled β <code>TRUST_REMOTE_CODE["phi3_mini"] = False</code> in <code>src/01_collect_data.py</code>. If you see this error anyway, check your <code>transformers</code> version is recent (<code>pip install -U transformers</code>).</details>
<details><summary><b>Phi-3 appears stuck / inference is extremely slow</b></summary><br>Check it actually loaded on GPU, not CPU. <code>device_map={"": 0}</code> is used explicitly (not <code>"auto"</code>) because <code>"auto"</code> has been observed silently placing Phi-3 on CPU on some setups.</details>
<details><summary><b>HumanEval scores look too low</b></summary><br>Check <code>max_new_tokens</code> β code solutions need more room than other domains. This is already handled (<code>run_inference</code> bumps to 256 tokens for <code>dataset="humaneval"</code> automatically), but if you've modified the script, confirm that bump is still in place.</details>
<details><summary><b>"Too few training samples β probe skipped"</b></summary><br>That model's training split (30% of ~464 prompts β 140, then split again 80/20 inside <code>train_probe</code>) has fewer than 30 examples β usually because Step 1 didn't fully complete for that model. Check <code>checkpoints/{model}_progress.jsonl</code> row count. With <code>02b</code>, the specialist probes train on in-domain prompts only, so their pools are smaller still.</details>
<details><summary><b>Kaggle session killed mid-run</b></summary><br>Restore checkpoints (see above), re-run the same <code>--model</code> command. The script reads the JSONL checkpoint, skips completed prompts, and continues.</details>
---
## Estimated compute budget
| Model | Domain prompts | Approx. GPU time (T4, fp16) ||---|:---:|:---:|| `qwen25_1b` | 464 | ~1.5 hrs || `qwen25_math` | 464 | ~1.5 hrs || `qwen25_coder` | 464 | ~1.5 hrs || `qwen25_3b` | 464 | ~2.5 hrs || `phi3_mini` | 464 | ~3 hrs || **Total** | | **~10 GPU-hours** |
Comfortably fits in a single week on Kaggle's free 30 GPU-hour/week tier β likely achievable in 2β3 sessions.
---
## π§ͺ Phase 1: earlier calibration study
[`phase1/`](phase1/README.md) holds the exploratory study that came before the pipeline above: it compared *verbalised* confidence against answer-token confidence across the same five experts, and prototyped routers and a cascade on top. It is kept for reference and reproducibility; the pivot away from verbal self-assessment is what led to the logit-based approach in this repo.
---
## π Citation
If you use this work, please cite the paper:
```bibtex@misc{pandhare2026scoutroute, title = {ScoutRoute: Efficient Mixture-of-Experts Routing Using Internal Language Model Signals}, author = {Pandhare, Rajdeep and Bharucha, Delzaan}, year = {2026}, eprint = {2610.23443}, archivePrefix = {arXiv}, primaryClass = {cs.AI}, url = {https://arxiv.org/abs/2610.23443}}```
---
## License
Released under the MIT License.
<div align="center"><sub>Built with 5 small open-weight models, 4 benchmarks, and zero extra sampling.</sub></div>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379{ "nbformat": 4, "nbformat_minor": 5, "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10.0" } }, "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ScoutRoute β Logit-Based Competence Routing\n", "\n", "Four stages β no RouterBench, no verbal confidence, no P(IK) sampling:\n", "\n", "| Step | Script | What it does | Resumable? |\n", "|------|--------|--------------|------------|\n", "| 1 | `src/01_collect_data.py` | Run inference on 4 HF datasets, extract 3 logit features per prompt | β
per-row JSONL |\n", "| 2 | `src/02a_train_probes.py` (or `02b_train_probes_specialist.py`) | Train hidden-state probes, evaluate routing | β
idempotent |\n", "| 3 | `src/03_domain_aware_router.py` | Pick the routing signal per domain (probe vs log-prob) | β
idempotent |\n", "| 4 | `src/04_cheap_router.py` | Single-pass scout router (the ScoutRoute method) | β
idempotent |\n", "\n", "**5 models** (all β€3.8B, fp16): `qwen25_1b`, `qwen25_3b`, `phi3_mini`, `qwen25_math`, `qwen25_coder`\n", "\n", "**4 domains, ~464 prompts total:** GSM8K (100, harder half) Β· HumanEval (164, all) Β· MMLU (100, 6 subjects) Β· CommonsenseQA (100)\n", "\n", "**Three routing signals (all from model internals, zero self-report):**\n", "- **Feature A** `mean_log_prob` β avg log-prob of answer tokens\n", "- **Feature B** `neg_entropy` β negated first-token distribution entropy\n", "- **Feature C** `probe_score` β logistic probe trained on last-layer hidden states\n", "\n", "**Estimated total: ~10 GPU-hours** for Step 1 across all 5 models on a T4 β fits in 2-3 Kaggle sessions. Steps 2-4 run on the saved outputs.\n", "\n", "Paper: [arXiv:2610.23443](https://arxiv.org/abs/2610.23443)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 1: Platform setup ββββββββββββββββββββββββββββββββββββββββββββββββββββ\n", "import os, sys\n", "\n", "ON_KAGGLE = os.path.exists('/kaggle')\n", "ON_COLAB = 'google.colab' in sys.modules\n", "print(f'Platform: {\"Kaggle\" if ON_KAGGLE else \"Colab\" if ON_COLAB else \"Local\"}')\n", "\n", "if ON_COLAB:\n", " from google.colab import drive\n", " drive.mount('/content/drive')\n", " PROJECT_DIR = '/content/drive/MyDrive/routerbench_project'\n", "elif ON_KAGGLE:\n", " PROJECT_DIR = '/kaggle/working/project'\n", "else:\n", " PROJECT_DIR = './routerbench_project'\n", "\n", "os.makedirs(PROJECT_DIR, exist_ok=True)\n", "for sub in ['checkpoints', 'results', 'hidden_states', 'trained_models', 'plots', 'logs']:\n", " os.makedirs(f'{PROJECT_DIR}/{sub}', exist_ok=True)\n", "\n", "print(f'Project dir: {PROJECT_DIR}')\n", "\n", "import torch\n", "print(f'CUDA: {torch.cuda.is_available()}')\n", "if torch.cuda.is_available():\n", " print(f'GPU: {torch.cuda.get_device_name(0)}')\n", " print(f'VRAM: {torch.cuda.get_device_properties(0).total_memory/1e9:.1f} GB')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 2: Install dependencies ββββββββββββββββββββββββββββββββββββββββββββββ\n", "# No sentence-transformers needed β the probe trains directly on hidden\n", "# states, not prompt embeddings. bitsandbytes is installed but unused by\n", "# default (all 5 models run in fp16).\n", "!pip install -q transformers datasets accelerate bitsandbytes \\\n", " scikit-learn pyarrow tqdm matplotlib joblib" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 3: Get scripts βββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n", "# Option A β clone/pull from a private GitHub repo (recommended β lets you\n", "# fix bugs locally and just `git push`, then `git pull` in the next session)\n", "import os, subprocess\n", "\n", "USE_GITHUB = False # β set True and fill in below if using GitHub\n", "\n", "if USE_GITHUB:\n", " GITHUB_USER = 'YOUR_USERNAME'\n", " REPO_NAME = 'YOUR_REPO'\n", " TOKEN = os.environ['GITHUB_TOKEN'] # set as a Kaggle Secret first\n", " repo_url = f'https://{GITHUB_USER}:{TOKEN}@github.com/{GITHUB_USER}/{REPO_NAME}.git'\n", "\n", " if os.path.exists(f'{PROJECT_DIR}/.git'):\n", " subprocess.run(['git', '-C', PROJECT_DIR, 'pull'], check=True)\n", " print('Pulled latest changes')\n", " else:\n", " subprocess.run(['git', 'clone', repo_url, PROJECT_DIR], check=True)\n", " print('Cloned repo')\n", "else:\n", " # Option B β scripts already uploaded as a Kaggle Dataset, or sitting\n", " # in /kaggle/input from a previous step. Copy them in manually:\n", " # import shutil\n", " # shutil.copytree('/kaggle/input/routerbench-scripts/src', f'{PROJECT_DIR}/src', dirs_exist_ok=True)\n", " print('Using scripts already present in PROJECT_DIR (manual upload assumed)')\n", "\n", "os.chdir(PROJECT_DIR)\n", "print('Files in project dir:', sorted(os.listdir(PROJECT_DIR)))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 4: Configure this session βββββββββββββββββββββββββββββββββββββββββββ\n", "# Change MODEL_KEY each session. Run smallest models first to validate the\n", "# pipeline (scoring, hidden-state extraction) before committing to longer runs.\n", "#\n", "# Recommended order:\n", "# 1. qwen25_1b (1.5B β fastest, validates pipeline end to end)\n", "# 2. qwen25_math (1.5B)\n", "# 3. qwen25_coder (1.5B)\n", "# 4. qwen25_3b (3B)\n", "# 5. phi3_mini (3.8B β slowest of the five, still small)\n", "\n", "MODEL_KEY = 'qwen25_1b' # β CHANGE THIS each session\n", "MAX_PROMPTS = None # None = all ~464 prompts. Set e.g. 40 for a smoke test.\n", "\n", "print(f'This session: {MODEL_KEY} | max_prompts={MAX_PROMPTS}')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 5: Checkpoint status β run anytime to check progress ββββββββββββββββ\n", "from pathlib import Path\n", "\n", "def show_status():\n", " ckpt_dir = Path(PROJECT_DIR) / 'checkpoints'\n", " hidden_dir = Path(PROJECT_DIR) / 'hidden_states'\n", " results_dir = Path(PROJECT_DIR) / 'results'\n", "\n", " print('ββ Step 1 inference checkpoints ββββββββββββββββββββββ')\n", " for f in sorted(ckpt_dir.glob('*_progress.jsonl')):\n", " n = sum(1 for _ in open(f))\n", " print(f' {f.stem.replace(\"_progress\",\"\"):<16} {n:>5} / ~464 rows')\n", "\n", " print('\\nββ Hidden state stores βββββββββββββββββββββββββββββββ')\n", " for f in sorted(hidden_dir.glob('*_hidden.npz')):\n", " import numpy as np\n", " d = np.load(f, allow_pickle=True)\n", " mk = f.stem.replace('_hidden', '')\n", " print(f' {mk:<16} {len(d[\"prompt_ids\"]):>5} vectors dim={d[\"vectors\"].shape[1]}')\n", "\n", " print('\\nββ Result files ββββββββββββββββββββββββββββββββββββββ')\n", " for f in sorted(results_dir.glob('*.parquet')):\n", " import pandas as pd\n", " n = len(pd.read_parquet(f))\n", " print(f' {f.name:<30} {n:>5} rows')\n", "\n", "show_status()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 6 (Kaggle only): Restore checkpoints from a previous session βββββββββ\n", "# Run at the START of a new session if you have saved checkpoint Datasets.\n", "# Add them as input first: + Add Data β Your Datasets β search by name.\n", "\n", "if ON_KAGGLE:\n", " import shutil\n", " for src_name, dst_subdir in [\n", " ('routerbench-checkpoints', 'checkpoints'),\n", " ('routerbench-hidden-states', 'hidden_states'),\n", " ('routerbench-results', 'results'),\n", " ]:\n", " src = f'/kaggle/input/{src_name}'\n", " dst = f'{PROJECT_DIR}/{dst_subdir}'\n", " if Path(src).exists():\n", " shutil.copytree(src, dst, dirs_exist_ok=True)\n", " print(f'Restored {src_name} β {dst}')\n", " else:\n", " print(f'Not found: {src_name} (first session, or different name)')\n", " show_status()\n", "else:\n", " print('Not on Kaggle β checkpoints persist automatically (Drive / local disk)')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 7: STEP 1 β Run inference + extract logit features ββββββββββββββββββ\n", "# Safe to re-run at any time: skips already-completed prompt_ids.\n", "# Loads GSM8K, HumanEval, MMLU, CommonsenseQA directly from HuggingFace\n", "# (datasets library caches these automatically β no manual setup needed).\n", "# Extracts: mean_log_prob (A), first_tok_entropy (B), last hidden state (C).\n", "\n", "import sys\n", "sys.path.insert(0, PROJECT_DIR)\n", "os.chdir(PROJECT_DIR)\n", "\n", "cmd = f'python {PROJECT_DIR}/src/01_collect_data.py --model {MODEL_KEY}'\n", "if MAX_PROMPTS:\n", " cmd += f' --max_prompts {MAX_PROMPTS}'\n", "print(f'Running: {cmd}\\n')\n", "!{cmd}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 8 (Kaggle only): Save outputs before session ends βββββββββββββββββββ\n", "# Run this BEFORE the 9-hour session limit. Then go to the Output tab and\n", "# Save as Dataset for each folder printed below, using the exact names shown.\n", "\n", "if ON_KAGGLE:\n", " import shutil\n", " from pathlib import Path\n", " for src_subdir, out_name in [\n", " ('checkpoints', 'routerbench_checkpoints'),\n", " ('hidden_states', 'routerbench_hidden_states'),\n", " ('results', 'routerbench_results'),\n", " ]:\n", " src = f'{PROJECT_DIR}/{src_subdir}'\n", " dst = f'/kaggle/working/{out_name}'\n", " if Path(src).exists():\n", " shutil.copytree(src, dst, dirs_exist_ok=True)\n", " print(f'Copied {src_subdir} β {dst}')\n", " print('\\nNow: Output tab β click each folder β Save as Dataset.')\n", " print('Names: routerbench-checkpoints, routerbench-hidden-states, routerbench-results')\n", " print('Set visibility to Private.')\n", "else:\n", " print('Not on Kaggle β nothing to save manually.')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 9: STEP 2 β Train probe + evaluate routing ββββββββββββββββββββββββββ\n", "# Runs 02a (baseline). To use the specialist-filtered variant, swap the script\n", "# name below for src/02b_train_probes_specialist.py (run one, not both).\n", "# Run after ALL 5 models have completed Step 1.\n", "# Use --skip_probe to preview Features A and B before the probe is ready\n", "# (works even after just 1-2 models have finished).\n", "\n", "SKIP_PROBE = False # set True for an early A/B-only preview\n", "\n", "cmd = f'python {PROJECT_DIR}/src/02a_train_probes.py'\n", "if SKIP_PROBE:\n", " cmd += ' --skip_probe'\n", "print(f'Running: {cmd}\\n')\n", "!{cmd}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 9b: STEP 3 β Domain-aware ensemble router ββββββββββββββββββββββββββββ\n", "# Run after Step 2. DOMAIN_MODE: 'predict' (realistic: text classifier picks the\n", "# domain) or 'label' (upper bound: uses ground-truth domain labels).\n", "\n", "DOMAIN_MODE = 'predict'\n", "\n", "cmd = f'python {PROJECT_DIR}/src/03_domain_aware_router.py --domain_mode {DOMAIN_MODE}'\n", "print(f'Running: {cmd}\\n')\n", "!{cmd}\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 9c: STEP 4 β Cheap single-pass router (ScoutRoute) βββββββββββββββββββ\n", "# One scout model runs per prompt; cross-model probes predict every expert's\n", "# competence from the scout's hidden state. The script default is qwen25_1b;\n", "# the README headline result uses phi3_mini as the scout.\n", "\n", "SCOUT = 'phi3_mini'\n", "SWEEP_SCOUTS = False # True = try every model as scout\n", "\n", "cmd = f'python {PROJECT_DIR}/src/04_cheap_router.py --scout {SCOUT}'\n", "if SWEEP_SCOUTS:\n", " cmd += ' --sweep_scouts'\n", "print(f'Running: {cmd}\\n')\n", "!{cmd}\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# ββ CELL 10: View results βββββββββββββββββββββββββββββββββββββββββββββββββββββ\n", "import pandas as pd\n", "from pathlib import Path\n", "\n", "results_dir = Path(PROJECT_DIR) / 'results'\n", "\n", "f = results_dir / 'routing_results.csv'\n", "if f.exists():\n", " print('=== Routing Accuracy ===')\n", " print(pd.read_csv(f).T.to_string(header=False))\n", "\n", "f = results_dir / 'per_dataset_routing.csv'\n", "if f.exists():\n", " print('\\n=== Per-Domain Breakdown ===')\n", " print(pd.read_csv(f).to_string(index=False))\n", "\n", "f = results_dir / 'probe_metrics.csv'\n", "if f.exists():\n", " print('\\n=== Probe AUROC per Model ===')\n", " print(pd.read_csv(f).to_string(index=False))\n", "\n", "f = results_dir / 'ece_results.csv'\n", "if f.exists():\n", " print('\\n=== ECE per Model per Signal ===')\n", " print(pd.read_csv(f).to_string(index=False))\n", "\n", "for name, title in [('domain_aware_routing.csv', 'Domain-Aware Router'),\n", " ('cheap_router_results.csv', 'Cheap Router (ScoutRoute)'),\n", " ('cheap_probe_metrics.csv', 'Cross-Model Probe AUROC')]:\n", " f = results_dir / name\n", " if f.exists():\n", " print(f'\\n=== {title} ===')\n", " print(pd.read_csv(f).to_string(index=False))\n", "\n", "# Show reliability diagrams\n", "from IPython.display import Image, display\n", "plots = sorted((Path(PROJECT_DIR) / 'plots').glob('*.png'))\n", "print(f'\\n{len(plots)} reliability diagrams saved.')\n", "for p in plots[:6]:\n", " display(Image(str(p)))" ] } ]}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465# Phase 1 β Calibration study (earlier work)
The exploratory study that preceded the main pipeline in [`../src/`](../src). It asked whether an expert's **stated (verbalised) confidence** or its **answer-token confidence** is a better routing signal, then prototyped routers and a cascade on top of the answer. The main project then moved to internal logit and hidden-state signals only. Read [Known issues](#known-issues) before relying on any of the stated-confidence numbers here.
**Scope:** 5 experts Γ 344 questions = **1,720 (expert, question) rows**, across 4 domains: `math`, `code`, `commonsense`, `knowledge`.
## Layout
```phase1/βββ notebooks/β βββ 01_calibration_data_collection.ipynb # Kaggle: prompts, scoring, resumable collection loopβ βββ 02_calibration_analysis.ipynb # Colab: re-scoring, ECE, routers, cascade simulationβββ data/β βββ calibration_dataset.csv # combined dataset, as first collectedβ βββ calibration_dataset_fixed.csv # same, after re-scoring math answersβ βββ checkpoints_stated_conf/ # per-expert raw output + verbalised confidenceβ βββ checkpoints_logprob/ # per-expert raw output + answer-token confidenceβ βββ _done_pairs.json # resume state: (expert, qid) pairs already completedβββ results/ βββ phase02_calibration.csv # ECE + calibration gap per expert Γ domain βββ phase05_cascade_simulation.csv # escalation-threshold sweep```
## What each piece is
| File | Contents ||---|---|| `01_calibration_data_collection.ipynb` | Self-probing and multi-step prompt templates, per-domain scoring, checkpointed collection loop, and the step that combines per-expert checkpoints into the final dataset. || `02_calibration_analysis.ipynb` | Math re-scoring (boxed-answer extraction fix), then Phases 02β05: ECE and calibration gap for both confidence signals, a question β best-expert competence predictor, a class-balanced router, per-expert confidence regressors as router features, a no-ML domain-rule baseline, and a retrospective cascade simulation. || `calibration_dataset.csv` | One row per (expert, question): prediction, ground truth, correctness, `stated_confidence`, and the answer-token confidences `model_answer_confidence` / `model_answer_min_confidence`. || `calibration_dataset_fixed.csv` | Same schema after math re-scoring. 30 math rows flip to correct; overall accuracy goes from 0.494 to 0.512. **Use this one for analysis.** || `checkpoints_stated_conf/*.csv` | Per-expert raw answers with `stated_confidence`. || `checkpoints_logprob/*.csv` | Per-expert raw answers with answer-token confidence columns. || `phase02_calibration.csv` | Columns: `expert, domain, n, accuracy, mean_stated_conf, mean_logit_conf, ece_stated, ece_logit, gap_stated, gap_logit`. See [Known issues](#known-issues) for how `n` relates to the stated-confidence columns. || `phase05_cascade_simulation.csv` | Columns: `threshold, escalate_rate, routed_acc`. Always call a generalist first, escalate to the specialist when calibrated confidence falls below `threshold`. Routed accuracy sits at 0.718 with no escalation and peaks at about 0.735 around `threshold = 0.65` (roughly 7.6% of queries escalated). |
## Known issues
**Stated confidence is mostly missing from the combined dataset.** `stated_confidence` is filled for only 482 of the 1,720 rows in `calibration_dataset.csv` / `calibration_dataset_fixed.csv`, yet the per-expert files in `checkpoints_stated_conf/` hold 1,318 filled values. The 836 values that never reached the combined file are all code (591) and math (245) rows; where both files have a value, they agree. Rows per expert with a stated confidence, in the combined file:
| Domain (questions) | Rows with `stated_confidence` per expert ||---|---|| `code` (164) | 2β6 || `math` (60) | 11 || `knowledge` (60) | 21β60 || `commonsense` (60) | 2β60 |
**Effect on `results/phase02_calibration.csv`.** The `n` column counts every row for that expert and domain, but `mean_stated_conf`, `ece_stated` and `gap_stated` use only the rows that have a stated confidence, and are compared against accuracy over all rows. For `phi-3-mini-4k-instruct` on code, for example, `n` is 164 while the stated-confidence average rests on 6 rows. Treat the stated-confidence columns as unreliable for code and math until the combine step is re-run with all stated confidences merged back in. The answer-token confidence columns (`model_answer_confidence`, `model_answer_min_confidence`) are complete.
## Expert naming
Phase 1 files and the `expert` column use HuggingFace-style slugs; the main pipeline uses short model keys.
| Phase 1 slug | Main-pipeline key ||---|---|| `qwen2.5-1.5b-instruct` | `qwen25_1b` || `qwen2.5-3b-instruct` | `qwen25_3b` || `phi-3-mini-4k-instruct` | `phi3_mini` || `qwen2.5-math-1.5b-instruct` | `qwen25_math` || `qwen2.5-coder-1.5b-instruct` | `qwen25_coder` |
## Running the notebooks
Both notebooks were written for hosted runtimes: `01_β¦` for Kaggle (it reads and writes `/kaggle/working`) and `02_β¦` for Colab (it reads CSVs from the working directory, e.g. `calibration_dataset_fixed.csv` and `phase02_calibration.csv`). To rerun locally, place those files next to the notebook or adjust the paths in the first cells.1[["phi-3-mini-4k-instruct", "csqa_493"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_104"], ["phi-3-mini-4k-instruct", "gsm8k_696"], ["phi-3-mini-4k-instruct", "mmlu_13809"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_132"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_592"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_73"], ["qwen2.5-coder-1.5b-instruct", "csqa_1083"], ["phi-3-mini-4k-instruct", "gsm8k_865"], ["qwen2.5-math-1.5b-instruct", "mmlu_13464"], ["qwen2.5-1.5b-instruct", "mmlu_11216"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_163"], ["qwen2.5-math-1.5b-instruct", "gsm8k_326"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_71"], ["qwen2.5-coder-1.5b-instruct", "mmlu_7517"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_53"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_3"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_33"], ["qwen2.5-math-1.5b-instruct", "gsm8k_440"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_96"], ["qwen2.5-math-1.5b-instruct", "mmlu_10980"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_92"], ["qwen2.5-coder-1.5b-instruct", "csqa_313"], ["qwen2.5-math-1.5b-instruct", "mmlu_6065"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_128"], ["qwen2.5-1.5b-instruct", "gsm8k_65"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_13"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_50"], ["qwen2.5-coder-1.5b-instruct", "csqa_330"], ["qwen2.5-math-1.5b-instruct", "csqa_1010"], ["qwen2.5-coder-1.5b-instruct", "csqa_1"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_43"], ["qwen2.5-coder-1.5b-instruct", "csqa_39"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_85"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_1"], ["phi-3-mini-4k-instruct", "gsm8k_457"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1206"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_77"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_119"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_139"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_18"], ["phi-3-mini-4k-instruct", "gsm8k_189"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_81"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1149"], ["qwen2.5-coder-1.5b-instruct", "csqa_890"], ["qwen2.5-3b-instruct", "mmlu_3752"], ["qwen2.5-3b-instruct", "gsm8k_740"], ["phi-3-mini-4k-instruct", "gsm8k_318"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_152"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_16"], ["phi-3-mini-4k-instruct", "gsm8k_228"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_105"], ["qwen2.5-math-1.5b-instruct", "gsm8k_778"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_110"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_0"], ["phi-3-mini-4k-instruct", "csqa_1197"], ["qwen2.5-1.5b-instruct", "gsm8k_1116"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_127"], ["qwen2.5-3b-instruct", "csqa_663"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_8"], ["qwen2.5-1.5b-instruct", "gsm8k_206"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_95"], ["qwen2.5-math-1.5b-instruct", "mmlu_12588"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_102"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_63"], ["qwen2.5-coder-1.5b-instruct", "mmlu_5155"], ["qwen2.5-3b-instruct", "csqa_1133"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_141"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_90"], ["qwen2.5-1.5b-instruct", "gsm8k_775"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_38"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_135"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_113"], ["qwen2.5-3b-instruct", "csqa_741"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_124"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_69"], ["qwen2.5-coder-1.5b-instruct", "csqa_877"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_2"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_57"], ["qwen2.5-1.5b-instruct", "csqa_1025"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_148"], ["phi-3-mini-4k-instruct", "csqa_765"], ["phi-3-mini-4k-instruct", "mmlu_6227"], ["qwen2.5-coder-1.5b-instruct", "mmlu_2287"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_88"], ["qwen2.5-1.5b-instruct", "gsm8k_255"], ["qwen2.5-1.5b-instruct", "gsm8k_466"], ["qwen2.5-coder-1.5b-instruct", "csqa_118"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_155"], ["qwen2.5-1.5b-instruct", "gsm8k_704"], ["qwen2.5-3b-instruct", "csqa_493"], ["qwen2.5-3b-instruct", "mmlu_13809"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_62"], ["qwen2.5-3b-instruct", "gsm8k_696"], ["qwen2.5-1.5b-instruct", "mmlu_4386"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_91"], ["qwen2.5-3b-instruct", "mmlu_5313"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_5"], ["phi-3-mini-4k-instruct", "mmlu_10617"], ["phi-3-mini-4k-instruct", "csqa_611"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_25"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_11"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_27"], ["qwen2.5-1.5b-instruct", "csqa_323"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_42"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_156"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_64"], ["qwen2.5-math-1.5b-instruct", "csqa_1099"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_133"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_161"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_150"], ["qwen2.5-1.5b-instruct", "csqa_1043"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_100"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_77"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_121"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_55"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_144"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_157"], ["qwen2.5-coder-1.5b-instruct", "mmlu_11216"], ["qwen2.5-3b-instruct", "gsm8k_318"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_152"], ["qwen2.5-1.5b-instruct", "csqa_1161"], ["phi-3-mini-4k-instruct", "mmlu_2340"], ["qwen2.5-math-1.5b-instruct", "csqa_514"], ["qwen2.5-math-1.5b-instruct", "csqa_1103"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_46"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_71"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_65"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_54"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_53"], ["qwen2.5-1.5b-instruct", "csqa_186"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_158"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_72"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_61"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_130"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_96"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_92"], ["phi-3-mini-4k-instruct", "mmlu_6216"], ["qwen2.5-1.5b-instruct", "csqa_234"], ["qwen2.5-math-1.5b-instruct", "gsm8k_919"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_65"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_109"], ["qwen2.5-math-1.5b-instruct", "mmlu_11946"], ["phi-3-mini-4k-instruct", "mmlu_8751"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_43"], ["qwen2.5-3b-instruct", "mmlu_4339"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_45"], ["qwen2.5-math-1.5b-instruct", "mmlu_3456"], ["qwen2.5-3b-instruct", "mmlu_6482"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_119"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_126"], ["qwen2.5-1.5b-instruct", "csqa_96"], ["phi-3-mini-4k-instruct", "csqa_601"], ["qwen2.5-1.5b-instruct", "mmlu_10403"], ["qwen2.5-math-1.5b-instruct", "mmlu_8179"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_26"], ["qwen2.5-1.5b-instruct", "mmlu_13464"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_56"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_31"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_107"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_101"], ["qwen2.5-1.5b-instruct", "gsm8k_326"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1116"], ["qwen2.5-3b-instruct", "mmlu_6227"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_17"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_127"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_87"], ["qwen2.5-3b-instruct", "csqa_765"], ["phi-3-mini-4k-instruct", "csqa_175"], ["qwen2.5-3b-instruct", "gsm8k_161"], ["qwen2.5-1.5b-instruct", "gsm8k_440"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_30"], ["qwen2.5-1.5b-instruct", "mmlu_10980"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_206"], ["qwen2.5-math-1.5b-instruct", "gsm8k_600"], ["phi-3-mini-4k-instruct", "gsm8k_178"], ["qwen2.5-1.5b-instruct", "mmlu_6065"], ["qwen2.5-math-1.5b-instruct", "csqa_449"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_153"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_90"], ["phi-3-mini-4k-instruct", "gsm8k_51"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_113"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_94"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_5"], ["qwen2.5-3b-instruct", "csqa_611"], ["qwen2.5-1.5b-instruct", "mmlu_9197"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_48"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_2"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_19"], ["qwen2.5-coder-1.5b-instruct", "csqa_1025"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_42"], ["qwen2.5-1.5b-instruct", "gsm8k_778"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_140"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_110"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_111"], ["qwen2.5-1.5b-instruct", "csqa_538"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_466"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_100"], ["phi-3-mini-4k-instruct", "gsm8k_451"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_89"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_74"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_39"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_704"], ["qwen2.5-math-1.5b-instruct", "mmlu_3483"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1130"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_55"], ["qwen2.5-1.5b-instruct", "mmlu_12588"], ["qwen2.5-3b-instruct", "gsm8k_563"], ["phi-3-mini-4k-instruct", "csqa_788"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_63"], ["phi-3-mini-4k-instruct", "gsm8k_1287"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_125"], ["qwen2.5-1.5b-instruct", "mmlu_2664"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_46"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_158"], ["qwen2.5-3b-instruct", "gsm8k_1182"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_27"], ["qwen2.5-coder-1.5b-instruct", "csqa_323"], ["phi-3-mini-4k-instruct", "mmlu_10415"], ["phi-3-mini-4k-instruct", "mmlu_3598"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_49"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_134"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_86"], ["qwen2.5-3b-instruct", "csqa_1195"], ["phi-3-mini-4k-instruct", "mmlu_5168"], ["qwen2.5-math-1.5b-instruct", "mmlu_2803"], ["qwen2.5-3b-instruct", "gsm8k_191"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_116"], ["qwen2.5-math-1.5b-instruct", "gsm8k_865"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_103"], ["phi-3-mini-4k-instruct", "mmlu_12205"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_118"], ["qwen2.5-math-1.5b-instruct", "mmlu_9292"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_155"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_79"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_33"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_14"], ["qwen2.5-coder-1.5b-instruct", "csqa_1161"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_117"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_26"], ["phi-3-mini-4k-instruct", "mmlu_1169"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_65"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_115"], ["qwen2.5-coder-1.5b-instruct", "csqa_186"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_72"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_93"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_35"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_10"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_17"], ["qwen2.5-coder-1.5b-instruct", "csqa_234"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_151"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_109"], ["qwen2.5-3b-instruct", "csqa_175"], ["qwen2.5-math-1.5b-instruct", "gsm8k_457"], ["qwen2.5-math-1.5b-instruct", "csqa_228"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_12"], ["phi-3-mini-4k-instruct", "csqa_6"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_136"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_4"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_20"], ["qwen2.5-math-1.5b-instruct", "gsm8k_189"], ["qwen2.5-1.5b-instruct", "csqa_1099"], ["phi-3-mini-4k-instruct", "mmlu_3432"], ["phi-3-mini-4k-instruct", "gsm8k_209"], ["qwen2.5-1.5b-instruct", "mmlu_9125"], ["qwen2.5-coder-1.5b-instruct", "csqa_96"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_161"], ["phi-3-mini-4k-instruct", "gsm8k_1034"], ["qwen2.5-coder-1.5b-instruct", "mmlu_10403"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_60"], ["qwen2.5-math-1.5b-instruct", "gsm8k_228"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_6"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_105"], ["qwen2.5-3b-instruct", "gsm8k_51"], ["qwen2.5-math-1.5b-instruct", "mmlu_4010"], ["qwen2.5-3b-instruct", "mmlu_1084"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_70"], ["qwen2.5-math-1.5b-instruct", "csqa_1197"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_58"], ["qwen2.5-coder-1.5b-instruct", "csqa_929"], ["qwen2.5-coder-1.5b-instruct", "mmlu_13464"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_48"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_56"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_19"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_87"], ["qwen2.5-1.5b-instruct", "csqa_1103"], ["phi-3-mini-4k-instruct", "csqa_130"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_102"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_137"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_440"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_61"], ["qwen2.5-3b-instruct", "csqa_365"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_141"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_160"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_32"], ["qwen2.5-3b-instruct", "gsm8k_451"], ["qwen2.5-coder-1.5b-instruct", "mmlu_6065"], ["qwen2.5-1.5b-instruct", "gsm8k_919"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_38"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_52"], ["qwen2.5-1.5b-instruct", "mmlu_11946"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_135"], ["qwen2.5-math-1.5b-instruct", "gsm8k_88"], ["phi-3-mini-4k-instruct", "mmlu_11199"], ["qwen2.5-coder-1.5b-instruct", "csqa_743"], ["qwen2.5-3b-instruct", "csqa_788"], ["phi-3-mini-4k-instruct", "gsm8k_689"], ["qwen2.5-3b-instruct", "gsm8k_1287"], ["phi-3-mini-4k-instruct", "csqa_1039"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_57"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_104"], ["qwen2.5-math-1.5b-instruct", "csqa_1083"], ["qwen2.5-coder-1.5b-instruct", "mmlu_9197"], ["qwen2.5-1.5b-instruct", "mmlu_8179"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_145"], ["qwen2.5-3b-instruct", "mmlu_10415"], ["qwen2.5-3b-instruct", "mmlu_3598"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_3"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_778"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_122"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_110"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_111"], ["phi-3-mini-4k-instruct", "gsm8k_1266"], ["qwen2.5-coder-1.5b-instruct", "csqa_538"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_85"], ["qwen2.5-3b-instruct", "gsm8k_569"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_74"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_103"], ["phi-3-mini-4k-instruct", "mmlu_5977"], ["qwen2.5-3b-instruct", "mmlu_12205"], ["qwen2.5-math-1.5b-instruct", "csqa_39"], ["qwen2.5-math-1.5b-instruct", "mmlu_10617"], ["qwen2.5-3b-instruct", "gsm8k_142"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_118"], ["qwen2.5-3b-instruct", "mmlu_13189"], ["phi-3-mini-4k-instruct", "csqa_958"], ["qwen2.5-1.5b-instruct", "gsm8k_600"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_63"], ["phi-3-mini-4k-instruct", "gsm8k_447"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_14"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_11"], ["qwen2.5-coder-1.5b-instruct", "mmlu_2664"], ["qwen2.5-1.5b-instruct", "mmlu_3752"], ["qwen2.5-1.5b-instruct", "csqa_449"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_153"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_98"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_156"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_78"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_16"], ["phi-3-mini-4k-instruct", "csqa_539"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_121"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_0"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_12"], ["phi-3-mini-4k-instruct", "mmlu_6572"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_144"], ["qwen2.5-3b-instruct", "mmlu_3432"], ["qwen2.5-3b-instruct", "gsm8k_209"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_76"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_138"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_37"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_60"], ["qwen2.5-math-1.5b-instruct", "mmlu_2340"], ["phi-3-mini-4k-instruct", "gsm8k_61"], ["phi-3-mini-4k-instruct", "csqa_629"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_155"], ["phi-3-mini-4k-instruct", "mmlu_7428"], ["qwen2.5-math-1.5b-instruct", "mmlu_5155"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_39"], ["qwen2.5-1.5b-instruct", "csqa_741"], ["phi-3-mini-4k-instruct", "csqa_864"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_115"], ["qwen2.5-1.5b-instruct", "gsm8k_1130"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_84"], ["phi-3-mini-4k-instruct", "csqa_224"], ["qwen2.5-math-1.5b-instruct", "mmlu_6216"], ["qwen2.5-math-1.5b-instruct", "mmlu_8751"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_125"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_393"], ["qwen2.5-3b-instruct", "csqa_130"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_129"], ["qwen2.5-3b-instruct", "csqa_696"], ["qwen2.5-3b-instruct", "csqa_1220"], ["qwen2.5-math-1.5b-instruct", "csqa_601"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_148"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_99"], ["qwen2.5-coder-1.5b-instruct", "csqa_1099"], ["qwen2.5-math-1.5b-instruct", "mmlu_2287"], ["qwen2.5-1.5b-instruct", "mmlu_2803"], ["qwen2.5-coder-1.5b-instruct", "mmlu_9125"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_161"], ["qwen2.5-3b-instruct", "mmlu_11199"], ["qwen2.5-1.5b-instruct", "csqa_493"], ["qwen2.5-1.5b-instruct", "mmlu_13809"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_162"], ["phi-3-mini-4k-instruct", "mmlu_4374"], ["qwen2.5-3b-instruct", "mmlu_10738"], ["qwen2.5-1.5b-instruct", "gsm8k_865"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_107"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_33"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_735"], ["qwen2.5-math-1.5b-instruct", "gsm8k_178"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_9"], ["phi-3-mini-4k-instruct", "mmlu_9980"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_35"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_64"], ["qwen2.5-1.5b-instruct", "gsm8k_457"], ["qwen2.5-3b-instruct", "mmlu_5977"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_77"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_143"], ["phi-3-mini-4k-instruct", "gsm8k_476"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_94"], ["qwen2.5-coder-1.5b-instruct", "mmlu_11946"], ["qwen2.5-3b-instruct", "mmlu_5820"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_83"], ["qwen2.5-3b-instruct", "csqa_958"], ["qwen2.5-1.5b-instruct", "gsm8k_189"], ["qwen2.5-1.5b-instruct", "gsm8k_318"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_152"], ["qwen2.5-1.5b-instruct", "gsm8k_228"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_105"], ["qwen2.5-1.5b-instruct", "mmlu_4010"], ["qwen2.5-math-1.5b-instruct", "gsm8k_54"], ["qwen2.5-1.5b-instruct", "csqa_1197"], ["qwen2.5-3b-instruct", "csqa_539"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_53"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_128"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_89"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_96"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_41"], ["phi-3-mini-4k-instruct", "gsm8k_1209"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_102"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_85"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_137"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_1"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_43"], ["phi-3-mini-4k-instruct", "mmlu_11498"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_141"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_600"], ["qwen2.5-3b-instruct", "mmlu_7428"], ["phi-3-mini-4k-instruct", "gsm8k_198"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_38"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_135"], ["qwen2.5-coder-1.5b-instruct", "mmlu_3752"], ["qwen2.5-coder-1.5b-instruct", "csqa_449"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_153"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_34"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_99"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_49"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_154"], ["qwen2.5-math-1.5b-instruct", "mmlu_5168"], ["phi-3-mini-4k-instruct", "mmlu_10485"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_57"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_47"], ["qwen2.5-1.5b-instruct", "csqa_1083"], ["qwen2.5-1.5b-instruct", "mmlu_6227"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_116"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_24"], ["phi-3-mini-4k-instruct", "mmlu_11274"], ["phi-3-mini-4k-instruct", "csqa_817"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_95"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_3"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_75"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_120"], ["qwen2.5-math-1.5b-instruct", "mmlu_1169"], ["phi-3-mini-4k-instruct", "csqa_283"], ["phi-3-mini-4k-instruct", "gsm8k_735"], ["qwen2.5-3b-instruct", "csqa_1104"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_7"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_39"], ["qwen2.5-coder-1.5b-instruct", "csqa_741"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_5"], ["qwen2.5-1.5b-instruct", "mmlu_10617"], ["phi-3-mini-4k-instruct", "mmlu_4040"], ["qwen2.5-1.5b-instruct", "csqa_611"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_113"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_11"], ["qwen2.5-math-1.5b-instruct", "csqa_6"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_114"], ["qwen2.5-3b-instruct", "gsm8k_864"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_42"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_156"], ["qwen2.5-3b-instruct", "mmlu_9980"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_73"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1034"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_16"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_163"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_100"], ["qwen2.5-coder-1.5b-instruct", "mmlu_2803"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_143"], ["phi-3-mini-4k-instruct", "csqa_546"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_121"], ["qwen2.5-coder-1.5b-instruct", "csqa_493"], ["qwen2.5-coder-1.5b-instruct", "mmlu_13809"], ["qwen2.5-math-1.5b-instruct", "gsm8k_466"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_696"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_55"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_144"], ["qwen2.5-3b-instruct", "csqa_1000"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_865"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_66"], ["qwen2.5-math-1.5b-instruct", "gsm8k_704"], ["qwen2.5-3b-instruct", "gsm8k_541"], ["qwen2.5-1.5b-instruct", "mmlu_2340"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_15"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_146"], ["qwen2.5-3b-instruct", "mmlu_4422"], ["qwen2.5-1.5b-instruct", "mmlu_5155"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_18"], ["qwen2.5-1.5b-instruct", "mmlu_6216"], ["qwen2.5-1.5b-instruct", "mmlu_8751"], ["phi-3-mini-4k-instruct", "gsm8k_740"], ["qwen2.5-3b-instruct", "mmlu_4554"], ["qwen2.5-math-1.5b-instruct", "gsm8k_689"], ["qwen2.5-3b-instruct", "gsm8k_940"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_457"], ["qwen2.5-math-1.5b-instruct", "csqa_1039"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_77"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_159"], ["qwen2.5-1.5b-instruct", "csqa_601"], ["qwen2.5-3b-instruct", "mmlu_11498"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_148"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_189"], ["qwen2.5-3b-instruct", "gsm8k_198"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_54"], ["qwen2.5-1.5b-instruct", "mmlu_2287"], ["phi-3-mini-4k-instruct", "csqa_663"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_318"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_152"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_145"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_34"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_228"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_105"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_122"], ["qwen2.5-3b-instruct", "mmlu_10485"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_79"], ["phi-3-mini-4k-instruct", "mmlu_525"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_68"], ["qwen2.5-coder-1.5b-instruct", "csqa_1197"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_107"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1266"], ["phi-3-mini-4k-instruct", "csqa_1133"], ["qwen2.5-math-1.5b-instruct", "csqa_186"], ["qwen2.5-3b-instruct", "mmlu_11274"], ["qwen2.5-3b-instruct", "csqa_817"], ["qwen2.5-3b-instruct", "csqa_327"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_21"], ["qwen2.5-3b-instruct", "csqa_217"], ["qwen2.5-3b-instruct", "gsm8k_13"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_124"], ["qwen2.5-1.5b-instruct", "gsm8k_178"], ["qwen2.5-math-1.5b-instruct", "csqa_234"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_69"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_102"], ["qwen2.5-math-1.5b-instruct", "gsm8k_447"], ["phi-3-mini-4k-instruct", "csqa_229"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_141"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_38"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_135"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_88"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_94"], ["qwen2.5-3b-instruct", "csqa_23"], ["qwen2.5-math-1.5b-instruct", "mmlu_10403"], ["qwen2.5-3b-instruct", "mmlu_4040"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_70"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_48"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_123"], ["qwen2.5-math-1.5b-instruct", "mmlu_6572"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_19"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_57"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_114"], ["qwen2.5-3b-instruct", "mmlu_11762"], ["qwen2.5-coder-1.5b-instruct", "csqa_765"], ["qwen2.5-coder-1.5b-instruct", "mmlu_6227"], ["qwen2.5-math-1.5b-instruct", "csqa_929"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_56"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_138"], ["qwen2.5-1.5b-instruct", "gsm8k_54"], ["phi-3-mini-4k-instruct", "mmlu_5313"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_87"], ["qwen2.5-math-1.5b-instruct", "gsm8k_61"], ["qwen2.5-math-1.5b-instruct", "csqa_629"], ["qwen2.5-3b-instruct", "csqa_546"], ["qwen2.5-1.5b-instruct", "gsm8k_451"], ["phi-3-mini-4k-instruct", "csqa_781"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_89"], ["qwen2.5-math-1.5b-instruct", "csqa_864"], ["qwen2.5-1.5b-instruct", "csqa_788"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_84"], ["phi-3-mini-4k-instruct", "gsm8k_1309"], ["qwen2.5-math-1.5b-instruct", "csqa_224"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_66"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_82"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_5"], ["qwen2.5-coder-1.5b-instruct", "mmlu_10617"], ["qwen2.5-math-1.5b-instruct", "csqa_743"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_146"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_150"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_129"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_97"], ["qwen2.5-coder-1.5b-instruct", "csqa_611"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_11"], ["qwen2.5-1.5b-instruct", "mmlu_10415"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_42"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_156"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_49"], ["qwen2.5-math-1.5b-instruct", "mmlu_9197"], ["qwen2.5-1.5b-instruct", "mmlu_5168"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_100"], ["qwen2.5-math-1.5b-instruct", "mmlu_4374"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_116"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_40"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_121"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_111"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_159"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_112"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_103"], ["qwen2.5-3b-instruct", "gsm8k_285"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_142"], ["qwen2.5-1.5b-instruct", "mmlu_12205"], ["qwen2.5-math-1.5b-instruct", "csqa_538"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_55"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_149"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_144"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_118"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_54"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_74"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_106"], ["qwen2.5-coder-1.5b-instruct", "mmlu_2340"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_14"], ["qwen2.5-1.5b-instruct", "mmlu_1169"], ["phi-3-mini-4k-instruct", "mmlu_4339"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_45"], ["qwen2.5-3b-instruct", "gsm8k_501"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_46"], ["phi-3-mini-4k-instruct", "mmlu_6482"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_158"], ["qwen2.5-3b-instruct", "mmlu_525"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_44"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_126"], ["qwen2.5-math-1.5b-instruct", "mmlu_2664"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_108"], ["phi-3-mini-4k-instruct", "mmlu_7573"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_80"], ["qwen2.5-coder-1.5b-instruct", "mmlu_6216"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_86"], ["qwen2.5-coder-1.5b-instruct", "mmlu_8751"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_67"], ["qwen2.5-math-1.5b-instruct", "gsm8k_476"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_12"], ["qwen2.5-1.5b-instruct", "csqa_6"], ["qwen2.5-3b-instruct", "csqa_229"], ["qwen2.5-1.5b-instruct", "mmlu_3432"], ["qwen2.5-1.5b-instruct", "gsm8k_1034"], ["qwen2.5-coder-1.5b-instruct", "csqa_601"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_101"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_60"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_22"], ["phi-3-mini-4k-instruct", "gsm8k_161"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_26"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_30"], ["phi-3-mini-4k-instruct", "csqa_161"], ["qwen2.5-3b-instruct", "csqa_1086"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_123"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_41"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_107"], ["qwen2.5-3b-instruct", "gsm8k_407"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1209"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_115"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_17"], ["phi-3-mini-4k-instruct", "gsm8k_93"], ["qwen2.5-coder-1.5b-instruct", "csqa_175"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_59"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_28"], ["qwen2.5-math-1.5b-instruct", "gsm8k_393"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_178"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_29"], ["qwen2.5-3b-instruct", "csqa_781"], ["qwen2.5-1.5b-instruct", "gsm8k_689"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_99"], ["qwen2.5-3b-instruct", "gsm8k_1309"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_51"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_140"], ["qwen2.5-1.5b-instruct", "csqa_1039"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_94"], ["qwen2.5-math-1.5b-instruct", "mmlu_9125"], ["phi-3-mini-4k-instruct", "gsm8k_1236"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_97"], ["phi-3-mini-4k-instruct", "mmlu_12713"], ["phi-3-mini-4k-instruct", "mmlu_916"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_24"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_48"], ["phi-3-mini-4k-instruct", "gsm8k_163"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_51"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_19"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_23"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_145"], ["qwen2.5-3b-instruct", "gsm8k_592"], ["phi-3-mini-4k-instruct", "gsm8k_563"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_122"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_79"], ["qwen2.5-1.5b-instruct", "gsm8k_1266"], ["qwen2.5-math-1.5b-instruct", "csqa_283"], ["qwen2.5-math-1.5b-instruct", "gsm8k_735"], ["qwen2.5-3b-instruct", "mmlu_7517"], ["phi-3-mini-4k-instruct", "gsm8k_1098"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_40"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_451"], ["phi-3-mini-4k-instruct", "gsm8k_1182"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_89"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_36"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_142"], ["qwen2.5-coder-1.5b-instruct", "csqa_788"], ["qwen2.5-3b-instruct", "csqa_313"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_134"], ["qwen2.5-1.5b-instruct", "gsm8k_447"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1287"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_50"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_106"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_13"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_86"], ["phi-3-mini-4k-instruct", "csqa_1195"], ["qwen2.5-3b-instruct", "csqa_330"], ["phi-3-mini-4k-instruct", "gsm8k_191"], ["qwen2.5-3b-instruct", "csqa_1"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_131"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_73"], ["qwen2.5-3b-instruct", "gsm8k_1206"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_44"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_163"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_108"], ["qwen2.5-3b-instruct", "mmlu_7573"], ["qwen2.5-coder-1.5b-instruct", "mmlu_10415"], ["qwen2.5-1.5b-instruct", "csqa_539"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_80"], ["qwen2.5-coder-1.5b-instruct", "mmlu_3598"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_49"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_70"], ["qwen2.5-coder-1.5b-instruct", "mmlu_5168"], ["qwen2.5-3b-instruct", "csqa_890"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_67"], ["phi-3-mini-4k-instruct", "csqa_490"], ["qwen2.5-1.5b-instruct", "mmlu_6572"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_117"], ["qwen2.5-1.5b-instruct", "csqa_929"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_116"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_128"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_93"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_103"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_138"], ["qwen2.5-coder-1.5b-instruct", "mmlu_12205"], ["qwen2.5-1.5b-instruct", "gsm8k_61"], ["qwen2.5-1.5b-instruct", "csqa_629"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_118"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_85"], ["qwen2.5-1.5b-instruct", "mmlu_7428"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_151"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_8"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_1"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_14"], ["qwen2.5-coder-1.5b-instruct", "mmlu_1169"], ["qwen2.5-1.5b-instruct", "csqa_864"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_136"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_4"], ["qwen2.5-3b-instruct", "csqa_161"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_18"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_20"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_84"], ["qwen2.5-1.5b-instruct", "csqa_224"], ["qwen2.5-math-1.5b-instruct", "gsm8k_740"], ["qwen2.5-math-1.5b-instruct", "mmlu_3752"], ["qwen2.5-1.5b-instruct", "csqa_743"], ["qwen2.5-3b-instruct", "gsm8k_93"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_129"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_6"], ["phi-3-mini-4k-instruct", "mmlu_1084"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_12"], ["qwen2.5-coder-1.5b-instruct", "csqa_6"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_58"], ["qwen2.5-3b-instruct", "csqa_877"], ["qwen2.5-coder-1.5b-instruct", "mmlu_3432"], ["qwen2.5-math-1.5b-instruct", "csqa_663"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_209"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1034"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_60"], ["phi-3-mini-4k-instruct", "mmlu_10532"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_95"], ["qwen2.5-1.5b-instruct", "mmlu_4374"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_147"], ["qwen2.5-3b-instruct", "gsm8k_1236"], ["qwen2.5-math-1.5b-instruct", "csqa_1133"], ["phi-3-mini-4k-instruct", "csqa_365"], ["qwen2.5-3b-instruct", "mmlu_12713"], ["qwen2.5-3b-instruct", "csqa_118"], ["qwen2.5-3b-instruct", "mmlu_916"], ["qwen2.5-3b-instruct", "gsm8k_163"], ["qwen2.5-math-1.5b-instruct", "csqa_741"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_23"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_62"], ["qwen2.5-coder-1.5b-instruct", "csqa_130"], ["phi-3-mini-4k-instruct", "gsm8k_775"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_124"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_69"], ["qwen2.5-1.5b-instruct", "mmlu_9980"], ["qwen2.5-3b-instruct", "gsm8k_1098"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_143"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_88"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_36"], ["qwen2.5-1.5b-instruct", "gsm8k_476"], ["qwen2.5-coder-1.5b-instruct", "mmlu_11199"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_689"], ["qwen2.5-coder-1.5b-instruct", "csqa_1039"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_133"], ["phi-3-mini-4k-instruct", "gsm8k_255"], ["qwen2.5-math-1.5b-instruct", "csqa_493"], ["qwen2.5-math-1.5b-instruct", "mmlu_13809"], ["qwen2.5-math-1.5b-instruct", "gsm8k_696"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_131"], ["phi-3-mini-4k-instruct", "gsm8k_569"], ["phi-3-mini-4k-instruct", "csqa_407"], ["qwen2.5-math-1.5b-instruct", "mmlu_5313"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_145"], ["phi-3-mini-4k-instruct", "mmlu_13666"], ["phi-3-mini-4k-instruct", "gsm8k_142"], ["phi-3-mini-4k-instruct", "mmlu_13189"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_122"], ["phi-3-mini-4k-instruct", "gsm8k_1232"], ["qwen2.5-3b-instruct", "mmlu_11216"], ["qwen2.5-3b-instruct", "csqa_490"], ["phi-3-mini-4k-instruct", "mmlu_4386"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_41"], ["qwen2.5-1.5b-instruct", "gsm8k_1209"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1266"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_71"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_98"], ["qwen2.5-coder-1.5b-instruct", "mmlu_5977"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_78"], ["qwen2.5-1.5b-instruct", "gsm8k_393"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_92"], ["qwen2.5-1.5b-instruct", "mmlu_11498"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_150"], ["qwen2.5-coder-1.5b-instruct", "csqa_958"], ["qwen2.5-3b-instruct", "gsm8k_65"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_447"], ["qwen2.5-1.5b-instruct", "gsm8k_198"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_77"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_34"], ["phi-3-mini-4k-instruct", "csqa_1043"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_99"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_119"], ["qwen2.5-1.5b-instruct", "mmlu_10485"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_76"], ["qwen2.5-math-1.5b-instruct", "gsm8k_318"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_152"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_37"], ["qwen2.5-coder-1.5b-instruct", "csqa_539"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_81"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_24"], ["qwen2.5-1.5b-instruct", "mmlu_11274"], ["qwen2.5-coder-1.5b-instruct", "mmlu_6572"], ["phi-3-mini-4k-instruct", "gsm8k_859"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_138"], ["qwen2.5-3b-instruct", "mmlu_10532"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_61"], ["qwen2.5-1.5b-instruct", "gsm8k_735"], ["qwen2.5-3b-instruct", "gsm8k_1116"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_127"], ["qwen2.5-math-1.5b-instruct", "mmlu_4339"], ["qwen2.5-1.5b-instruct", "csqa_283"], ["qwen2.5-coder-1.5b-instruct", "mmlu_7428"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_45"], ["qwen2.5-coder-1.5b-instruct", "csqa_629"], ["qwen2.5-math-1.5b-instruct", "mmlu_6482"], ["phi-3-mini-4k-instruct", "csqa_696"], ["phi-3-mini-4k-instruct", "csqa_1220"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_126"], ["qwen2.5-coder-1.5b-instruct", "csqa_864"], ["qwen2.5-3b-instruct", "gsm8k_206"], ["phi-3-mini-4k-instruct", "mmlu_2677"], ["qwen2.5-1.5b-instruct", "mmlu_4040"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_84"], ["qwen2.5-coder-1.5b-instruct", "csqa_224"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_90"], ["qwen2.5-3b-instruct", "gsm8k_775"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_114"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_129"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_162"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_73"], ["phi-3-mini-4k-instruct", "mmlu_10738"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_163"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_132"], ["qwen2.5-math-1.5b-instruct", "mmlu_6227"], ["qwen2.5-math-1.5b-instruct", "csqa_765"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_2"], ["qwen2.5-math-1.5b-instruct", "gsm8k_161"], ["qwen2.5-3b-instruct", "csqa_1025"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_30"], ["phi-3-mini-4k-instruct", "gsm8k_326"], ["qwen2.5-coder-1.5b-instruct", "mmlu_4374"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_9"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_128"], ["qwen2.5-3b-instruct", "gsm8k_255"], ["phi-3-mini-4k-instruct", "mmlu_10980"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_146"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_1"], ["qwen2.5-3b-instruct", "csqa_407"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_5"], ["phi-3-mini-4k-instruct", "csqa_1010"], ["phi-3-mini-4k-instruct", "mmlu_5820"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_83"], ["qwen2.5-3b-instruct", "mmlu_13666"], ["qwen2.5-3b-instruct", "gsm8k_1232"], ["qwen2.5-math-1.5b-instruct", "csqa_611"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_18"], ["qwen2.5-3b-instruct", "mmlu_4386"], ["qwen2.5-coder-1.5b-instruct", "mmlu_9980"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_139"], ["qwen2.5-1.5b-instruct", "gsm8k_740"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_42"], ["phi-3-mini-4k-instruct", "gsm8k_1149"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_143"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_476"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_159"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_27"], ["qwen2.5-3b-instruct", "csqa_323"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_100"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_54"], ["qwen2.5-1.5b-instruct", "csqa_663"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_15"], ["qwen2.5-3b-instruct", "csqa_1043"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_55"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_95"], ["qwen2.5-math-1.5b-instruct", "gsm8k_563"], ["qwen2.5-1.5b-instruct", "csqa_1133"], ["phi-3-mini-4k-instruct", "mmlu_12588"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_46"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_158"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1182"], ["qwen2.5-3b-instruct", "csqa_1161"], ["qwen2.5-3b-instruct", "gsm8k_859"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1209"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_41"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_65"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_124"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_134"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_86"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_72"], ["qwen2.5-1.5b-instruct", "csqa_229"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_69"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_154"], ["qwen2.5-math-1.5b-instruct", "csqa_1195"], ["qwen2.5-math-1.5b-instruct", "gsm8k_191"], ["qwen2.5-coder-1.5b-instruct", "mmlu_11498"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_47"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_109"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_198"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_88"], ["qwen2.5-3b-instruct", "mmlu_2677"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_34"], ["qwen2.5-coder-1.5b-instruct", "mmlu_10485"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_75"], ["qwen2.5-3b-instruct", "csqa_96"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_123"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_26"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_120"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_117"], ["qwen2.5-1.5b-instruct", "gsm8k_696"], ["phi-3-mini-4k-instruct", "csqa_1104"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_24"], ["qwen2.5-coder-1.5b-instruct", "mmlu_11274"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_7"], ["qwen2.5-coder-1.5b-instruct", "csqa_817"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_93"], ["qwen2.5-1.5b-instruct", "mmlu_5313"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_132"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_17"], ["qwen2.5-3b-instruct", "mmlu_13464"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_151"], ["qwen2.5-math-1.5b-instruct", "csqa_175"], ["qwen2.5-1.5b-instruct", "csqa_781"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_91"], ["qwen2.5-3b-instruct", "gsm8k_326"], ["qwen2.5-coder-1.5b-instruct", "csqa_283"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_136"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_4"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_20"], ["phi-3-mini-4k-instruct", "gsm8k_864"], ["qwen2.5-1.5b-instruct", "gsm8k_1309"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_25"], ["qwen2.5-3b-instruct", "gsm8k_440"], ["qwen2.5-3b-instruct", "mmlu_10980"], ["qwen2.5-coder-1.5b-instruct", "mmlu_4040"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_150"], ["qwen2.5-3b-instruct", "mmlu_6065"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_6"], ["qwen2.5-math-1.5b-instruct", "gsm8k_51"], ["qwen2.5-math-1.5b-instruct", "mmlu_1084"], ["qwen2.5-3b-instruct", "csqa_1010"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_114"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_58"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_73"], ["phi-3-mini-4k-instruct", "csqa_1000"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_48"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_139"], ["phi-3-mini-4k-instruct", "gsm8k_541"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_19"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_163"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_15"], ["phi-3-mini-4k-instruct", "mmlu_4422"], ["qwen2.5-3b-instruct", "gsm8k_1149"], ["qwen2.5-coder-1.5b-instruct", "csqa_546"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_157"], ["phi-3-mini-4k-instruct", "csqa_514"], ["phi-3-mini-4k-instruct", "csqa_1103"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_142"], ["qwen2.5-math-1.5b-instruct", "csqa_365"], ["qwen2.5-3b-instruct", "gsm8k_778"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_110"], ["qwen2.5-math-1.5b-instruct", "gsm8k_451"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_66"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_61"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_106"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_130"], ["qwen2.5-1.5b-instruct", "mmlu_4339"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_45"], ["qwen2.5-math-1.5b-instruct", "csqa_788"], ["phi-3-mini-4k-instruct", "mmlu_4554"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_146"], ["qwen2.5-1.5b-instruct", "mmlu_6482"], ["phi-3-mini-4k-instruct", "gsm8k_919"], ["phi-3-mini-4k-instruct", "gsm8k_940"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1287"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_44"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_126"], ["qwen2.5-3b-instruct", "mmlu_12588"], ["qwen2.5-1.5b-instruct", "mmlu_7573"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_63"], ["phi-3-mini-4k-instruct", "mmlu_3456"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_18"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_67"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_740"], ["qwen2.5-math-1.5b-instruct", "mmlu_10415"], ["qwen2.5-math-1.5b-instruct", "mmlu_3598"], ["phi-3-mini-4k-instruct", "mmlu_8179"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_159"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_68"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_101"], ["qwen2.5-1.5b-instruct", "csqa_765"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_54"], ["qwen2.5-math-1.5b-instruct", "gsm8k_569"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_31"], ["qwen2.5-coder-1.5b-instruct", "csqa_663"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_103"], ["qwen2.5-1.5b-instruct", "gsm8k_161"], ["phi-3-mini-4k-instruct", "csqa_327"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_30"], ["qwen2.5-math-1.5b-instruct", "mmlu_12205"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_21"], ["qwen2.5-math-1.5b-instruct", "gsm8k_142"], ["phi-3-mini-4k-instruct", "csqa_217"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_118"], ["qwen2.5-1.5b-instruct", "csqa_161"], ["phi-3-mini-4k-instruct", "gsm8k_13"], ["qwen2.5-math-1.5b-instruct", "mmlu_13189"], ["qwen2.5-coder-1.5b-instruct", "mmlu_525"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_14"], ["qwen2.5-coder-1.5b-instruct", "csqa_1133"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_98"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_155"], ["qwen2.5-1.5b-instruct", "gsm8k_93"], ["phi-3-mini-4k-instruct", "csqa_23"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_78"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_124"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_69"], ["qwen2.5-coder-1.5b-instruct", "csqa_229"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_91"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_12"], ["phi-3-mini-4k-instruct", "mmlu_11762"], ["qwen2.5-math-1.5b-instruct", "mmlu_3432"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_140"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_25"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_88"], ["qwen2.5-math-1.5b-instruct", "gsm8k_209"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_76"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_37"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_60"], ["qwen2.5-3b-instruct", "csqa_1099"], ["qwen2.5-1.5b-instruct", "mmlu_12713"], ["qwen2.5-1.5b-instruct", "mmlu_916"], ["qwen2.5-1.5b-instruct", "gsm8k_163"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_123"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_161"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_23"], ["qwen2.5-1.5b-instruct", "gsm8k_563"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_82"], ["qwen2.5-coder-1.5b-instruct", "mmlu_5313"], ["phi-3-mini-4k-instruct", "mmlu_3483"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_46"], ["phi-3-mini-4k-instruct", "gsm8k_1130"], ["qwen2.5-math-1.5b-instruct", "csqa_130"], ["qwen2.5-1.5b-instruct", "gsm8k_1098"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_158"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_157"], ["qwen2.5-1.5b-instruct", "gsm8k_1182"], ["qwen2.5-coder-1.5b-instruct", "csqa_781"], ["qwen2.5-math-1.5b-instruct", "csqa_696"], ["qwen2.5-math-1.5b-instruct", "csqa_1220"], ["qwen2.5-3b-instruct", "csqa_514"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_36"], ["qwen2.5-3b-instruct", "csqa_1103"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1309"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_134"], ["qwen2.5-1.5b-instruct", "csqa_1195"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_86"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_61"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_130"], ["qwen2.5-1.5b-instruct", "gsm8k_191"], ["qwen2.5-math-1.5b-instruct", "mmlu_11199"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_150"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_97"], ["qwen2.5-3b-instruct", "gsm8k_919"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_131"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_162"], ["qwen2.5-3b-instruct", "mmlu_11946"], ["qwen2.5-math-1.5b-instruct", "mmlu_10738"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_112"], ["phi-3-mini-4k-instruct", "gsm8k_285"], ["qwen2.5-3b-instruct", "mmlu_3456"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_149"], ["qwen2.5-1.5b-instruct", "csqa_490"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_26"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_117"], ["phi-3-mini-4k-instruct", "gsm8k_501"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_40"], ["phi-3-mini-4k-instruct", "mmlu_9292"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_9"], ["qwen2.5-3b-instruct", "mmlu_8179"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_93"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_142"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_17"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_151"], ["qwen2.5-1.5b-instruct", "csqa_175"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_31"], ["qwen2.5-math-1.5b-instruct", "mmlu_5977"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_10"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_106"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_35"], ["qwen2.5-math-1.5b-instruct", "mmlu_5820"], ["qwen2.5-coder-1.5b-instruct", "mmlu_4339"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_45"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_136"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_83"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_20"], ["qwen2.5-coder-1.5b-instruct", "mmlu_6482"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_4"], ["qwen2.5-math-1.5b-instruct", "csqa_958"], ["phi-3-mini-4k-instruct", "csqa_228"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_44"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_126"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_108"], ["qwen2.5-3b-instruct", "gsm8k_600"], ["qwen2.5-coder-1.5b-instruct", "mmlu_7573"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_80"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_6"], ["qwen2.5-1.5b-instruct", "gsm8k_51"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_22"], ["qwen2.5-1.5b-instruct", "mmlu_1084"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_67"], ["qwen2.5-3b-instruct", "csqa_449"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_153"], ["qwen2.5-math-1.5b-instruct", "csqa_539"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_58"], ["phi-3-mini-4k-instruct", "mmlu_4010"], ["phi-3-mini-4k-instruct", "csqa_1086"], ["phi-3-mini-4k-instruct", "gsm8k_407"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_101"], ["qwen2.5-1.5b-instruct", "mmlu_10532"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_59"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_28"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_161"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_30"], ["qwen2.5-1.5b-instruct", "csqa_365"], ["qwen2.5-coder-1.5b-instruct", "csqa_161"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_29"], ["qwen2.5-math-1.5b-instruct", "mmlu_7428"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_137"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_160"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_32"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_93"], ["qwen2.5-1.5b-instruct", "gsm8k_1287"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_52"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_39"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_154"], ["phi-3-mini-4k-instruct", "gsm8k_88"], ["qwen2.5-3b-instruct", "mmlu_3483"], ["qwen2.5-3b-instruct", "gsm8k_1130"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_47"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_125"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_51"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_104"], ["phi-3-mini-4k-instruct", "gsm8k_592"], ["qwen2.5-1.5b-instruct", "mmlu_3598"], ["phi-3-mini-4k-instruct", "csqa_1083"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_140"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_75"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_147"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_120"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1236"], ["qwen2.5-coder-1.5b-instruct", "mmlu_12713"], ["qwen2.5-coder-1.5b-instruct", "mmlu_916"], ["phi-3-mini-4k-instruct", "mmlu_7517"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_3"], ["qwen2.5-3b-instruct", "mmlu_2803"], ["qwen2.5-math-1.5b-instruct", "csqa_1104"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_7"], ["qwen2.5-1.5b-instruct", "gsm8k_569"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_163"], ["qwen2.5-1.5b-instruct", "csqa_407"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_23"], ["qwen2.5-1.5b-instruct", "gsm8k_142"], ["qwen2.5-1.5b-instruct", "mmlu_13666"], ["phi-3-mini-4k-instruct", "csqa_313"], ["qwen2.5-1.5b-instruct", "mmlu_13189"], ["qwen2.5-1.5b-instruct", "gsm8k_1232"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_563"], ["qwen2.5-3b-instruct", "gsm8k_865"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_13"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_50"], ["phi-3-mini-4k-instruct", "csqa_330"], ["phi-3-mini-4k-instruct", "csqa_1"], ["phi-3-mini-4k-instruct", "csqa_39"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1098"], ["qwen2.5-3b-instruct", "mmlu_9292"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_98"], ["qwen2.5-math-1.5b-instruct", "gsm8k_864"], ["qwen2.5-math-1.5b-instruct", "mmlu_9980"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1182"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_33"], ["phi-3-mini-4k-instruct", "gsm8k_1206"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_36"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_78"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_134"], ["qwen2.5-coder-1.5b-instruct", "csqa_1195"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_35"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_143"], ["phi-3-mini-4k-instruct", "csqa_890"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_10"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_191"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_16"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_131"], ["qwen2.5-3b-instruct", "gsm8k_457"], ["qwen2.5-3b-instruct", "csqa_228"], ["qwen2.5-math-1.5b-instruct", "csqa_1000"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_0"], ["qwen2.5-1.5b-instruct", "gsm8k_209"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_76"], ["qwen2.5-math-1.5b-instruct", "gsm8k_541"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_37"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_15"], ["qwen2.5-3b-instruct", "gsm8k_189"], ["qwen2.5-math-1.5b-instruct", "mmlu_4422"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_8"], ["qwen2.5-coder-1.5b-instruct", "csqa_490"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_117"], ["qwen2.5-1.5b-instruct", "gsm8k_859"], ["qwen2.5-3b-instruct", "gsm8k_228"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_105"], ["qwen2.5-3b-instruct", "mmlu_4010"], ["phi-3-mini-4k-instruct", "mmlu_5155"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_93"], ["qwen2.5-3b-instruct", "csqa_1197"], ["qwen2.5-math-1.5b-instruct", "mmlu_4554"], ["qwen2.5-1.5b-instruct", "csqa_130"], ["qwen2.5-math-1.5b-instruct", "gsm8k_940"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_151"], ["qwen2.5-1.5b-instruct", "csqa_696"], ["qwen2.5-1.5b-instruct", "csqa_1220"], ["qwen2.5-1.5b-instruct", "mmlu_2677"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_136"], ["qwen2.5-math-1.5b-instruct", "mmlu_11498"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_20"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_4"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_102"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_137"], ["qwen2.5-math-1.5b-instruct", "gsm8k_198"], ["phi-3-mini-4k-instruct", "csqa_877"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_141"], ["qwen2.5-1.5b-instruct", "mmlu_11199"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_34"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_160"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_32"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_148"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_6"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_162"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_81"], ["phi-3-mini-4k-instruct", "mmlu_2287"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_135"], ["qwen2.5-math-1.5b-instruct", "mmlu_10485"], ["qwen2.5-1.5b-instruct", "mmlu_10738"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_52"], ["qwen2.5-3b-instruct", "gsm8k_88"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_68"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_38"], ["qwen2.5-coder-1.5b-instruct", "mmlu_1084"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_147"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_58"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_132"], ["phi-3-mini-4k-instruct", "csqa_118"], ["qwen2.5-math-1.5b-instruct", "mmlu_11274"], ["qwen2.5-math-1.5b-instruct", "csqa_817"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_104"], ["qwen2.5-math-1.5b-instruct", "csqa_327"], ["qwen2.5-coder-1.5b-instruct", "mmlu_10532"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_57"], ["qwen2.5-3b-instruct", "csqa_1083"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_62"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_21"], ["qwen2.5-math-1.5b-instruct", "csqa_217"], ["qwen2.5-math-1.5b-instruct", "gsm8k_13"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_9"], ["qwen2.5-coder-1.5b-instruct", "csqa_365"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_3"], ["qwen2.5-1.5b-instruct", "mmlu_5977"], ["qwen2.5-math-1.5b-instruct", "csqa_23"], ["qwen2.5-1.5b-instruct", "csqa_1010"], ["qwen2.5-1.5b-instruct", "mmlu_5820"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_83"], ["qwen2.5-math-1.5b-instruct", "mmlu_4040"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_775"], ["qwen2.5-1.5b-instruct", "csqa_958"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_64"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_139"], ["qwen2.5-3b-instruct", "csqa_39"], ["qwen2.5-3b-instruct", "mmlu_10617"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_133"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_114"], ["qwen2.5-math-1.5b-instruct", "mmlu_11762"], ["qwen2.5-1.5b-instruct", "gsm8k_1149"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_11"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_156"], ["qwen2.5-math-1.5b-instruct", "csqa_546"], ["phi-3-mini-4k-instruct", "mmlu_11216"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_16"], ["phi-3-mini-4k-instruct", "gsm8k_54"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_255"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_71"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_53"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_121"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_0"], ["qwen2.5-coder-1.5b-instruct", "csqa_407"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_66"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_569"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_96"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_82"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_142"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_92"], ["qwen2.5-coder-1.5b-instruct", "mmlu_13666"], ["qwen2.5-coder-1.5b-instruct", "mmlu_13189"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1232"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_146"], ["phi-3-mini-4k-instruct", "gsm8k_65"], ["qwen2.5-coder-1.5b-instruct", "mmlu_4386"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_144"], ["qwen2.5-3b-instruct", "mmlu_2340"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_43"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_98"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_154"], ["qwen2.5-3b-instruct", "mmlu_5155"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_119"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_78"], ["qwen2.5-3b-instruct", "mmlu_6216"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_47"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_81"], ["qwen2.5-3b-instruct", "mmlu_8751"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_159"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_112"], ["qwen2.5-math-1.5b-instruct", "gsm8k_285"], ["qwen2.5-coder-1.5b-instruct", "csqa_1043"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_149"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_54"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_75"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_76"], ["qwen2.5-3b-instruct", "csqa_601"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_37"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_120"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_148"], ["phi-3-mini-4k-instruct", "gsm8k_1116"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_127"], ["qwen2.5-math-1.5b-instruct", "gsm8k_501"], ["qwen2.5-3b-instruct", "mmlu_2287"], ["qwen2.5-1.5b-instruct", "csqa_1104"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_7"], ["qwen2.5-math-1.5b-instruct", "mmlu_525"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_859"], ["phi-3-mini-4k-instruct", "gsm8k_206"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_91"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_107"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_90"], ["qwen2.5-1.5b-instruct", "gsm8k_864"], ["qwen2.5-math-1.5b-instruct", "csqa_229"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_113"], ["qwen2.5-coder-1.5b-instruct", "csqa_696"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_25"], ["qwen2.5-coder-1.5b-instruct", "mmlu_2677"], ["qwen2.5-coder-1.5b-instruct", "csqa_1220"], ["qwen2.5-3b-instruct", "gsm8k_178"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_22"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_2"], ["phi-3-mini-4k-instruct", "csqa_1025"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_162"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_64"], ["qwen2.5-1.5b-instruct", "csqa_1000"], ["qwen2.5-coder-1.5b-instruct", "mmlu_10738"], ["qwen2.5-math-1.5b-instruct", "csqa_1086"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_94"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_123"], ["qwen2.5-1.5b-instruct", "gsm8k_541"], ["qwen2.5-math-1.5b-instruct", "gsm8k_407"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_15"], ["phi-3-mini-4k-instruct", "gsm8k_466"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_132"], ["qwen2.5-1.5b-instruct", "mmlu_4422"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_157"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_59"], ["phi-3-mini-4k-instruct", "gsm8k_704"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_28"], ["qwen2.5-1.5b-instruct", "csqa_514"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_326"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_29"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_9"], ["qwen2.5-math-1.5b-instruct", "csqa_781"], ["qwen2.5-3b-instruct", "gsm8k_54"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_130"], ["qwen2.5-coder-1.5b-instruct", "mmlu_10980"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_53"], ["qwen2.5-1.5b-instruct", "mmlu_4554"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1309"], ["qwen2.5-1.5b-instruct", "gsm8k_940"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_89"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_96"], ["qwen2.5-coder-1.5b-instruct", "csqa_1010"], ["qwen2.5-coder-1.5b-instruct", "mmlu_5820"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_83"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_27"], ["phi-3-mini-4k-instruct", "csqa_323"], ["qwen2.5-1.5b-instruct", "mmlu_3456"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_97"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_139"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_51"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_43"], ["qwen2.5-math-1.5b-instruct", "gsm8k_592"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1149"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_68"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_49"], ["qwen2.5-math-1.5b-instruct", "mmlu_7517"], ["qwen2.5-3b-instruct", "mmlu_5168"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_40"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_79"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_31"], ["qwen2.5-1.5b-instruct", "csqa_817"], ["phi-3-mini-4k-instruct", "csqa_1161"], ["qwen2.5-1.5b-instruct", "csqa_327"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_142"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_65"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_21"], ["qwen2.5-1.5b-instruct", "csqa_217"], ["phi-3-mini-4k-instruct", "csqa_186"], ["qwen2.5-1.5b-instruct", "gsm8k_13"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_116"], ["qwen2.5-math-1.5b-instruct", "csqa_313"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_13"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_72"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_50"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_106"], ["qwen2.5-math-1.5b-instruct", "csqa_330"], ["qwen2.5-math-1.5b-instruct", "csqa_1"], ["qwen2.5-coder-1.5b-instruct", "mmlu_12588"], ["phi-3-mini-4k-instruct", "csqa_234"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_109"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1206"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_44"], ["qwen2.5-3b-instruct", "mmlu_1169"], ["qwen2.5-1.5b-instruct", "csqa_23"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_108"], ["qwen2.5-math-1.5b-instruct", "mmlu_7573"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_80"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_154"], ["qwen2.5-math-1.5b-instruct", "csqa_890"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_67"], ["phi-3-mini-4k-instruct", "csqa_96"], ["phi-3-mini-4k-instruct", "mmlu_10403"], ["qwen2.5-1.5b-instruct", "mmlu_11762"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_47"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_70"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_113"], ["qwen2.5-3b-instruct", "csqa_6"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_101"], ["phi-3-mini-4k-instruct", "csqa_929"], ["qwen2.5-1.5b-instruct", "csqa_546"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_56"], ["phi-3-mini-4k-instruct", "mmlu_13464"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_8"], ["qwen2.5-3b-instruct", "gsm8k_1034"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_75"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_120"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_87"], ["qwen2.5-math-1.5b-instruct", "csqa_161"], ["qwen2.5-coder-1.5b-instruct", "csqa_1104"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_7"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_66"], ["phi-3-mini-4k-instruct", "gsm8k_440"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_82"], ["qwen2.5-3b-instruct", "gsm8k_466"], ["qwen2.5-1.5b-instruct", "mmlu_3483"], ["phi-3-mini-4k-instruct", "mmlu_6065"], ["qwen2.5-math-1.5b-instruct", "gsm8k_93"], ["qwen2.5-3b-instruct", "gsm8k_704"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_91"], ["phi-3-mini-4k-instruct", "csqa_743"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_864"], ["qwen2.5-math-1.5b-instruct", "csqa_877"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_25"], ["phi-3-mini-4k-instruct", "mmlu_9197"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_140"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_147"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_112"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1236"], ["qwen2.5-1.5b-instruct", "gsm8k_285"], ["qwen2.5-3b-instruct", "gsm8k_689"], ["qwen2.5-math-1.5b-instruct", "mmlu_12713"], ["qwen2.5-math-1.5b-instruct", "mmlu_916"], ["qwen2.5-math-1.5b-instruct", "csqa_118"], ["phi-3-mini-4k-instruct", "gsm8k_778"], ["qwen2.5-coder-1.5b-instruct", "csqa_1000"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_110"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_149"], ["qwen2.5-3b-instruct", "csqa_1039"], ["qwen2.5-math-1.5b-instruct", "gsm8k_163"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_111"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_541"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_23"], ["phi-3-mini-4k-instruct", "csqa_538"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_62"], ["qwen2.5-coder-1.5b-instruct", "mmlu_4422"], ["qwen2.5-1.5b-instruct", "gsm8k_501"], ["qwen2.5-1.5b-instruct", "mmlu_9292"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_157"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_74"], ["qwen2.5-1.5b-instruct", "mmlu_525"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_145"], ["qwen2.5-coder-1.5b-instruct", "csqa_514"], ["qwen2.5-coder-1.5b-instruct", "csqa_1103"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_63"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_122"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1098"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_79"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_61"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_130"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_10"], ["qwen2.5-3b-instruct", "gsm8k_1266"], ["phi-3-mini-4k-instruct", "mmlu_2664"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_36"], ["qwen2.5-coder-1.5b-instruct", "mmlu_4554"], ["qwen2.5-3b-instruct", "csqa_186"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_940"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_919"], ["qwen2.5-1.5b-instruct", "csqa_228"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_133"], ["qwen2.5-coder-1.5b-instruct", "mmlu_3456"], ["qwen2.5-3b-instruct", "csqa_234"], ["qwen2.5-3b-instruct", "gsm8k_447"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_131"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_22"], ["qwen2.5-math-1.5b-instruct", "mmlu_11216"], ["qwen2.5-coder-1.5b-instruct", "mmlu_8179"], ["qwen2.5-1.5b-instruct", "csqa_1086"], ["qwen2.5-math-1.5b-instruct", "csqa_490"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_68"], ["qwen2.5-1.5b-instruct", "gsm8k_407"], ["qwen2.5-3b-instruct", "mmlu_10403"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_71"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_70"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_155"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_31"], ["qwen2.5-3b-instruct", "mmlu_6572"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_59"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_28"], ["qwen2.5-coder-1.5b-instruct", "csqa_327"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_115"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_92"], ["qwen2.5-coder-1.5b-instruct", "csqa_217"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_13"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_21"], ["qwen2.5-3b-instruct", "csqa_929"], ["qwen2.5-math-1.5b-instruct", "gsm8k_65"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_56"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_29"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_138"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_87"], ["qwen2.5-3b-instruct", "gsm8k_61"], ["qwen2.5-3b-instruct", "csqa_629"], ["phi-3-mini-4k-instruct", "gsm8k_393"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_160"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_32"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_52"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_119"], ["qwen2.5-3b-instruct", "csqa_864"], ["qwen2.5-coder-1.5b-instruct", "csqa_23"], ["qwen2.5-1.5b-instruct", "gsm8k_88"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_84"], ["qwen2.5-3b-instruct", "csqa_224"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_97"], ["phi-3-mini-4k-instruct", "csqa_1099"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_81"], ["phi-3-mini-4k-instruct", "mmlu_9125"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_161"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_51"], ["qwen2.5-3b-instruct", "csqa_743"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_104"], ["qwen2.5-coder-1.5b-instruct", "mmlu_11762"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_129"], ["qwen2.5-1.5b-instruct", "gsm8k_592"], ["qwen2.5-math-1.5b-instruct", "mmlu_10532"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1116"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_127"], ["qwen2.5-1.5b-instruct", "mmlu_7517"], ["qwen2.5-3b-instruct", "mmlu_9197"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_40"], ["qwen2.5-math-1.5b-instruct", "gsm8k_206"], ["qwen2.5-3b-instruct", "mmlu_4374"], ["qwen2.5-1.5b-instruct", "csqa_313"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_13"], ["qwen2.5-1.5b-instruct", "csqa_330"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_111"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_82"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_50"], ["qwen2.5-1.5b-instruct", "csqa_1"], ["qwen2.5-1.5b-instruct", "csqa_39"], ["qwen2.5-3b-instruct", "csqa_538"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_1130"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_90"], ["qwen2.5-coder-1.5b-instruct", "mmlu_3483"], ["qwen2.5-math-1.5b-instruct", "gsm8k_775"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_74"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_125"], ["phi-3-mini-4k-instruct", "mmlu_11946"], ["qwen2.5-1.5b-instruct", "gsm8k_1206"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_108"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_80"], ["qwen2.5-1.5b-instruct", "csqa_890"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_2"], ["qwen2.5-3b-instruct", "mmlu_2664"], ["qwen2.5-math-1.5b-instruct", "csqa_1025"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_0"], ["qwen2.5-3b-instruct", "gsm8k_476"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_112"], ["qwen2.5-math-1.5b-instruct", "gsm8k_255"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_285"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_149"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_128"], ["qwen2.5-math-1.5b-instruct", "csqa_407"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_8"], ["qwen2.5-math-1.5b-instruct", "mmlu_13666"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_501"], ["qwen2.5-math-1.5b-instruct", "gsm8k_1232"], ["qwen2.5-coder-1.5b-instruct", "mmlu_9292"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_85"], ["qwen2.5-math-1.5b-instruct", "mmlu_4386"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_1"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_33"], ["phi-3-mini-4k-instruct", "gsm8k_600"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_35"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_41"], ["qwen2.5-3b-instruct", "gsm8k_1209"], ["phi-3-mini-4k-instruct", "mmlu_3752"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_10"], ["phi-3-mini-4k-instruct", "csqa_449"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_153"], ["qwen2.5-math-1.5b-instruct", "csqa_323"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_115"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_27"], ["qwen2.5-coder-1.5b-instruct", "csqa_228"], ["qwen2.5-1.5b-instruct", "csqa_877"], ["qwen2.5-3b-instruct", "gsm8k_393"], ["qwen2.5-math-1.5b-instruct", "csqa_1043"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_22"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_147"], ["qwen2.5-1.5b-instruct", "gsm8k_1236"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_95"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_99"], ["qwen2.5-coder-1.5b-instruct", "mmlu_4010"], ["qwen2.5-1.5b-instruct", "csqa_118"], ["qwen2.5-coder-1.5b-instruct", "csqa_1086"], ["qwen2.5-3b-instruct", "mmlu_9125"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_407"], ["qwen2.5-math-1.5b-instruct", "gsm8k_859"], ["qwen2.5-math-1.5b-instruct", "csqa_1161"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_65"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_62"], ["qwen2.5-3b-instruct", "humaneval_HumanEval_24"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_72"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_28"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_59"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_39"], ["phi-3-mini-4k-instruct", "csqa_741"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_137"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_29"], ["qwen2.5-math-1.5b-instruct", "humaneval_HumanEval_109"], ["phi-3-mini-4k-instruct", "humaneval_HumanEval_125"], ["qwen2.5-math-1.5b-instruct", "mmlu_2677"], ["qwen2.5-3b-instruct", "gsm8k_735"], ["qwen2.5-3b-instruct", "csqa_283"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_160"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_32"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_64"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_52"], ["qwen2.5-math-1.5b-instruct", "csqa_96"], ["qwen2.5-coder-1.5b-instruct", "gsm8k_88"], ["qwen2.5-1.5b-instruct", "humaneval_HumanEval_133"], ["phi-3-mini-4k-instruct", "mmlu_2803"], ["qwen2.5-coder-1.5b-instruct", "humaneval_HumanEval_51"]]123456789101112131415161718192021expert,domain,n,accuracy,mean_stated_conf,mean_logit_conf,ece_stated,ece_logit,gap_stated,gap_logitphi-3-mini-4k-instruct,code,164,0.2865853658536585,1.0,0.919297408676002,0.5,0.6327120428223436,0.7134146341463414,0.6327120428223434phi-3-mini-4k-instruct,commonsense,60,0.7166666666666667,0.955,0.8997573624054591,0.255,0.22583314478397365,0.23833333333333329,0.18309069573879244phi-3-mini-4k-instruct,knowledge,60,0.7,0.8657142857142858,0.7834400443236033,0.27535714285714286,0.09101869344711307,0.16571428571428581,0.0834400443236033phi-3-mini-4k-instruct,math,60,0.8666666666666667,1.0,0.9959982850485378,0.0,0.12933161838187118,0.1333333333333333,0.12933161838187113qwen2.5-1.5b-instruct,code,164,0.49390243902439024,1.0,0.930360819290324,0.6666666666666667,0.43645838026593375,0.5060975609756098,0.43645838026593375qwen2.5-1.5b-instruct,commonsense,60,0.65,1.0,0.9254698418080807,0.35,0.27546984180808065,0.35,0.27546984180808065qwen2.5-1.5b-instruct,knowledge,60,0.6166666666666667,0.9844827586206898,0.8511776079734167,0.38103448275862073,0.26541634897391003,0.3678160919540231,0.23451094130675qwen2.5-1.5b-instruct,math,60,0.6333333333333333,1.0,0.9854347310794724,0.09090909090909094,0.35210139774613913,0.3666666666666667,0.35210139774613913qwen2.5-3b-instruct,code,164,0.7134146341463414,0.035,0.9796102109842183,,0.2661955768378769,-0.6784146341463414,0.26619557683787687qwen2.5-3b-instruct,commonsense,60,0.7,0.62,0.9929962309201559,,0.2929962309201559,-0.07999999999999996,0.2929962309201559qwen2.5-3b-instruct,knowledge,60,0.6333333333333333,0.2538095238095239,0.9729477167129517,0.36619047619047623,0.3463762501875559,-0.37952380952380943,0.33961438337961836qwen2.5-3b-instruct,math,60,0.8333333333333334,0.2445454545454546,0.9874445771012041,0.5736363636363636,0.15411124376787094,-0.5887878787878787,0.15411124376787078qwen2.5-coder-1.5b-instruct,code,164,0.6158536585365854,0.9166666666666666,0.9623494351055563,0.26666666666666666,0.346495776568971,0.30081300813008127,0.3464957765689709qwen2.5-coder-1.5b-instruct,commonsense,60,0.5666666666666667,0.9275000000000001,0.6341848185658455,0.36083333333333356,0.12009550044933952,0.36083333333333345,0.06751815189917887qwen2.5-coder-1.5b-instruct,knowledge,60,0.31666666666666665,0.8785000000000001,0.5605441039800644,0.5618333333333333,0.2738585617144903,0.5618333333333334,0.24387743731339773qwen2.5-coder-1.5b-instruct,math,60,0.4666666666666667,1.0,0.9913847305211756,0.18181818181818177,0.524718063854509,0.5333333333333333,0.5247180638545089qwen2.5-math-1.5b-instruct,code,164,0.0,0.02,0.9413269365433513,,0.9413269365433512,0.02,0.9413269365433513qwen2.5-math-1.5b-instruct,commonsense,60,0.16666666666666666,0.07047619047619048,0.8772038034598033,0.19047619047619047,0.7105371367931366,-0.09619047619047617,0.7105371367931367qwen2.5-math-1.5b-instruct,knowledge,60,0.15,0.21914285714285708,0.7977038104707996,0.25114285714285717,0.6513825018579761,0.06914285714285709,0.6477038104707996qwen2.5-math-1.5b-instruct,math,60,0.8833333333333333,0.10272727272727272,0.9998495669828522,0.8972727272727273,0.11651623364951891,-0.7806060606060605,0.1165162336495189112345678910111213141516171819202122threshold,escalate_rate,routed_acc0.0,0.0,0.71802325581395350.05,0.0,0.71802325581395350.1,0.0,0.71802325581395350.15000000000000002,0.0,0.71802325581395350.2,0.0,0.71802325581395350.25,0.0029069767441860465,0.71802325581395350.30000000000000004,0.0029069767441860465,0.71802325581395350.35000000000000003,0.0029069767441860465,0.71802325581395350.4,0.0029069767441860465,0.71802325581395350.45,0.0029069767441860465,0.71802325581395350.5,0.014534883720930232,0.72383720930232550.55,0.01744186046511628,0.72093023255813950.6000000000000001,0.0377906976744186,0.72383720930232550.65,0.0755813953488372,0.73546511627906970.7000000000000001,0.29941860465116277,0.72965116279069760.75,0.8372093023255814,0.6889534883720930.8,0.8459302325581395,0.6889534883720930.8500000000000001,1.0,0.69476744186046510.9,1.0,0.69476744186046510.9500000000000001,1.0,0.69476744186046511.0,1.0,0.694767441860465112345678910111213141516171819202122232425262728293031323334353637383940# ββ ScoutRoute β Python dependencies βββββββββββββββββββββββ# Install with: pip install -r requirements.txt# On Kaggle/Colab add the -q flag: pip install -q -r requirements.txt
# ββ Core ML / inference βββββββββββββββββββββββββββββββββββββββββββββββββββββββtorch>=2.1.0 # PyTorch β GPU inferencetransformers>=4.40.0 # HuggingFace model loading + generationaccelerate>=0.29.0 # device_map placement supportbitsandbytes>=0.43.0 # 4-bit quantisation β imported but OFF by default # (USE_4BIT is False for all 5 models; fp16 is # faster at this model size). Kept as an optional # path in collect_data_helpers.load_model() in # case a future model needs it.
# ββ Datasets ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdatasets>=2.18.0 # HuggingFace datasets β gsm8k, openai_humaneval, # cais/mmlu, tau/commonsense_qa, all loaded directly # (no RouterBench dependency)
# ββ ML / probes βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββscikit-learn>=1.4.0 # LogisticRegression probe, PCA, train_test_splitnumpy>=1.26.0 # array ops, hidden-state storage (.npz)joblib>=1.3.0 # saving/loading probe artefacts (.pkl)
# ββ Data handling βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββpandas>=2.0.0 # DataFrames for results tablespyarrow>=14.0.0 # Parquet read/write (results storage format)
# ββ Visualisation βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββmatplotlib>=3.8.0 # Reliability diagrams
# ββ Utilities βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββtqdm>=4.66.0 # Progress bars during inference
# ββ NOT required ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ# sentence-transformers β was used in an earlier P(IK)-distillation design# (prompt embeddings β predicted P(IK)). That approach was dropped in favour# of logit-based signals; the hidden-state probe (Feature C) trains directly# on the model's own last-layer hidden states, no separate embedding model# needed. Do not install unless re-adding that path.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644"""Step 1: Direct-from-HuggingFace Prompt Collection + Model Inference=====================================================================Loads four benchmarks directly from HuggingFace (clean answer keys, noRouterBench dependency) and runs each of 5 expert models on them, extractingTHREE logit-based signals per (prompt, expert) pair:
Feature A β mean_log_prob : avg log-prob of generated answer tokens Feature B β first_tok_entropy : entropy of the first-token distribution Feature C β last_hidden_state : last-layer last-token hidden vector (saved separately for probe training in Step 2)
No verbal self-assessment anywhere. All signals come from model internals.
DATASETS (chosen for specialist/generalist contrast β see project notes): GSM8K 100 prompts, stratified to the HARDER half of the test split (avoids near-100% accuracy / class imbalance for Qwen-Math). Qwen-Math expected to dominate. HumanEval All 164 prompts. Code execution scoring via subprocess. Qwen-Coder expected to dominate. MMLU 100 prompts across 6 diverse subjects (not all 57 β avoids wasting compute on near-uniform-difficulty subjects). General models (Phi-3, Qwen-3B) expected to win. CommonsenseQA 100 prompts. No specialist advantage β baseline domain where routing signal should be weak/uniform.
Total: ~464 prompts Γ 5 models. No RouterBench, no answer-key workarounds.
Run: python src/01_collect_data.py [--model MODEL_KEY] [--max_prompts N] [--batch_size N]
--model Run one model only (parallelise across Kaggle sessions) --max_prompts Cap total prompts across all domains (for a smoke test) --batch_size Prompts between progress log lines (default 50)"""
import os, sys, json, argparse, traceback, randomfrom pathlib import Pathfrom datetime import datetime
import torchimport numpy as npimport pandas as pdfrom datasets import load_datasetfrom tqdm import tqdm
sys.path.insert(0, str(Path(__file__).parent))from collect_data_helpers import build_prompt, load_model, score_answer
# ββ Paths ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββBASE_DIR = Path(__file__).resolve().parent.parent # project root (scripts live in src/)CKPT_DIR = BASE_DIR / "checkpoints"RESULTS_DIR = BASE_DIR / "results"HIDDEN_DIR = BASE_DIR / "hidden_states" # large numpy arrays, one file per modelLOG_DIR = BASE_DIR / "logs"for d in [CKPT_DIR, RESULTS_DIR, HIDDEN_DIR, LOG_DIR]: d.mkdir(exist_ok=True)
# ββ Model registry βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ# 5 models, all β€3.8B β fits comfortably on a single T4 in fp16.# 7B models dropped: too slow for the compute budget and not needed β# the specialist/generalist contrast is already clear at this size.MODELS = { "qwen25_1b": "Qwen/Qwen2.5-1.5B-Instruct", # general, 1.5B "qwen25_3b": "Qwen/Qwen2.5-3B-Instruct", # general, 3B "phi3_mini": "microsoft/Phi-3-mini-4k-instruct", # general, 3.8B (strong for size) "qwen25_math": "Qwen/Qwen2.5-Math-1.5B-Instruct", # math specialist, 1.5B "qwen25_coder": "Qwen/Qwen2.5-Coder-1.5B-Instruct", # code specialist, 1.5B}
# Precision per model β fp16 for everything (no 4-bit needed at this size;# 4-bit dequantization overhead on small models is slower than fp16 outright)USE_4BIT = { "qwen25_1b": False, "qwen25_3b": False, "phi3_mini": False, "qwen25_math": False, "qwen25_coder": False,}
# Phi-3's remote code has a rope_scaling KeyError under trust_remote_code=True# on some transformers versions β load it without remote code.TRUST_REMOTE_CODE = { "qwen25_1b": True, "qwen25_3b": True, "phi3_mini": False, "qwen25_math": True, "qwen25_coder": True,}
# ββ Logging ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef get_logger(model_key): import logging log_file = LOG_DIR / f"{model_key}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log" logging.basicConfig( level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s", handlers=[logging.FileHandler(log_file), logging.StreamHandler()], ) return logging.getLogger(model_key)
# ββ Checkpoint helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef ckpt_path(model_key): return CKPT_DIR / f"{model_key}_progress.jsonl"
def load_checkpoint(model_key): """Return (set of completed prompt_ids, list of saved rows).""" path = ckpt_path(model_key) done_ids, rows = set(), [] if path.exists(): with open(path) as f: for line in f: row = json.loads(line) done_ids.add(row["prompt_id"]) rows.append(row) return done_ids, rows
def save_row(model_key, row): """Append one result row immediately β crash-safe.""" with open(ckpt_path(model_key), "a") as f: f.write(json.dumps(row) + "\n")
def finalise(model_key, logger): """Consolidate JSONL checkpoint β Parquet (excludes the bulky hidden states).""" path = ckpt_path(model_key) if not path.exists(): logger.warning(f"No checkpoint for {model_key}") return df = pd.read_json(path, lines=True) out = RESULTS_DIR / f"{model_key}_results.parquet" df.to_parquet(out, index=False) logger.info(f"Saved {len(df)} rows β {out}") return df
# ββ Hidden-state store βββββββββββββββββββββββββββββββββββββββββββββββββββββββββclass HiddenStateStore: """ Incrementally saves hidden states to a .npz archive. Hidden states are large (e.g. 4096-dim for 7B models), so they are stored separately from the main results to keep the JSONL checkpoint small.
Layout: hidden_states/{model_key}_hidden.npz keys: prompt_ids β (N,) array of prompt_id strings vectors β (N, hidden_dim) float32 array """
def __init__(self, model_key): self.path = HIDDEN_DIR / f"{model_key}_hidden.npz" self.tmp_ids = [] self.tmp_vecs = [] self._load_existing()
def _load_existing(self): if self.path.exists(): data = np.load(self.path, allow_pickle=True) self.existing_ids = set(data["prompt_ids"].tolist()) self.existing_vecs = data["vectors"] # (N, D) self.ex_id_list = data["prompt_ids"].tolist() else: self.existing_ids = set() self.existing_vecs = None self.ex_id_list = []
def already_saved(self, prompt_id): return prompt_id in self.existing_ids
def add(self, prompt_id, vector): """Buffer one hidden state. Call flush() periodically.""" self.tmp_ids.append(prompt_id) self.tmp_vecs.append(vector)
def flush(self): """Write buffered states to disk, merging with existing.""" if not self.tmp_ids: return new_ids = np.array(self.tmp_ids) new_vecs = np.stack(self.tmp_vecs, axis=0).astype(np.float32)
if self.existing_vecs is not None: all_ids = np.array(self.ex_id_list + self.tmp_ids) all_vecs = np.concatenate([self.existing_vecs, new_vecs], axis=0) else: all_ids = new_ids all_vecs = new_vecs
np.savez_compressed(self.path, prompt_ids=all_ids, vectors=all_vecs)
# Update in-memory index self.ex_id_list += self.tmp_ids self.existing_ids |= set(self.tmp_ids) self.existing_vecs = all_vecs self.tmp_ids = [] self.tmp_vecs = []
# ββ Dataset loader βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ## Four benchmarks loaded directly from HuggingFace with clean ground-truth# answer keys β no RouterBench dependency, no reference-answer workarounds.## GSM8K (math, Qwen-Math should dominate):# Stratified to the HARDER half of the test split. Qwen-Math scores near# 100% on easy GSM8K problems, which gives almost no negative examples for# probe training β class imbalance kills the probe. Taking harder problems# (the latter portion of the test split, which tends to need more reasoning# steps) produces real variance in correctness.## HumanEval (code, Qwen-Coder should dominate):# All 164 prompts used β small enough to run in full. Scored via actual# code execution in a subprocess sandbox with a timeout, not string# matching. This is the only domain requiring code execution.## MMLU (knowledge, general models should win):# 100 prompts across 6 deliberately diverse subjects rather than a random# sample across all 57 β avoids wasting compute on subjects with uniform# difficulty. Subjects chosen for topic diversity: math, physics, CS,# history, medicine, law.## CommonsenseQA (no specialist advantage β baseline domain):# 100 prompts. Tests whether routing degrades gracefully to "no clear# winner" when no expert has a domain edge.
GSM8K_N = 100HUMANEVAL_N = 164 # full setMMLU_N = 100MMLU_SUBJECTS = ["abstract_algebra", "college_physics", "college_computer_science", "high_school_world_history", "clinical_knowledge", "professional_law"]COMMONSENSE_N = 100
RANDOM_SEED = 42
def _load_gsm8k(n=GSM8K_N, seed=RANDOM_SEED): """ Load the HARDER half of GSM8K test split. Stratification rationale: Qwen-Math-1.5B scores near 100% on easy GSM8K problems, leaving almost no incorrect examples for the probe to learn from. Taking only the harder half (by position in the test split, which correlates with reasoning depth) produces real correctness variance. """ ds = load_dataset("gsm8k", "main", split="test") total = len(ds) harder_half = ds.select(range(total // 2, total)) # back half = harder
random.seed(seed) indices = list(range(len(harder_half))) random.shuffle(indices) indices = indices[:n]
rows = [] for i in indices: r = harder_half[i] answer_key = r["answer"].split("####")[-1].strip().replace(",", "") rows.append({ "prompt_id": f"gsm8k_{total//2 + i}", "prompt": r["question"], "eval_name": "gsm8k", "dataset": "gsm8k", "answer_key": answer_key, }) return rows
def _load_humaneval(n=HUMANEVAL_N): """Load all HumanEval prompts. Scored via subprocess execution in score_answer.""" ds = load_dataset("openai_humaneval", split="test") rows = [] for i, r in enumerate(ds): if i >= n: break rows.append({ "prompt_id": f"humaneval_{r['task_id'].replace('/', '_')}", "prompt": r["prompt"], # function signature + docstring "eval_name": "humaneval", "dataset": "humaneval", "answer_key": r["canonical_solution"], "test_code": r["test"], # unit tests β needed for execution scoring "entry_point": r["entry_point"], }) return rows
def _load_mmlu(n=MMLU_N, subjects=MMLU_SUBJECTS, seed=RANDOM_SEED): """Load n prompts spread across deliberately diverse MMLU subjects.""" random.seed(seed) per_subject = max(1, n // len(subjects)) cmap = {0: "A", 1: "B", 2: "C", 3: "D"} rows = []
for subject in subjects: try: ds = load_dataset("cais/mmlu", subject, split="test") except Exception: continue indices = list(range(len(ds))) random.shuffle(indices) indices = indices[:per_subject]
for i in indices: r = ds[i] choices_text = "\n".join( f"{cmap[j]}. {c}" for j, c in enumerate(r["choices"]) ) prompt = f"{r['question']}\n{choices_text}\nAnswer with a single letter (A, B, C, or D):" rows.append({ "prompt_id": f"mmlu_{subject}_{i}", "prompt": prompt, "eval_name": f"mmlu-{subject}", "dataset": "mmlu", "answer_key": cmap[r["answer"]], }) return rows[:n]
def _load_commonsenseqa(n=COMMONSENSE_N, seed=RANDOM_SEED): """Load CommonsenseQA β domain with no specialist advantage (baseline).""" ds = load_dataset("tau/commonsense_qa", split="validation") random.seed(seed) indices = list(range(len(ds))) random.shuffle(indices) indices = indices[:n]
rows = [] for i in indices: r = ds[i] labels = r["choices"]["label"] texts = r["choices"]["text"] choices_text = "\n".join(f"{l}. {t}" for l, t in zip(labels, texts)) prompt = f"{r['question']}\n{choices_text}\nAnswer with a single letter:" rows.append({ "prompt_id": f"csqa_{r['id']}", "prompt": prompt, "eval_name": "commonsenseqa", "dataset": "commonsenseqa", "answer_key": r["answerKey"], }) return rows
def load_prompts(max_prompts=None, cache_dir=None, logger=None): """ Load all four domains directly from HuggingFace. Clean ground-truth answer keys throughout β no RouterBench, no reference-answer extraction.
Parameters ---------- max_prompts : int | None If set, stratified-cap the TOTAL across all four domains. Per-domain caps (GSM8K_N, HUMANEVAL_N, MMLU_N, COMMONSENSE_N) apply first regardless β this only trims further if max_prompts is smaller. cache_dir : Path | None Unused now (kept for CLI compatibility) β HuggingFace `datasets` manages its own cache under ~/.cache/huggingface. logger : logging.Logger | None
Returns ------- list of dicts: {prompt_id, prompt, eval_name, dataset, answer_key, ...} HumanEval rows additionally carry 'test_code' and 'entry_point'. """ import logging if logger is None: logger = logging.getLogger("load_prompts")
logger.info("Loading datasets directly from HuggingFace (no RouterBench)...")
prompts = []
logger.info(f" GSM8K (hard half, n={GSM8K_N})...") gsm8k_rows = _load_gsm8k() prompts.extend(gsm8k_rows) logger.info(f" β {len(gsm8k_rows)} prompts")
logger.info(f" HumanEval (n={HUMANEVAL_N})...") he_rows = _load_humaneval() prompts.extend(he_rows) logger.info(f" β {len(he_rows)} prompts")
logger.info(f" MMLU ({len(MMLU_SUBJECTS)} subjects, n={MMLU_N})...") mmlu_rows = _load_mmlu() prompts.extend(mmlu_rows) logger.info(f" β {len(mmlu_rows)} prompts")
logger.info(f" CommonsenseQA (n={COMMONSENSE_N})...") csqa_rows = _load_commonsenseqa() prompts.extend(csqa_rows) logger.info(f" β {len(csqa_rows)} prompts")
logger.info(f"Total loaded: {len(prompts):,} prompts")
# ββ Optional further cap (stratified across domains) βββββββββββββββββββββββ if max_prompts and len(prompts) > max_prompts: by_ds = {} for p in prompts: by_ds.setdefault(p["dataset"], []).append(p) per_ds = max(1, max_prompts // len(by_ds)) random.seed(RANDOM_SEED) prompts = [] for rows in by_ds.values(): random.shuffle(rows) prompts.extend(rows[:per_ds]) prompts = prompts[:max_prompts] logger.info(f"Capped to {len(prompts):,} prompts (stratified)")
# Log final counts per domain counts = {} for p in prompts: counts[p["dataset"]] = counts.get(p["dataset"], 0) + 1 for ds, n in sorted(counts.items()): logger.info(f" {ds}: {n:,}")
return prompts
# ββ Inference + feature extraction ββββββββββββββββββββββββββββββββββββββββββββ@torch.no_grad()def run_inference(model, tokenizer, prompt_text, model_key, device, dataset=None, max_new_tokens=128): """ Single forward pass + generation.
max_new_tokens is bumped to 256 for HumanEval β code solutions routinely exceed 128 tokens and silent truncation gets scored as incorrect, which biases HumanEval accuracy downward for no good reason.
Returns ------- response : str β decoded answer mean_log_prob : float β Feature A: avg log-prob of answer tokens first_tok_entropy : float β Feature B: entropy of first-token distribution last_hidden : np.ndarray β Feature C: last-layer last-token vector """ if dataset == "humaneval": max_new_tokens = max(max_new_tokens, 256) if model_key == "qwen25_math": # Qwen-Math uses chain-of-thought before outputting \boxed{answer}. # 128 tokens cuts off mid-reasoning before the answer appears. # Official model card uses max_new_tokens=512. max_new_tokens = max(max_new_tokens, 512)
formatted = build_prompt(prompt_text, tokenizer, model_key, dataset=dataset) inputs = tokenizer( formatted, return_tensors="pt", truncation=True, max_length=1024, return_attention_mask=True, # always return mask explicitly β # avoids the warning when pad_token==eos_token # (all Qwen models) and prevents incorrect # attention behaviour on padded sequences ) input_ids = inputs["input_ids"].to(device) attention_mask = inputs["attention_mask"].to(device) prompt_len = input_ids.shape[1]
out = model.generate( input_ids, attention_mask=attention_mask, # pass mask explicitly β required when # pad_token_id == eos_token_id so the # model knows which tokens are real input max_new_tokens=max_new_tokens, do_sample=False, # greedy β reproducible return_dict_in_generate=True, output_scores=True, # logits at each step β Features A & B output_hidden_states=True, # hidden states at each step β Feature C pad_token_id=tokenizer.pad_token_id, )
# ββ Decode answer ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ gen_ids = out.sequences[0, prompt_len:] response = tokenizer.decode(gen_ids, skip_special_tokens=True).strip()
# ββ Feature A: mean log-prob of generated tokens βββββββββββββββββββββββββββ if out.scores: log_probs = [] for step, score in enumerate(out.scores): if step >= len(gen_ids): break token_id = gen_ids[step].item() lp = torch.log_softmax(score[0], dim=-1)[token_id].item() log_probs.append(lp) mean_log_prob = float(sum(log_probs) / len(log_probs)) if log_probs else 0.0
# ββ Feature B: entropy of the first-token distribution βββββββββββββββββ first_dist = torch.softmax(out.scores[0][0], dim=-1) first_tok_entropy = float( -(first_dist * torch.log(first_dist + 1e-9)).sum().item() ) else: mean_log_prob, first_tok_entropy = 0.0, 0.0
# ββ Feature C: last-layer hidden state at the last generated token βββββββββ # out.hidden_states is a tuple of length n_generated_tokens. # Each element is a tuple of (n_layers+1) tensors, shape [1, seq_len, D]. # We take the final generation step β final layer β last token position. last_hidden = None if out.hidden_states: # Last generation step, last layer, last position final_step_hiddens = out.hidden_states[-1] # tuple of layer tensors last_layer_tensor = final_step_hiddens[-1] # [1, seq_len_at_step, D] last_hidden = last_layer_tensor[0, -1, :].cpu().float().numpy()
return response, mean_log_prob, first_tok_entropy, last_hidden
# ββ Main per-model loop ββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef run_model(model_key, prompts, batch_size, logger): model_id = MODELS[model_key] device = "cuda" if torch.cuda.is_available() else "cpu"
done_ids, _ = load_checkpoint(model_key) hs_store = HiddenStateStore(model_key) remaining = [p for p in prompts if p["prompt_id"] not in done_ids]
logger.info( f"Prompts total={len(prompts)} done={len(done_ids)} remaining={len(remaining)}" )
if not remaining: logger.info("Already complete β running finalise.") finalise(model_key, logger) return
use_4bit = USE_4BIT.get(model_key, True) trust_remote = TRUST_REMOTE_CODE.get(model_key, True) model, tokenizer = load_model(model_key, model_id, logger, use_4bit=use_4bit, trust_remote_code=trust_remote) errors = 0
for i, p in enumerate(tqdm(remaining, desc=model_key)): pid = p["prompt_id"] try: response, mean_log_prob, entropy, last_hidden = run_inference( model, tokenizer, p["prompt"], model_key, device, dataset=p["dataset"] ) # score_answer needs the full prompt dict (eval_name + answer_key, # plus test_code/entry_point for HumanEval) is_correct = score_answer(response, p)
# ββ Save scalar features to JSONL checkpoint βββββββββββββββββββββββ row = { "prompt_id": pid, "prompt": p["prompt"], "eval_name": p["eval_name"], "dataset": p["dataset"], "answer_key": p.get("answer_key", ""), "model_key": model_key, "model_id": model_id, "response": response, "is_correct": is_correct, "mean_log_prob": mean_log_prob, # Feature A "first_tok_entropy": entropy, # Feature B "timestamp": datetime.utcnow().isoformat(), } save_row(model_key, row)
# ββ Buffer hidden state separately βββββββββββββββββββββββββββββββββ if last_hidden is not None and not hs_store.already_saved(pid): hs_store.add(pid, last_hidden)
except Exception as e: errors += 1 logger.error(f"Error on {pid}: {e}\n{traceback.format_exc()}") if errors > 50: logger.error("Too many errors β stopping. Fix and resume.") break
# Flush hidden states and log every batch_size prompts if (i + 1) % batch_size == 0: hs_store.flush() done_now = len(done_ids) + i + 1 logger.info(f"Progress {done_now}/{len(prompts)} | errors={errors}")
hs_store.flush() # flush any remaining
del model if torch.cuda.is_available(): torch.cuda.empty_cache()
finalise(model_key, logger) logger.info(f"Finished {model_key}. Total errors: {errors}")
# ββ Entry point ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef main(): parser = argparse.ArgumentParser() parser.add_argument("--model", type=str, default=None, help=f"One of {list(MODELS.keys())} β omit to run all") parser.add_argument("--max_prompts", type=int, default=None, help="Cap prompts (200 for smoke test)") parser.add_argument("--batch_size", type=int, default=50, help="Prompts between progress logs and hidden-state flushes") parser.add_argument("--cache_dir", type=str, default=None, help="Unused β kept for CLI compatibility. HuggingFace " "datasets manages its own cache under " "~/.cache/huggingface/datasets") parser.add_argument("--reset", action="store_true", help="Delete existing checkpoint for the specified model " "and rerun from scratch. Use this when you have fixed " "the prompt format and need fresh results. " "Only deletes the checkpoint for --model, not all models.") args = parser.parse_args()
if args.reset and args.model: ckpt = ckpt_path(args.model) hidden = HIDDEN_DIR / f"{args.model}_hidden.npz" result = RESULTS_DIR / f"{args.model}_results.parquet" for p in [ckpt, hidden, result]: if p.exists(): p.unlink() print(f"Deleted: {p}") print(f"Checkpoint cleared for {args.model} β will rerun from scratch")
# Datasets are loaded fresh each run via HuggingFace `datasets`, which # caches downloads automatically β no manual pkl caching needed anymore. bootstrap_logger = get_logger("bootstrap") prompts = load_prompts( max_prompts=args.max_prompts, cache_dir=args.cache_dir, logger=bootstrap_logger, ) models_to_run = [args.model] if args.model else list(MODELS.keys())
for mk in models_to_run: if mk not in MODELS: print(f"Unknown model key '{mk}'. Valid: {list(MODELS.keys())}") continue logger = get_logger(mk) logger.info(f"=== Starting {mk} ===") run_model(mk, prompts, args.batch_size, logger)
print("\nDone. Results β", RESULTS_DIR) print("Hidden states β", HIDDEN_DIR)
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452"""Step 2a: Train Hidden-State Probe + Routing Evaluation======================================================Three logit-based routing signals β all extracted during Step 1, no sampling:
mean_log_prob [Feature A] β avg log-prob of answer tokens (zero training) neg_entropy [Feature B] β negated first-token entropy (zero training) probe_score [Feature C] β logistic probe on last hidden state (needs labels)
The probe (Feature C) is the only thing trained here.
Variant 2a (baseline): every probe is trained on the full cross-domain pool.See 02b_train_probes_specialist.py for the specialist-filtered variant.It uses is_correct labels (from clean ground-truth answer keys collectedin Step 1) as supervision β no sampling needed.
Baselines: random β pick a random expert per prompt oracle β always pick the correct expert (offline upper bound)
Run: python src/02a_train_probes.py [--skip_probe]
--skip_probe Evaluate only Features A and B (useful before all models finish)"""
import json, joblib, warnings, argparsefrom pathlib import Path
import numpy as npimport pandas as pdfrom sklearn.linear_model import LogisticRegressionfrom sklearn.decomposition import PCAfrom sklearn.model_selection import train_test_splitfrom sklearn.metrics import roc_auc_scoreimport matplotlibmatplotlib.use("Agg")import matplotlib.pyplot as plt
warnings.filterwarnings("ignore")
BASE_DIR = Path(__file__).resolve().parent.parent # project root (scripts live in src/)RESULTS_DIR = BASE_DIR / "results"CKPT_DIR = BASE_DIR / "checkpoints"HIDDEN_DIR = BASE_DIR / "hidden_states"MODEL_DIR = BASE_DIR / "trained_models"PLOTS_DIR = BASE_DIR / "plots"
for d in [MODEL_DIR, PLOTS_DIR]: d.mkdir(exist_ok=True)
MODELS = { "qwen25_1b": "Qwen/Qwen2.5-1.5B-Instruct", "qwen25_3b": "Qwen/Qwen2.5-3B-Instruct", "phi3_mini": "microsoft/Phi-3-mini-4k-instruct", "qwen25_math": "Qwen/Qwen2.5-Math-1.5B-Instruct", "qwen25_coder": "Qwen/Qwen2.5-Coder-1.5B-Instruct",}
# ββ Data loading βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef load_all_results(): """Combine Step 1 Parquet files into one long DataFrame.""" dfs = [] for f in RESULTS_DIR.glob("*_results.parquet"): dfs.append(pd.read_parquet(f)) if not dfs: raise FileNotFoundError( "No *_results.parquet found. Run 01_collect_data.py first." ) df = pd.concat(dfs, ignore_index=True) print(f"Loaded {len(df):,} rows | " f"{df['model_key'].nunique()} models | " f"{df['dataset'].nunique()} datasets")
# Sanity check: confirm logit features are present for col in ["mean_log_prob", "first_tok_entropy"]: if col not in df.columns: raise ValueError( f"Column '{col}' missing. Re-run 01_collect_data.py β " "old checkpoint files lack logit features." )
# Safety net: all four domains have clean ground-truth answer keys loaded # directly from HuggingFace, so is_correct should always be 0 or 1. This # filter just guards against any stray bad rows (e.g. a crashed/partial # HumanEval execution that returned something unexpected). before = len(df) df = df[df["is_correct"].isin([0, 1])].copy() dropped = before - len(df) if dropped: print(f" Dropped {dropped:,} rows with invalid is_correct values")
return df
def load_hidden_states(model_key): """ Load saved hidden-state vectors for one model. Returns (list[prompt_id], np.ndarray of shape [N, D]) or (None, None). """ path = HIDDEN_DIR / f"{model_key}_hidden.npz" if not path.exists(): print(f" [{model_key}] No hidden states found at {path} β probe skipped") return None, None data = np.load(path, allow_pickle=True) ids = data["prompt_ids"].tolist() vecs = data["vectors"].astype(np.float32) print(f" [{model_key}] Loaded {len(ids):,} hidden states shape={vecs.shape}") return ids, vecs
# ββ Train/eval split βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef make_split(results_df, train_frac=0.3, seed=42): """ Reserve train_frac of prompts for probe training. The remainder is the routing eval set. Stratified by dataset so all domains are represented in both splits. """ rng = np.random.default_rng(seed) train_ids = set()
for ds, grp in results_df.groupby("dataset"): unique = grp["prompt_id"].unique() n_train = max(1, int(len(unique) * train_frac)) chosen = rng.choice(unique, size=n_train, replace=False) train_ids.update(chosen.tolist())
train_df = results_df[results_df["prompt_id"].isin(train_ids)].copy() eval_df = results_df[~results_df["prompt_id"].isin(train_ids)].copy()
print(f"\nTrain split: {train_df['prompt_id'].nunique():,} prompts " f"({100*train_frac:.0f}% β used only for probe training)") print(f"Eval split: {eval_df['prompt_id'].nunique():,} prompts " f"(used for routing evaluation)\n") return train_ids, eval_df
# ββ Feature C: hidden-state probe βββββββββββββββββββββββββββββββββββββββββββββdef train_probe(model_key, train_ids, results_df): """ Train a logistic regression probe: last-layer hidden state β is_correct (binary)
Uses only the training split so the probe is never evaluated on the same prompts it was trained on.
Returns a dict {prompt_id: probe_score} for ALL prompts (train + eval), or None if insufficient data. """ ids, vecs = load_hidden_states(model_key) if ids is None: return None, None
# Labels: correctness from Step 1 results label_df = ( results_df[results_df["model_key"] == model_key] [["prompt_id", "is_correct"]] .drop_duplicates("prompt_id") .set_index("prompt_id") )
# ββ Train split only βββββββββββββββββββββββββββββββββββββββββββββββββββββββ id_to_idx = {pid: i for i, pid in enumerate(ids)} train_pids = [pid for pid in ids if pid in train_ids and pid in label_df.index]
if len(train_pids) < 30: print(f" [{model_key}] Too few training samples ({len(train_pids)}) β probe skipped") return None, None
X_train = vecs[[id_to_idx[p] for p in train_pids]] y_train = label_df.loc[train_pids, "is_correct"].values.astype(int)
# PCA: compress to 128 dims (avoids overfitting on small training sets) n_components = min(128, X_train.shape[0] - 1, X_train.shape[1]) pca = PCA(n_components=n_components) X_train_r = pca.fit_transform(X_train)
# Held-out validation inside the training split X_tr, X_val, y_tr, y_val = train_test_split( X_train_r, y_train, test_size=0.2, random_state=42 ) probe = LogisticRegression(max_iter=1000, C=1.0, class_weight="balanced") probe.fit(X_tr, y_tr)
if len(np.unique(y_val)) > 1: auroc = roc_auc_score(y_val, probe.predict_proba(X_val)[:, 1]) print(f" [{model_key}] Probe val AUROC={auroc:.3f} " f"n_train={len(X_tr)} n_val={len(X_val)}") else: auroc = float("nan") print(f" [{model_key}] Probe trained (AUROC undefined β single class in val)")
# Save artefacts joblib.dump({"pca": pca, "probe": probe}, MODEL_DIR / f"{model_key}_probe.pkl")
# ββ Score ALL prompt IDs (train + eval) ββββββββββββββββββββββββββββββββββββ # We score all of them but only use eval prompts during routing evaluation. all_pids = [pid for pid in ids if pid in label_df.index] X_all = pca.transform(vecs[[id_to_idx[p] for p in all_pids]]) scores_all = probe.predict_proba(X_all)[:, 1] probe_map = dict(zip(all_pids, scores_all.tolist()))
metrics = { "model_key": model_key, "probe_auroc": round(float(auroc), 4), "n_train": len(X_tr), "n_val": len(X_val), "pca_dims": n_components, "n_scored": len(probe_map), } return probe_map, metrics
# ββ Routing helpers ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef route_and_score(eval_df, signal_col): """ For each prompt in eval_df, pick the expert with the highest signal_col. Returns fraction of prompts answered correctly by the chosen expert. """ correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): valid = grp.dropna(subset=[signal_col]) if valid.empty: continue best = valid.loc[valid[signal_col].idxmax()] correct += int(best["is_correct"]) total += 1 return correct / total if total > 0 else float("nan")
def oracle_accuracy(eval_df): """Upper bound: always pick a correct expert if one exists.""" correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): correct += int(grp["is_correct"].max()) total += 1 return correct / total if total > 0 else float("nan")
def random_accuracy(eval_df, seed=42, n_runs=5): """Average accuracy across n_runs of random expert selection.""" rng = np.random.default_rng(seed) accs = [] for _ in range(n_runs): correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): chosen = grp.sample(1, random_state=int(rng.integers(1e6))) correct += int(chosen["is_correct"].values[0]) total += 1 accs.append(correct / total if total > 0 else 0.0) return float(np.mean(accs))
# ββ ECE & reliability diagram ββββββββββββββββββββββββββββββββββββββββββββββββββdef normalise_signal(series): """Min-max normalise to [0, 1] for ECE computation.""" lo, hi = series.min(), series.max() if hi == lo: return series * 0.0 return (series - lo) / (hi - lo)
def compute_ece(df, signal_col, n_bins=10): sub = df[["is_correct", signal_col]].dropna() if len(sub) < n_bins: return float("nan") norm = normalise_signal(sub[signal_col]) ece = 0.0 for lo in np.linspace(0, 1, n_bins + 1)[:-1]: hi = lo + 1 / n_bins mask = (norm >= lo) & (norm < hi) if mask.sum() == 0: continue acc = sub["is_correct"][mask].mean() conf = norm[mask].mean() ece += (mask.sum() / len(sub)) * abs(acc - conf) return round(float(ece), 4)
def plot_reliability(eval_df, signal_col, model_key, label, n_bins=10): sub = eval_df[["is_correct", signal_col]].dropna() if len(sub) < 50: return norm = normalise_signal(sub[signal_col]) bin_conf, bin_acc = [], [] for lo in np.linspace(0, 1, n_bins + 1)[:-1]: hi = lo + 1 / n_bins mask = (norm >= lo) & (norm < hi) if mask.sum() > 5: bin_conf.append(float(norm[mask].mean())) bin_acc.append(float(sub["is_correct"][mask].mean())) if not bin_conf: return plt.figure(figsize=(4.5, 4.5)) plt.plot([0, 1], [0, 1], "k--", alpha=0.4, label="Perfect calibration") plt.plot(bin_conf, bin_acc, "o-", label=label) plt.xlabel("Normalised signal (higher = more confident)") plt.ylabel("Fraction correct") plt.title(f"{model_key} | {label}") plt.legend(fontsize=8) plt.tight_layout() fname = f"reliability_{model_key}_{signal_col}.png" plt.savefig(PLOTS_DIR / fname, dpi=150) plt.close()
# ββ Main βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef main(): parser = argparse.ArgumentParser() parser.add_argument("--skip_probe", action="store_true", help="Skip probe training β evaluate only log_prob and entropy") args = parser.parse_args()
print("=== Step 2a: Train Probe + Evaluate Routing ===\n")
# 1. Load Step 1 results results_df = load_all_results()
# 2. Train/eval split β 30% for probe training, 70% for routing eval # 30% (not 20%) for probe training β dataset is smaller (~464 prompts) # than originally planned, so a larger training fraction is needed for # the probe to see enough variance per domain. train_ids, eval_df = make_split(results_df, train_frac=0.3)
# 3. Add neg_entropy column β higher = less uncertain = prefer this expert eval_df = eval_df.copy() results_df = results_df.copy() eval_df["neg_entropy"] = -eval_df["first_tok_entropy"] results_df["neg_entropy"] = -results_df["first_tok_entropy"]
# 4. Train one hidden-state probe per model (Feature C) probe_metrics = [] probe_score_map = {} # {model_key: {prompt_id: score}}
if not args.skip_probe: print("ββ Training hidden-state probes (Feature C) ββββββββββ") for mk in MODELS: result = train_probe(mk, train_ids, results_df) if result[0] is not None: probe_map, metrics = result probe_score_map[mk] = probe_map probe_metrics.append(metrics)
if probe_metrics: probe_df = pd.DataFrame(probe_metrics) probe_df.to_csv(RESULTS_DIR / "probe_metrics.csv", index=False) print(f"\n{probe_df.to_string(index=False)}\n")
# Attach probe scores to eval_df eval_df["probe_score"] = eval_df.apply( lambda r: probe_score_map.get(r["model_key"], {}).get(r["prompt_id"], np.nan), axis=1, ) else: print("Skipping probe training (--skip_probe set)\n") eval_df["probe_score"] = np.nan
# 5. Routing evaluation print("ββ Routing accuracy ββββββββββββββββββββββββββββββββββ")
signals = { "random": None, "log_prob": "mean_log_prob", # Feature A "neg_entropy": "neg_entropy", # Feature B "probe_score": "probe_score", # Feature C "oracle": None, }
routing_results = {} routing_results["random"] = random_accuracy(eval_df) routing_results["oracle"] = oracle_accuracy(eval_df)
for name, col in signals.items(): if col is None: continue if col not in eval_df.columns or eval_df[col].isna().all(): routing_results[name] = float("nan") else: routing_results[name] = route_and_score(eval_df, col)
# Print results table print(f"\n {'Signal':<18} {'Source':<35} {'Accuracy':>9}") print(" " + "β" * 64) descriptions = { "random": "Random expert selection", "log_prob": "Avg log-prob of answer tokens [A]", "neg_entropy": "Negated first-token entropy [B]", "probe_score": "Hidden-state logistic probe [C]", "oracle": "Oracle (best expert, offline)", } for name, acc in routing_results.items(): acc_str = f"{acc:.4f}" if not np.isnan(acc) else " n/a" print(f" {name:<18} {descriptions[name]:<35} {acc_str:>9}")
pd.DataFrame([routing_results]).to_csv( RESULTS_DIR / "routing_results.csv", index=False )
# 6. ECE per model per signal print("\nββ ECE per model βββββββββββββββββββββββββββββββββββββ") ece_rows = [] for mk in MODELS: sub = eval_df[eval_df["model_key"] == mk] row = {"model_key": mk} for sig, lbl in [("mean_log_prob", "log_prob"), ("neg_entropy", "neg_entropy"), ("probe_score", "probe")]: row[f"ece_{lbl}"] = compute_ece(sub, sig) plot_reliability(sub, sig, mk, lbl) ece_rows.append(row)
ece_df = pd.DataFrame(ece_rows) ece_df.to_csv(RESULTS_DIR / "ece_results.csv", index=False) print(ece_df.to_string(index=False))
# 7. Per-dataset routing breakdown print("\nββ Per-dataset breakdown βββββββββββββββββββββββββββββ") ds_rows = [] for ds in sorted(eval_df["dataset"].unique()): sub = eval_df[eval_df["dataset"] == ds] ds_rows.append({ "dataset": ds, "n_prompts": sub["prompt_id"].nunique(), "random": round(random_accuracy(sub), 4), "log_prob": round(route_and_score(sub, "mean_log_prob"), 4), "neg_entropy": round(route_and_score(sub, "neg_entropy"), 4), "probe_score": round(route_and_score(sub, "probe_score"), 4) if eval_df["probe_score"].notna().any() else float("nan"), "oracle": round(oracle_accuracy(sub), 4), })
ds_df = pd.DataFrame(ds_rows) ds_df.to_csv(RESULTS_DIR / "per_dataset_routing.csv", index=False) print(ds_df.to_string(index=False))
# 8. Per-model probe AUROC summary (if probe was run) if probe_metrics: print("\nββ Probe AUROC per model βββββββββββββββββββββββββββββ") print(pd.DataFrame(probe_metrics)[ ["model_key", "probe_auroc", "n_train", "pca_dims"] ].to_string(index=False))
print(f"\nβ Routing results β {RESULTS_DIR / 'routing_results.csv'}") print(f"β ECE results β {RESULTS_DIR / 'ece_results.csv'}") print(f"β Per-dataset β {RESULTS_DIR / 'per_dataset_routing.csv'}") print(f"β Reliability plots β {PLOTS_DIR}")
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485"""Step 2b: Train Hidden-State Probe + Routing Evaluation (specialist-filtered)======================================================Three logit-based routing signals β all extracted during Step 1, no sampling:
mean_log_prob [Feature A] β avg log-prob of answer tokens (zero training) neg_entropy [Feature B] β negated first-token entropy (zero training) probe_score [Feature C] β logistic probe on last hidden state (needs labels)
The probe (Feature C) is the only thing trained here.
Variant 2b: identical to 02a_train_probes.py except that the math and coderprobes are trained on in-domain prompts only (see SPECIALIST_DOMAINS), andprobe_metrics.csv gains a `domain_filter` column. It writes to the sameresults/ and trained_models/ files as 02a, so run one or the other.It uses is_correct labels (from clean ground-truth answer keys collectedin Step 1) as supervision β no sampling needed.
Baselines: random β pick a random expert per prompt oracle β always pick the correct expert (offline upper bound)
Run: python src/02b_train_probes_specialist.py [--skip_probe]
--skip_probe Evaluate only Features A and B (useful before all models finish)"""
import json, joblib, warnings, argparsefrom pathlib import Path
import numpy as npimport pandas as pdfrom sklearn.linear_model import LogisticRegressionfrom sklearn.decomposition import PCAfrom sklearn.model_selection import train_test_splitfrom sklearn.metrics import roc_auc_scoreimport matplotlibmatplotlib.use("Agg")import matplotlib.pyplot as plt
warnings.filterwarnings("ignore")
BASE_DIR = Path(__file__).resolve().parent.parent # project root (scripts live in src/)RESULTS_DIR = BASE_DIR / "results"CKPT_DIR = BASE_DIR / "checkpoints"HIDDEN_DIR = BASE_DIR / "hidden_states"MODEL_DIR = BASE_DIR / "trained_models"PLOTS_DIR = BASE_DIR / "plots"
for d in [MODEL_DIR, PLOTS_DIR]: d.mkdir(exist_ok=True)
MODELS = { "qwen25_1b": "Qwen/Qwen2.5-1.5B-Instruct", "qwen25_3b": "Qwen/Qwen2.5-3B-Instruct", "phi3_mini": "microsoft/Phi-3-mini-4k-instruct", "qwen25_math": "Qwen/Qwen2.5-Math-1.5B-Instruct", "qwen25_coder": "Qwen/Qwen2.5-Coder-1.5B-Instruct",}
# Specialist models are trained on in-domain prompts only.# Previously probes were trained on the full cross-domain pool, giving# specialists ~80% positive labels (they're almost always wrong outside# their domain) and almost no negative examples to learn from.# Filtering to the specialist's own domain restores real class variance.SPECIALIST_DOMAINS = { "qwen25_math": "gsm8k", "qwen25_coder": "humaneval",}
# ββ Data loading βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef load_all_results(): """Combine Step 1 Parquet files into one long DataFrame.""" dfs = [] for f in RESULTS_DIR.glob("*_results.parquet"): dfs.append(pd.read_parquet(f)) if not dfs: raise FileNotFoundError( "No *_results.parquet found. Run 01_collect_data.py first." ) df = pd.concat(dfs, ignore_index=True) print(f"Loaded {len(df):,} rows | " f"{df['model_key'].nunique()} models | " f"{df['dataset'].nunique()} datasets")
# Sanity check: confirm logit features are present for col in ["mean_log_prob", "first_tok_entropy"]: if col not in df.columns: raise ValueError( f"Column '{col}' missing. Re-run 01_collect_data.py β " "old checkpoint files lack logit features." )
# Safety net: all four domains have clean ground-truth answer keys loaded # directly from HuggingFace, so is_correct should always be 0 or 1. This # filter just guards against any stray bad rows (e.g. a crashed/partial # HumanEval execution that returned something unexpected). before = len(df) df = df[df["is_correct"].isin([0, 1])].copy() dropped = before - len(df) if dropped: print(f" Dropped {dropped:,} rows with invalid is_correct values")
return df
def load_hidden_states(model_key): """ Load saved hidden-state vectors for one model. Returns (list[prompt_id], np.ndarray of shape [N, D]) or (None, None). """ path = HIDDEN_DIR / f"{model_key}_hidden.npz" if not path.exists(): print(f" [{model_key}] No hidden states found at {path} β probe skipped") return None, None data = np.load(path, allow_pickle=True) ids = data["prompt_ids"].tolist() vecs = data["vectors"].astype(np.float32) print(f" [{model_key}] Loaded {len(ids):,} hidden states shape={vecs.shape}") return ids, vecs
# ββ Train/eval split ββββββββββββββββββββββββββββββββββββββββββββββοΏ½οΏ½ββββββββββββdef make_split(results_df, train_frac=0.3, seed=42): """ Reserve train_frac of prompts for probe training. The remainder is the routing eval set. Stratified by dataset so all domains are represented in both splits. """ rng = np.random.default_rng(seed) train_ids = set()
for ds, grp in results_df.groupby("dataset"): unique = grp["prompt_id"].unique() n_train = max(1, int(len(unique) * train_frac)) chosen = rng.choice(unique, size=n_train, replace=False) train_ids.update(chosen.tolist())
train_df = results_df[results_df["prompt_id"].isin(train_ids)].copy() eval_df = results_df[~results_df["prompt_id"].isin(train_ids)].copy()
print(f"\nTrain split: {train_df['prompt_id'].nunique():,} prompts " f"({100*train_frac:.0f}% β used only for probe training)") print(f"Eval split: {eval_df['prompt_id'].nunique():,} prompts " f"(used for routing evaluation)\n") return train_ids, eval_df
# ββ Feature C: hidden-state probe βββββββββββββββββββββββββββββββββββββββββββββdef train_probe(model_key, train_ids, results_df): """ Train a logistic regression probe: last-layer hidden state β is_correct (binary)
Uses only the training split so the probe is never evaluated on the same prompts it was trained on.
Returns a dict {prompt_id: probe_score} for ALL prompts (train + eval), or None if insufficient data. """ ids, vecs = load_hidden_states(model_key) if ids is None: return None, None
# Labels: correctness from Step 1 results label_df = ( results_df[results_df["model_key"] == model_key] [["prompt_id", "is_correct"]] .drop_duplicates("prompt_id") .set_index("prompt_id") )
# ββ Train split only βββββββββββββββββββββββββββββββββββββββββββββββββββββββ id_to_idx = {pid: i for i, pid in enumerate(ids)} train_pids = [pid for pid in ids if pid in train_ids and pid in label_df.index]
# For specialist models restrict probe training to in-domain prompts only. # This fixes the class-imbalance problem: specialists score ~100% outside # their domain (correct trivially on non-specialist questions they happen to # get right, and wrong on everything else), leaving the global training pool # with almost no negative examples. Filtering to the specialist's own domain # gives real correctness variance for the probe to learn from. domain_filter = SPECIALIST_DOMAINS.get(model_key) if domain_filter: in_domain_ids = set( results_df.loc[ (results_df["model_key"] == model_key) & (results_df["dataset"] == domain_filter), "prompt_id", ].unique() ) train_pids = [pid for pid in train_pids if pid in in_domain_ids] print(f" [{model_key}] specialist filter β '{domain_filter}': " f"{len(train_pids)} in-domain training prompts " f"(cross-domain training disabled)")
if len(train_pids) < 30: print(f" [{model_key}] Too few training samples ({len(train_pids)}) β probe skipped") return None, None
X_train = vecs[[id_to_idx[p] for p in train_pids]] y_train = label_df.loc[train_pids, "is_correct"].values.astype(int)
# PCA: compress to 128 dims (avoids overfitting on small training sets) n_components = min(128, X_train.shape[0] - 1, X_train.shape[1]) pca = PCA(n_components=n_components) X_train_r = pca.fit_transform(X_train)
# Held-out validation inside the training split X_tr, X_val, y_tr, y_val = train_test_split( X_train_r, y_train, test_size=0.2, random_state=42 ) probe = LogisticRegression(max_iter=1000, C=1.0, class_weight="balanced") probe.fit(X_tr, y_tr)
if len(np.unique(y_val)) > 1: auroc = roc_auc_score(y_val, probe.predict_proba(X_val)[:, 1]) print(f" [{model_key}] Probe val AUROC={auroc:.3f} " f"n_train={len(X_tr)} n_val={len(X_val)}") else: auroc = float("nan") print(f" [{model_key}] Probe trained (AUROC undefined β single class in val)")
# Save artefacts joblib.dump({"pca": pca, "probe": probe}, MODEL_DIR / f"{model_key}_probe.pkl")
# ββ Score ALL prompt IDs (train + eval) ββββββββββββββββββββββββββββββββββββ # We score all of them but only use eval prompts during routing evaluation. all_pids = [pid for pid in ids if pid in label_df.index] X_all = pca.transform(vecs[[id_to_idx[p] for p in all_pids]]) scores_all = probe.predict_proba(X_all)[:, 1] probe_map = dict(zip(all_pids, scores_all.tolist()))
metrics = { "model_key": model_key, "probe_auroc": round(float(auroc), 4), "n_train": len(X_tr), "n_val": len(X_val), "pca_dims": n_components, "n_scored": len(probe_map), "domain_filter": domain_filter if domain_filter else "all", } return probe_map, metrics
# ββ Routing helpers ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef route_and_score(eval_df, signal_col): """ For each prompt in eval_df, pick the expert with the highest signal_col. Returns fraction of prompts answered correctly by the chosen expert. """ correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): valid = grp.dropna(subset=[signal_col]) if valid.empty: continue best = valid.loc[valid[signal_col].idxmax()] correct += int(best["is_correct"]) total += 1 return correct / total if total > 0 else float("nan")
def oracle_accuracy(eval_df): """Upper bound: always pick a correct expert if one exists.""" correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): correct += int(grp["is_correct"].max()) total += 1 return correct / total if total > 0 else float("nan")
def random_accuracy(eval_df, seed=42, n_runs=5): """Average accuracy across n_runs of random expert selection.""" rng = np.random.default_rng(seed) accs = [] for _ in range(n_runs): correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): chosen = grp.sample(1, random_state=int(rng.integers(1e6))) correct += int(chosen["is_correct"].values[0]) total += 1 accs.append(correct / total if total > 0 else 0.0) return float(np.mean(accs))
# ββ ECE & reliability diagram ββββββββββββββββββββββββββββββββββββββββββββββββββdef normalise_signal(series): """Min-max normalise to [0, 1] for ECE computation.""" lo, hi = series.min(), series.max() if hi == lo: return series * 0.0 return (series - lo) / (hi - lo)
def compute_ece(df, signal_col, n_bins=10): sub = df[["is_correct", signal_col]].dropna() if len(sub) < n_bins: return float("nan") norm = normalise_signal(sub[signal_col]) ece = 0.0 for lo in np.linspace(0, 1, n_bins + 1)[:-1]: hi = lo + 1 / n_bins mask = (norm >= lo) & (norm < hi) if mask.sum() == 0: continue acc = sub["is_correct"][mask].mean() conf = norm[mask].mean() ece += (mask.sum() / len(sub)) * abs(acc - conf) return round(float(ece), 4)
def plot_reliability(eval_df, signal_col, model_key, label, n_bins=10): sub = eval_df[["is_correct", signal_col]].dropna() if len(sub) < 50: return norm = normalise_signal(sub[signal_col]) bin_conf, bin_acc = [], [] for lo in np.linspace(0, 1, n_bins + 1)[:-1]: hi = lo + 1 / n_bins mask = (norm >= lo) & (norm < hi) if mask.sum() > 5: bin_conf.append(float(norm[mask].mean())) bin_acc.append(float(sub["is_correct"][mask].mean())) if not bin_conf: return plt.figure(figsize=(4.5, 4.5)) plt.plot([0, 1], [0, 1], "k--", alpha=0.4, label="Perfect calibration") plt.plot(bin_conf, bin_acc, "o-", label=label) plt.xlabel("Normalised signal (higher = more confident)") plt.ylabel("Fraction correct") plt.title(f"{model_key} | {label}") plt.legend(fontsize=8) plt.tight_layout() fname = f"reliability_{model_key}_{signal_col}.png" plt.savefig(PLOTS_DIR / fname, dpi=150) plt.close()
# ββ Main βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef main(): parser = argparse.ArgumentParser() parser.add_argument("--skip_probe", action="store_true", help="Skip probe training β evaluate only log_prob and entropy") args = parser.parse_args()
print("=== Step 2b: Train Probe + Evaluate Routing ===\n")
# 1. Load Step 1 results results_df = load_all_results()
# 2. Train/eval split β 30% for probe training, 70% for routing eval # 30% (not 20%) for probe training β dataset is smaller (~464 prompts) # than originally planned, so a larger training fraction is needed for # the probe to see enough variance per domain. train_ids, eval_df = make_split(results_df, train_frac=0.3)
# 3. Add neg_entropy column β higher = less uncertain = prefer this expert eval_df = eval_df.copy() results_df = results_df.copy() eval_df["neg_entropy"] = -eval_df["first_tok_entropy"] results_df["neg_entropy"] = -results_df["first_tok_entropy"]
# 4. Train one hidden-state probe per model (Feature C) probe_metrics = [] probe_score_map = {} # {model_key: {prompt_id: score}}
if not args.skip_probe: print("ββ Training hidden-state probes (Feature C) ββββββββββ") for mk in MODELS: result = train_probe(mk, train_ids, results_df) if result[0] is not None: probe_map, metrics = result probe_score_map[mk] = probe_map probe_metrics.append(metrics)
if probe_metrics: probe_df = pd.DataFrame(probe_metrics) probe_df.to_csv(RESULTS_DIR / "probe_metrics.csv", index=False) print(f"\n{probe_df.to_string(index=False)}\n")
# Attach probe scores to eval_df eval_df["probe_score"] = eval_df.apply( lambda r: probe_score_map.get(r["model_key"], {}).get(r["prompt_id"], np.nan), axis=1, ) else: print("Skipping probe training (--skip_probe set)\n") eval_df["probe_score"] = np.nan
# 5. Routing evaluation print("ββ Routing accuracy ββββββββββββββββββββββββββββββββββ")
signals = { "random": None, "log_prob": "mean_log_prob", # Feature A "neg_entropy": "neg_entropy", # Feature B "probe_score": "probe_score", # Feature C "oracle": None, }
routing_results = {} routing_results["random"] = random_accuracy(eval_df) routing_results["oracle"] = oracle_accuracy(eval_df)
for name, col in signals.items(): if col is None: continue if col not in eval_df.columns or eval_df[col].isna().all(): routing_results[name] = float("nan") else: routing_results[name] = route_and_score(eval_df, col)
# Print results table print(f"\n {'Signal':<18} {'Source':<35} {'Accuracy':>9}") print(" " + "β" * 64) descriptions = { "random": "Random expert selection", "log_prob": "Avg log-prob of answer tokens [A]", "neg_entropy": "Negated first-token entropy [B]", "probe_score": "Hidden-state logistic probe [C]", "oracle": "Oracle (best expert, offline)", } for name, acc in routing_results.items(): acc_str = f"{acc:.4f}" if not np.isnan(acc) else " n/a" print(f" {name:<18} {descriptions[name]:<35} {acc_str:>9}")
pd.DataFrame([routing_results]).to_csv( RESULTS_DIR / "routing_results.csv", index=False )
# 6. ECE per model per signal print("\nββ ECE per model βββββββββββββββββββββββββββββββββββββ") ece_rows = [] for mk in MODELS: sub = eval_df[eval_df["model_key"] == mk] row = {"model_key": mk} for sig, lbl in [("mean_log_prob", "log_prob"), ("neg_entropy", "neg_entropy"), ("probe_score", "probe")]: row[f"ece_{lbl}"] = compute_ece(sub, sig) plot_reliability(sub, sig, mk, lbl) ece_rows.append(row)
ece_df = pd.DataFrame(ece_rows) ece_df.to_csv(RESULTS_DIR / "ece_results.csv", index=False) print(ece_df.to_string(index=False))
# 7. Per-dataset routing breakdown print("\nββ Per-dataset breakdown βββββββββββββββββββββββββββββ") ds_rows = [] for ds in sorted(eval_df["dataset"].unique()): sub = eval_df[eval_df["dataset"] == ds] ds_rows.append({ "dataset": ds, "n_prompts": sub["prompt_id"].nunique(), "random": round(random_accuracy(sub), 4), "log_prob": round(route_and_score(sub, "mean_log_prob"), 4), "neg_entropy": round(route_and_score(sub, "neg_entropy"), 4), "probe_score": round(route_and_score(sub, "probe_score"), 4) if eval_df["probe_score"].notna().any() else float("nan"), "oracle": round(oracle_accuracy(sub), 4), })
ds_df = pd.DataFrame(ds_rows) ds_df.to_csv(RESULTS_DIR / "per_dataset_routing.csv", index=False) print(ds_df.to_string(index=False))
# 8. Per-model probe AUROC summary (if probe was run) if probe_metrics: print("\nββ Probe AUROC per model βββββββββββββββββββββββββββββ") print(pd.DataFrame(probe_metrics)[ ["model_key", "probe_auroc", "n_train", "pca_dims"] ].to_string(index=False))
print(f"\nβ Routing results β {RESULTS_DIR / 'routing_results.csv'}") print(f"β ECE results οΏ½οΏ½οΏ½ {RESULTS_DIR / 'ece_results.csv'}") print(f"β Per-dataset β {RESULTS_DIR / 'per_dataset_routing.csv'}") print(f"β Reliability plots β {PLOTS_DIR}")
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664"""03_domain_aware_router.py=========================Domain-aware ensemble router that exploits the complementary failure modesidentified in Step 2:
probe_score wins on specialist domains (gsm8k, humaneval) log_prob wins on generalist domains (mmlu, commonsenseqa)
Routing logic------------- 1. Classify the incoming prompt into a domain. 2. If domain β SPECIALIST_DOMAINS β route using probe_score If domain β GENERALIST_DOMAINS β route using mean_log_prob
Two domain classification modes (--domain_mode):
"label" Use ground-truth dataset column (upper bound β shows how good domain-aware routing could be with perfect domain knowledge).
"predict" Train a TF-IDF + LogisticRegression domain classifier on the prompt text, then use its predictions at routing time. This is the realistic deployment scenario where domain labels are unknown.
Outputs------- results/domain_aware_routing.csv β full comparison table results/domain_classifier.csv β domain classifier accuracy (predict mode) trained_models/domain_clf.pkl β saved domain classifier (predict mode)
Run after 02a_train_probes.py (needs *_results.parquet + *_probe.pkl).
Usage----- # Realistic mode (text classifier): python src/03_domain_aware_router.py
# Oracle domain mode (upper bound): python src/03_domain_aware_router.py --domain_mode label
# If your prompt text is in a column other than 'eval_name': python src/03_domain_aware_router.py --text_col prompt"""
import argparseimport warningsfrom pathlib import Path
import joblibimport numpy as npimport pandas as pdfrom sklearn.linear_model import LogisticRegressionfrom sklearn.feature_extraction.text import TfidfVectorizerfrom sklearn.metrics import accuracy_score, classification_reportfrom sklearn.model_selection import cross_val_score
warnings.filterwarnings("ignore")
# ββ Paths (match 01/03 layout) ββββββββββββββββββββββββββββββββββββββββββββββββ
BASE_DIR = Path(__file__).resolve().parent.parent # project root (scripts live in src/)RESULTS_DIR = BASE_DIR / "results"HIDDEN_DIR = BASE_DIR / "hidden_states"MODEL_DIR = BASE_DIR / "trained_models"
# ββ Configuration βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MODELS = [ "qwen25_1b", "qwen25_3b", "phi3_mini", "qwen25_math", "qwen25_coder",]
# Routing signal assigned to each domain.# Derived from per_dataset_routing results in Step 2:# gsm8k β probe_score (0.829 vs 0.814 log_prob)# humaneval β probe_score (0.530 vs 0.504 log_prob)# commonsenseqaβ mean_log_prob (0.800 vs 0.757 probe)# mmlu β mean_log_prob (0.574 vs 0.471 probe)DOMAIN_SIGNAL = { "gsm8k": "probe_score", "humaneval": "probe_score", "commonsenseqa": "mean_log_prob", "mmlu": "mean_log_prob",}
# For specialist domains using probe_score, a generalist must beat the# specialist probe score by at least this margin to trigger a defection.# Motivation: on humaneval the probe correctly senses hard problems but# defects to generalists who score only 15.6% on those problems β worse# than the specialist would have. A threshold stops low-confidence defections.# gsm8k: 0.0 β defection accuracy was 73.7% (healthy, no guard needed)# humaneval: 0.15 β defection accuracy was 15.6% (broken, guard required)# Sweep values: [0.0, 0.05, 0.10, 0.15, 0.20, 0.25] on eval split# and pick the one that maximises humaneval routing accuracy.DEFECTION_THRESHOLD = { "gsm8k": 0.0, "humaneval": 0.15,}
# The designated specialist for each domain using probe_score routing.# Used by defection threshold logic to identify the incumbent specialist.DOMAIN_SPECIALIST = { "gsm8k": "qwen25_math", "humaneval": "qwen25_coder",}
# Column in the results parquet that holds the raw prompt text.# Change this if your parquet uses a different name (e.g. "prompt", "question").DEFAULT_TEXT_COL = "eval_name"
# Probe training split fraction β must match 02a_train_probes.pyTRAIN_FRAC = 0.30RANDOM_SEED = 42
# ββ Data loading ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def load_all_results() -> pd.DataFrame: """Load and combine all *_results.parquet files.""" dfs = [] for f in sorted(RESULTS_DIR.glob("*_results.parquet")): dfs.append(pd.read_parquet(f)) if not dfs: raise FileNotFoundError( "No *_results.parquet found in results/. " "Run 01_collect_data.py first." ) df = pd.concat(dfs, ignore_index=True) df["neg_entropy"] = -df["first_tok_entropy"] print( f"Loaded {len(df):,} rows | " f"{df['model_key'].nunique()} models | " f"datasets: {sorted(df['dataset'].unique())}" ) return df
def make_split(df: pd.DataFrame): """ Reproduce the same train/eval split as 02a_train_probes.py. Uses identical seed and stratification so probe scores are never evaluated on prompts the probe was trained on. """ rng = np.random.default_rng(RANDOM_SEED) train_ids = set() for ds, grp in df.groupby("dataset"): unique = grp["prompt_id"].unique() n = max(1, int(len(unique) * TRAIN_FRAC)) train_ids.update(rng.choice(unique, size=n, replace=False).tolist()) eval_df = df[~df["prompt_id"].isin(train_ids)].copy() train_df = df[df["prompt_id"].isin(train_ids)].copy() print( f"Split β train: {train_df['prompt_id'].nunique()} prompts | " f"eval: {eval_df['prompt_id'].nunique()} prompts" ) return train_df, eval_df
# ββ Probe scores ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def attach_probe_scores(eval_df: pd.DataFrame) -> pd.DataFrame: """ Load saved probe pkl files from Step 2 and score eval prompts. Adds a 'probe_score' column to eval_df. """ eval_df = eval_df.copy() eval_df["probe_score"] = np.nan
for model_key in MODELS: pkl_path = MODEL_DIR / f"{model_key}_probe.pkl" npz_path = HIDDEN_DIR / f"{model_key}_hidden.npz"
if not pkl_path.exists(): print(f" [{model_key}] No probe pkl found β probe_score will be NaN") continue if not npz_path.exists(): print(f" [{model_key}] No hidden states found β probe_score will be NaN") continue
artefact = joblib.load(pkl_path) pca = artefact["pca"] probe = artefact["probe"]
data = np.load(npz_path, allow_pickle=True) ids = data["prompt_ids"].tolist() vecs = data["vectors"].astype(np.float32) id_to_idx = {pid: i for i, pid in enumerate(ids)}
mask = eval_df["model_key"] == model_key pids = eval_df.loc[mask, "prompt_id"].tolist() present = [(pid, id_to_idx[pid]) for pid in pids if pid in id_to_idx]
if not present: continue
sel_pids, sel_idxs = zip(*present) X = pca.transform(vecs[list(sel_idxs)]) scores = probe.predict_proba(X)[:, 1]
score_series = pd.Series(dict(zip(sel_pids, scores))) update_idx = eval_df.loc[mask, "prompt_id"].map(score_series) eval_df.loc[update_idx.index, "probe_score"] = update_idx.values
print(f" [{model_key}] probe scores attached ({len(sel_pids)} prompts)")
return eval_df
# ββ Domain classifier βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def train_domain_classifier( train_df: pd.DataFrame, text_col: str,) -> tuple: """ Train a TF-IDF + LogisticRegression domain classifier.
Input: one row per (prompt, model) β we deduplicate to one row per prompt. Target: dataset label (gsm8k / humaneval / commonsenseqa / mmlu).
Returns (vectorizer, classifier). """ # One row per prompt (text and label are the same across models) prompt_df = ( train_df[[text_col, "dataset"]] .drop_duplicates(subset=[text_col]) .dropna(subset=[text_col]) )
if len(prompt_df) < 20: raise ValueError( f"Only {len(prompt_df)} unique training prompts found. " f"Check that '{text_col}' is the correct text column " f"(use --text_col to override)." )
X_text = prompt_df[text_col].astype(str).tolist() y = prompt_df["dataset"].tolist()
vec = TfidfVectorizer( ngram_range=(1, 2), max_features=5000, sublinear_tf=True, strip_accents="unicode", ) clf = LogisticRegression(max_iter=1000, C=5.0, random_state=RANDOM_SEED)
X = vec.fit_transform(X_text)
# Cross-val on training data cv_scores = cross_val_score(clf, X, y, cv=5, scoring="accuracy") print( f" Domain classifier 5-fold CV accuracy: " f"{cv_scores.mean():.3f} Β± {cv_scores.std():.3f}" )
clf.fit(X, y) joblib.dump({"vec": vec, "clf": clf}, MODEL_DIR / "domain_clf.pkl") return vec, clf
def predict_domains( vec, clf, df: pd.DataFrame, text_col: str,) -> pd.Series: """ Returns a Series mapping prompt_id β predicted domain label. """ # One row per prompt prompt_df = ( df[["prompt_id", text_col]] .drop_duplicates(subset=["prompt_id"]) .dropna(subset=[text_col]) ) X = vec.transform(prompt_df[text_col].astype(str).tolist()) preds = clf.predict(X) return pd.Series(dict(zip(prompt_df["prompt_id"].tolist(), preds)))
# ββ Routing helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def route_single_signal(eval_df: pd.DataFrame, signal_col: str) -> float: """Standard single-signal router: pick the model with highest signal.""" correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): valid = grp.dropna(subset=[signal_col]) if valid.empty: continue best = valid.loc[valid[signal_col].idxmax()] correct += int(best["is_correct"]) total += 1 return correct / total if total > 0 else float("nan")
def route_oracle(eval_df: pd.DataFrame) -> float: """Upper bound: pick a correct expert whenever one exists.""" correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): correct += int(grp["is_correct"].max()) total += 1 return correct / total if total > 0 else float("nan")
def route_random(eval_df: pd.DataFrame, n_runs: int = 5) -> float: """Average accuracy of random expert selection over n_runs.""" rng = np.random.default_rng(RANDOM_SEED) accs = [] for _ in range(n_runs): correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): chosen = grp.sample(1, random_state=int(rng.integers(1e6))) correct += int(chosen["is_correct"].values[0]) total += 1 accs.append(correct / total if total else 0.0) return float(np.mean(accs))
def route_domain_aware( eval_df: pd.DataFrame, domain_col: str, # column holding the domain label for each row) -> tuple[float, dict]: """ Domain-aware router.
For each prompt: 1. Read its domain from domain_col. 2. Look up which signal to use from DOMAIN_SIGNAL. 3. Pick the model with the highest value of that signal.
Returns (overall_accuracy, per_domain_accuracy_dict). """ correct, total = 0, 0 per_domain: dict[str, list] = {}
for pid, grp in eval_df.groupby("prompt_id"): domain = grp[domain_col].iloc[0] signal = DOMAIN_SIGNAL.get(domain, "mean_log_prob") threshold = DEFECTION_THRESHOLD.get(domain, 0.0) specialist = DOMAIN_SPECIALIST.get(domain)
valid = grp.dropna(subset=[signal]) if valid.empty: continue
if threshold > 0.0 and specialist is not None: # Defection guard: only route away from the specialist if a # generalist beats its probe score by at least `threshold`. # Prevents defecting to weaker generalists on hard problems # where the specialist, though uncertain, is still the best bet. spec_row = valid[valid["model_key"] == specialist] if not spec_row.empty: spec_score = spec_row[signal].values[0] alts = valid[valid["model_key"] != specialist] best_alt_score = alts[signal].max() if not alts.empty else -np.inf if best_alt_score - spec_score >= threshold: # Generalist beats specialist by enough β defect best = valid.loc[valid[signal].idxmax()] else: # Specialist stays β defection blocked by threshold best = spec_row.iloc[0] else: best = valid.loc[valid[signal].idxmax()] else: best = valid.loc[valid[signal].idxmax()]
is_right = int(best["is_correct"]) correct += is_right total += 1
per_domain.setdefault(domain, []).append(is_right)
overall = correct / total if total > 0 else float("nan") per_ds = {ds: float(np.mean(v)) for ds, v in per_domain.items()} return overall, per_ds
# ββ Main ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def main(): parser = argparse.ArgumentParser( description="Domain-aware ensemble router for logit-based competence routing." ) parser.add_argument( "--domain_mode", choices=["label", "predict"], default="predict", help=( "'label' = use ground-truth dataset column (upper bound). " "'predict' = train a text classifier and use its predictions (default)." ), ) parser.add_argument( "--text_col", default=DEFAULT_TEXT_COL, help=f"Column containing raw prompt text (default: '{DEFAULT_TEXT_COL}').", ) args = parser.parse_args()
print("=== Step 3: Domain-Aware Ensemble Routing ===\n") print(f"Domain mode : {args.domain_mode}") print(f"Text column : {args.text_col}\n")
# ββ 1. Load data ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ df = load_all_results() train_df, eval_df = make_split(df)
# ββ 2. Attach probe scores from saved Step 2 probes βββββββββββββββββββββββ print("\nββ Attaching probe scores βββββββββββββββββββββββββββββββββ") eval_df = attach_probe_scores(eval_df) probe_available = eval_df["probe_score"].notna().any() if not probe_available: print( "\n WARNING: No probe scores found. Run 02a_train_probes.py " "first to generate *_probe.pkl files.\n" " Domain-aware routing will fall back to log_prob for all domains.\n" )
# ββ 3. Domain classification ββββββββββββββββββββββββββββββββββββββββββββββ print("\nββ Domain classification ββββββββββββββββββββββββββββββββββ")
if args.domain_mode == "label": # Ground-truth labels already in the dataframe eval_df["_domain"] = eval_df["dataset"] domain_col = "_domain" print(" Using ground-truth dataset labels (upper bound).")
else: # "predict" if args.text_col not in df.columns: available = ", ".join(df.columns.tolist()) raise ValueError( f"Text column '{args.text_col}' not found in parquet. " f"Available columns: {available}\n" f"Use --text_col to specify the correct column." )
print(f" Training TF-IDF domain classifier on '{args.text_col}'...") vec, clf = train_domain_classifier(train_df, args.text_col)
# Evaluate classifier on eval prompts (ground-truth available β report accuracy) pred_map = predict_domains(vec, clf, eval_df, args.text_col) eval_df["_domain_pred"] = eval_df["prompt_id"].map(pred_map)
# Per-domain classifier accuracy prompt_truth = ( eval_df[["prompt_id", "dataset"]] .drop_duplicates("prompt_id") .set_index("prompt_id")["dataset"] ) clf_acc_rows = [] for ds in sorted(eval_df["dataset"].unique()): pids = eval_df.loc[eval_df["dataset"] == ds, "prompt_id"].unique() truth = prompt_truth.loc[pids].values pred = pred_map.reindex(pids).values valid = ~pd.isna(pred) acc = accuracy_score(truth[valid], pred[valid]) if valid.any() else float("nan") clf_acc_rows.append({"dataset": ds, "classifier_accuracy": round(acc, 4)})
clf_acc_df = pd.DataFrame(clf_acc_rows) overall_clf_acc = accuracy_score( prompt_truth.values, pred_map.reindex(prompt_truth.index).fillna("unknown").values, ) clf_acc_df.loc[len(clf_acc_df)] = { "dataset": "OVERALL", "classifier_accuracy": round(overall_clf_acc, 4), } clf_acc_df.to_csv(RESULTS_DIR / "domain_classifier.csv", index=False) print(f"\n Domain classifier accuracy on eval set:") print(clf_acc_df.to_string(index=False))
domain_col = "_domain_pred"
# ββ 4. Routing evaluation βββββββββββββββββββββββββββββββββββββββββββββββββ print("\nββ Routing accuracy βββββββββββββββββββββββββββββββββββββββ")
results = {} results["random"] = route_random(eval_df) results["log_prob"] = route_single_signal(eval_df, "mean_log_prob") results["neg_entropy"] = route_single_signal(eval_df, "neg_entropy") results["probe_score"] = ( route_single_signal(eval_df, "probe_score") if probe_available else float("nan") ) results["oracle"] = route_oracle(eval_df)
domain_overall, domain_per_ds = route_domain_aware(eval_df, domain_col) results["domain_aware"] = domain_overall
# Also run domain-aware with ground-truth labels if we used predicted labels, # so we can see the headroom from better domain classification. if args.domain_mode == "predict": eval_df["_domain_truth"] = eval_df["dataset"] da_upper, _ = route_domain_aware(eval_df, "_domain_truth") results["domain_aware_upper"] = da_upper else: results["domain_aware_upper"] = domain_overall # same thing
# ββ 5. Print results table ββββββββββββββββββββββββββββββββββββββββββββββββ descriptions = { "random": "Random expert selection", "log_prob": "Avg log-prob of answer tokens [A]", "neg_entropy": "Negated first-token entropy [B]", "probe_score": "Hidden-state logistic probe [C]", "domain_aware": f"Domain-aware ensemble ({args.domain_mode} labels) β
", "domain_aware_upper": "Domain-aware ensemble (ground-truth labels, upper bound)", "oracle": "Oracle β best expert, offline", }
print(f"\n {'Signal':<30} {'Description':<45} {'Accuracy':>9}") print(" " + "β" * 86) for name, acc in results.items(): acc_str = f"{acc:.4f}" if not np.isnan(acc) else " n/a" print(f" {name:<30} {descriptions.get(name, ''):<45} {acc_str:>9}")
# ββ 6. Per-domain breakdown βββββββββββββββββββββββββββββββββββββββββββββββ print("\nββ Per-domain breakdown (domain-aware router) βββββββββββββ") print(f"\n {'Domain':<18} {'Signal used':<16} {'Accuracy':>9}") print(" " + "β" * 45) for ds in sorted(domain_per_ds): sig = DOMAIN_SIGNAL.get(ds, "mean_log_prob") acc = domain_per_ds[ds] print(f" {ds:<18} {sig:<16} {acc:.4f}")
# ββ 7. Save outputs βββββββββββββββββββββββββββββββββββββββββββββββββββββββ out_df = pd.DataFrame([ {"signal": k, "accuracy": v, "description": descriptions.get(k, "")} for k, v in results.items() ]) out_df.to_csv(RESULTS_DIR / "domain_aware_routing.csv", index=False)
print(f"\nβ Results β {RESULTS_DIR / 'domain_aware_routing.csv'}") if args.domain_mode == "predict": print(f"β Domain clf β {RESULTS_DIR / 'domain_classifier.csv'}") print(f"β Domain model β {MODEL_DIR / 'domain_clf.pkl'}")
# ββ 8. Summary insight ββββββββββββββββββββββββββββββββββββββββββββββββββββ best_single = max( v for k, v in results.items() if k in ("log_prob", "neg_entropy", "probe_score") and not np.isnan(v) ) gain = results["domain_aware"] - best_single print( f"\nDomain-aware router: {results['domain_aware']:.4f} " f"({'β²' if gain >= 0 else 'βΌ'}{abs(gain):.4f} vs best single signal {best_single:.4f})" ) if args.domain_mode == "predict": headroom = results["domain_aware_upper"] - results["domain_aware"] print( f"Headroom from better domain classification: {headroom:.4f} " f"(upper bound with ground-truth labels: {results['domain_aware_upper']:.4f})" )
# ββ 9. Specialist routing diagnostic βββββββββββββββββββββββββββββββββββββ # Checks whether the probe is capturing per-question competence or just # re-learning domain identity (i.e. always routing to the specialist). # # If a specialist is chosen 90%+ of the time on its own domain, the probe # has learned "this looks like a math/code question" rather than "this # particular question is one the math/code model will get right." # In that case the domain-aware router reduces to a simple rule: # gsm8k β qwen25_math, humaneval β qwen25_coder # which needs no ML. A healthy probe should defect to a generalist on # hard in-domain problems where the specialist is predicted to fail. if not probe_available: print("\nββ Specialist routing diagnostic: skipped (no probe scores) ββ") else: print("\nββ Specialist routing diagnostic ββββββββββββββββββββββββββ") print( f"\n {'Domain':<16} {'Specialist':<16} " f"{'Routed to spec':>14} {'Spec correct':>13} {'Defect correct':>15}" ) print(" " + "β" * 76)
diagnostic_rows = []
SPECIALIST_MAP = { "gsm8k": "qwen25_math", "humaneval": "qwen25_coder", }
for domain, spec_model in SPECIALIST_MAP.items(): domain_df = eval_df[eval_df["dataset"] == domain].copy() if domain_df.empty or domain_df["probe_score"].isna().all(): continue
# For each prompt, find which model the probe would choose chosen = ( domain_df.dropna(subset=["probe_score"]) .groupby("prompt_id") .apply(lambda g: g.loc[g["probe_score"].idxmax(), "model_key"]) ) routed_to_spec = (chosen == spec_model).mean()
# Accuracy when specialist is chosen spec_pids = chosen[chosen == spec_model].index spec_rows = domain_df[ (domain_df["prompt_id"].isin(spec_pids)) & (domain_df["model_key"] == spec_model) ] spec_acc = spec_rows["is_correct"].mean() if len(spec_rows) else float("nan")
# Accuracy when router defects to a generalist defect_pids = chosen[chosen != spec_model].index defect_rows = domain_df[ domain_df["prompt_id"].isin(defect_pids) ].groupby("prompt_id").apply( lambda g: g.loc[g["probe_score"].idxmax()] ) defect_acc = defect_rows["is_correct"].mean() if len(defect_rows) else float("nan")
print( f" {domain:<16} {spec_model:<16} " f"{routed_to_spec:>13.1%} {spec_acc:>12.1%} " f"{'n/a' if np.isnan(defect_acc) else f'{defect_acc:.1%}':>15}" )
diagnostic_rows.append({ "domain": domain, "specialist": spec_model, "pct_routed_to_specialist": round(routed_to_spec, 4), "specialist_accuracy": round(spec_acc, 4) if not np.isnan(spec_acc) else None, "defect_accuracy": round(defect_acc, 4) if not np.isnan(defect_acc) else None, "n_prompts": chosen.shape[0], "n_defections": int((chosen != spec_model).sum()), })
if diagnostic_rows: diag_df = pd.DataFrame(diagnostic_rows) diag_df.to_csv(RESULTS_DIR / "specialist_diagnostic.csv", index=False) print(f"\n β Diagnostic β {RESULTS_DIR / 'specialist_diagnostic.csv'}")
# Interpret the result print() for row in diagnostic_rows: pct = row["pct_routed_to_specialist"] if pct >= 0.90: verdict = ( f" β {row['domain']}: probe routes to {row['specialist']} " f"{pct:.0%} of the time β likely learned domain identity, " f"not per-question competence. " f"Focus probe training on within-domain difficulty variance." ) elif pct <= 0.50: verdict = ( f" β {row['domain']}: probe defects away from {row['specialist']} " f"{1-pct:.0%} of the time β may be underusing the specialist. " f"Check probe AUROC and training sample size." ) else: verdict = ( f" β {row['domain']}: probe routes to {row['specialist']} " f"{pct:.0%} of the time β healthy mix of specialist use " f"and generalist defection." ) print(verdict)
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625"""04_cheap_router.py==================The deployable router.
Steps 2 and 3 proved that hidden-state probe scores carry real routing signal,but they required running ALL five models to get five probe scores β defeatingthe point of routing. This script answers the follow-up question:
Can we predict which expert will succeed using only ONE cheap forward pass?
Architecture------------A single "scout" model (default: qwen25_1b, the cheapest) runs on everyprompt. Its hidden state is used to train five independent cross-model probes,one per target expert:
scout hidden state β P(qwen25_1b correct) β P(qwen25_3b correct) β P(phi3_mini correct) β P(qwen25_math correct) β P(qwen25_coder correct)
At routing time only the scout runs. Its hidden state produces five predictedcorrectness scores, and the highest-scoring expert is selected.
This is strictly harder than Step 2 (each model predicting its owncorrectness from its own hidden state) because the scout's representationmust generalise across model families and sizes.
Variants evaluated------------------ cheap_router Pure cheap router β argmax of cross-model probe scores cheap_domain_aware Cheap router + domain-aware signal selection from Step 3 (probe for specialist domains, log_prob for generalist)
The gap between cheap_router and the Step 2 per-expert oracle is the cost ofusing a single scout. The gap between cheap_domain_aware and the Step 3domain-aware router is the additional cost of cross-model generalisation.
Outputs------- results/cheap_router_results.csv β full comparison table results/cheap_probe_metrics.csv β AUROC per (scout β target) probe trained_models/cheap_{target}_probe.pkl
Usage----- python src/04_cheap_router.py # default scout: qwen25_1b python src/04_cheap_router.py --scout qwen25_3b # try a larger scout python src/04_cheap_router.py --sweep_scouts # try all models as scout"""
import argparseimport warningsfrom pathlib import Path
import joblibimport numpy as npimport pandas as pdfrom sklearn.decomposition import PCAfrom sklearn.linear_model import LogisticRegressionfrom sklearn.metrics import roc_auc_scorefrom sklearn.model_selection import train_test_splitfrom sklearn.preprocessing import StandardScaler
warnings.filterwarnings("ignore")
# ββ Paths βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
BASE_DIR = Path(__file__).resolve().parent.parent # project root (scripts live in src/)RESULTS_DIR = BASE_DIR / "results"HIDDEN_DIR = BASE_DIR / "hidden_states"MODEL_DIR = BASE_DIR / "trained_models"CHEAP_DIR = MODEL_DIR / "cheap_probes"
for d in [RESULTS_DIR, CHEAP_DIR]: d.mkdir(parents=True, exist_ok=True)
# ββ Configuration βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MODELS = [ "qwen25_1b", "qwen25_3b", "phi3_mini", "qwen25_math", "qwen25_coder",]
DEFAULT_SCOUT = "qwen25_1b"
# Must match 03 and 04 exactly β same seed, same fractionTRAIN_FRAC = 0.30RANDOM_SEED = 42
# PCA dims for cross-model probes. Can be lower than Step 2 since the# scout's hidden state is predicting a harder target (other models'# correctness) β too many dims risks overfitting on the small training set.PCA_DIMS = 64
# Defection threshold carried over from Step 3 for the domain-aware variant.DEFECTION_THRESHOLD = { "gsm8k": 0.0, "humaneval": 0.15,}DOMAIN_SIGNAL = { "gsm8k": "cheap_probe", "humaneval": "cheap_probe", "commonsenseqa": "mean_log_prob", "mmlu": "mean_log_prob",}DOMAIN_SPECIALIST = { "gsm8k": "qwen25_math", "humaneval": "qwen25_coder",}
# ββ Data helpers ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def load_all_results() -> pd.DataFrame: dfs = [] for f in sorted(RESULTS_DIR.glob("*_results.parquet")): dfs.append(pd.read_parquet(f)) if not dfs: raise FileNotFoundError( "No *_results.parquet found. Run 01_collect_data.py first." ) df = pd.concat(dfs, ignore_index=True) df["neg_entropy"] = -df["first_tok_entropy"] print( f"Loaded {len(df):,} rows | " f"{df['model_key'].nunique()} models | " f"datasets: {sorted(df['dataset'].unique())}" ) return df
def make_split(df: pd.DataFrame): """Reproduce the identical train/eval split used in Steps 2 and 3.""" rng = np.random.default_rng(RANDOM_SEED) train_ids = set() for ds, grp in df.groupby("dataset"): unique = grp["prompt_id"].unique() n = max(1, int(len(unique) * TRAIN_FRAC)) train_ids.update(rng.choice(unique, size=n, replace=False).tolist()) eval_df = df[~df["prompt_id"].isin(train_ids)].copy() train_df = df[ df["prompt_id"].isin(train_ids)].copy() print( f"Split β train: {train_df['prompt_id'].nunique()} prompts | " f"eval: {eval_df['prompt_id'].nunique()} prompts" ) return train_df, eval_df
def load_hidden(model_key: str): """Returns (prompt_ids, vectors) or (None, None).""" path = HIDDEN_DIR / f"{model_key}_hidden.npz" if not path.exists(): return None, None data = np.load(path, allow_pickle=True) return data["prompt_ids"].tolist(), data["vectors"].astype(np.float32)
# ββ Cross-model probe training ββββββββββββββββββββββββββββββββββββββββββββββββ
def train_cross_model_probe( scout_key: str, target_key: str, train_df: pd.DataFrame, scout_ids: list, scout_vecs: np.ndarray,) -> dict | None: """ Train a probe that maps scout hidden states β P(target model correct).
scout_key : model whose hidden states are the input features target_key : model whose correctness is the prediction target train_df : rows for the training split only scout_ids : prompt_ids corresponding to rows of scout_vecs scout_vecs : hidden state matrix for the scout model (N, hidden_dim)
Returns a dict with {pca, scaler, clf, auroc, ...} or None if skipped. """ # Labels: is the TARGET model correct on each training prompt? target_train = ( train_df[train_df["model_key"] == target_key] [["prompt_id", "is_correct"]] .drop_duplicates("prompt_id") .set_index("prompt_id")["is_correct"] .astype(int) )
# Align scout hidden states with target labels id_to_idx = {pid: i for i, pid in enumerate(scout_ids)} common_ids = [pid for pid in target_train.index if pid in id_to_idx]
if len(common_ids) < 20: print( f" [{scout_key}β{target_key}] Only {len(common_ids)} aligned " f"training prompts β skipping." ) return None
idxs = [id_to_idx[pid] for pid in common_ids] X = scout_vecs[idxs] y = target_train.loc[common_ids].values
if len(np.unique(y)) < 2: print(f" [{scout_key}β{target_key}] Single class in training β skipping.") return None
# PCA β scale β logistic regression n_dims = min(PCA_DIMS, X.shape[1], X.shape[0] - 1) pca = PCA(n_components=n_dims, random_state=RANDOM_SEED) scaler = StandardScaler() clf = LogisticRegression( max_iter=1000, C=1.0, class_weight="balanced", # handles correctness imbalance across domains random_state=RANDOM_SEED, )
X_pca = pca.fit_transform(X) X_sc = scaler.fit_transform(X_pca)
# Inner 80/20 split for AUROC validation X_fit, X_val, y_fit, y_val = train_test_split( X_sc, y, test_size=0.2, random_state=RANDOM_SEED, stratify=y ) clf.fit(X_fit, y_fit)
auroc = ( roc_auc_score(y_val, clf.predict_proba(X_val)[:, 1]) if len(np.unique(y_val)) > 1 else float("nan") )
# Refit on full training split clf_final = LogisticRegression( max_iter=1000, C=1.0, class_weight="balanced", random_state=RANDOM_SEED, ) clf_final.fit(X_sc, y)
pipeline = { "scout_key": scout_key, "target_key": target_key, "pca": pca, "scaler": scaler, "clf": clf_final, "auroc": auroc, "n_train": len(X_fit), "n_val": len(X_val), "pca_dims": n_dims, }
out = CHEAP_DIR / f"cheap_{scout_key}_to_{target_key}_probe.pkl" joblib.dump(pipeline, out)
print( f" [{scout_key}β{target_key}] " f"AUROC={auroc:.4f} n_train={len(X_fit)} n_val={len(X_val)} " f"pca_dims={n_dims}" ) return pipeline
# ββ Scoring eval prompts ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def score_eval_prompts( pipelines: dict, # target_key β pipeline dict eval_df: pd.DataFrame, scout_ids: list, scout_vecs: np.ndarray,) -> pd.DataFrame: """ For every (prompt_id, model_key) row in eval_df, attach the predicted P(correct) from the cross-model probe trained on the scout's hidden state.
Returns eval_df with a new 'cheap_probe' column. """ eval_df = eval_df.copy() eval_df["cheap_probe"] = np.nan
id_to_idx = {pid: i for i, pid in enumerate(scout_ids)}
for target_key, pipeline in pipelines.items(): if pipeline is None: continue
pca = pipeline["pca"] scaler = pipeline["scaler"] clf = pipeline["clf"]
mask = eval_df["model_key"] == target_key pids = eval_df.loc[mask, "prompt_id"].tolist() valid = [(pid, id_to_idx[pid]) for pid in pids if pid in id_to_idx]
if not valid: continue
sel_pids, sel_idxs = zip(*valid) X = scout_vecs[list(sel_idxs)] X_pca = pca.transform(X) X_sc = scaler.transform(X_pca) scores = clf.predict_proba(X_sc)[:, 1]
score_map = dict(zip(sel_pids, scores)) update_idx = eval_df.loc[mask, "prompt_id"].map(score_map) eval_df.loc[update_idx.index, "cheap_probe"] = update_idx.values
return eval_df
# ββ Routing functions βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def route_single_signal(eval_df: pd.DataFrame, signal_col: str) -> float: correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): valid = grp.dropna(subset=[signal_col]) if valid.empty: continue best = valid.loc[valid[signal_col].idxmax()] correct += int(best["is_correct"]) total += 1 return correct / total if total else float("nan")
def route_oracle(eval_df: pd.DataFrame) -> float: correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): correct += int(grp["is_correct"].max()) total += 1 return correct / total if total else float("nan")
def route_random(eval_df: pd.DataFrame, n_runs: int = 5) -> float: rng = np.random.default_rng(RANDOM_SEED) accs = [] for _ in range(n_runs): correct, total = 0, 0 for _, grp in eval_df.groupby("prompt_id"): chosen = grp.sample(1, random_state=int(rng.integers(1e6))) correct += int(chosen["is_correct"].values[0]) total += 1 accs.append(correct / total if total else 0.0) return float(np.mean(accs))
def route_domain_aware_cheap(eval_df: pd.DataFrame) -> tuple[float, dict]: """ Domain-aware router using cheap_probe for specialist domains and mean_log_prob for generalist domains β mirroring Step 3 but using cross-model probe scores from the scout instead of per-expert probes.
Applies the same defection threshold as Step 3. """ correct, total = 0, 0 per_domain: dict[str, list] = {}
for pid, grp in eval_df.groupby("prompt_id"): domain = grp["dataset"].iloc[0] signal = DOMAIN_SIGNAL.get(domain, "mean_log_prob") threshold = DEFECTION_THRESHOLD.get(domain, 0.0) specialist = DOMAIN_SPECIALIST.get(domain)
valid = grp.dropna(subset=[signal]) if valid.empty: continue
if threshold > 0.0 and specialist is not None: spec_row = valid[valid["model_key"] == specialist] if not spec_row.empty: spec_score = spec_row[signal].values[0] alts = valid[valid["model_key"] != specialist] best_alt_score = alts[signal].max() if not alts.empty else -np.inf if best_alt_score - spec_score >= threshold: best = valid.loc[valid[signal].idxmax()] else: best = spec_row.iloc[0] else: best = valid.loc[valid[signal].idxmax()] else: best = valid.loc[valid[signal].idxmax()]
is_right = int(best["is_correct"]) correct += is_right total += 1 per_domain.setdefault(domain, []).append(is_right)
overall = correct / total if total else float("nan") per_ds = {ds: float(np.mean(v)) for ds, v in per_domain.items()} return overall, per_ds
# ββ Probe AUROC diagnostic ββββββββββββββββββββββββββββββββββββββββββββββββββββ
def print_auroc_comparison(pipelines: dict, scout_key: str) -> pd.DataFrame: """ Print and return a table comparing cross-model probe AUROC (scout β target) against Step 2 per-expert probe AUROC for context. """ # Step 2 AUROCs for reference (from probe_metrics.csv if available) step3_auroc = {} step3_path = RESULTS_DIR / "probe_metrics.csv" if step3_path.exists(): step3_df = pd.read_csv(step3_path) step3_auroc = dict( zip(step3_df["model_key"], step3_df["probe_auroc"]) )
rows = [] print( f"\n {'Target model':<16} {'ScoutβTarget AUROC':>20} " f"{'Step3 self AUROC':>18} {'Ξ':>8}" ) print(" " + "β" * 65)
for target in MODELS: pipeline = pipelines.get(target) cross_auroc = pipeline["auroc"] if pipeline else float("nan") self_auroc = step3_auroc.get(target, float("nan")) delta = cross_auroc - self_auroc
print( f" {target:<16} {cross_auroc:>20.4f} " f"{self_auroc:>18.4f} " f"{'n/a' if np.isnan(delta) else f'{delta:+.4f}':>8}" ) rows.append({ "scout": scout_key, "target": target, "cross_auroc": round(cross_auroc, 4), "self_auroc": round(self_auroc, 4) if not np.isnan(self_auroc) else None, "delta": round(delta, 4) if not np.isnan(delta) else None, })
return pd.DataFrame(rows)
# ββ Single scout run ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def run_scout( scout_key: str, df: pd.DataFrame, train_df: pd.DataFrame, eval_df: pd.DataFrame,) -> dict: """ Full pipeline for one scout model: train probes, score eval, route. Returns a dict of routing accuracy results for this scout. """ print(f"\n{'='*60}") print(f"Scout model: {scout_key}") print(f"{'='*60}")
# Load scout hidden states scout_ids, scout_vecs = load_hidden(scout_key) if scout_ids is None: print(f" No hidden states found for {scout_key} β skipping.") return {}
print(f" Loaded {len(scout_ids)} hidden states shape={scout_vecs.shape}")
# ββ Train cross-model probes ββββββββββββββββββββββββββββββββββββββββββββββ print(f"\nββ Cross-model probes ({scout_key} β each target) ββββββββββ") pipelines = {} for target_key in MODELS: pipelines[target_key] = train_cross_model_probe( scout_key, target_key, train_df, scout_ids, scout_vecs )
# ββ AUROC comparison table ββββββββββββββββββββββββββββββββββββββββββββββββ print(f"\nββ AUROC: cross-model vs self (Step 2) βββββββββββββββββββββ") auroc_df = print_auroc_comparison(pipelines, scout_key) auroc_df.to_csv( RESULTS_DIR / f"cheap_probe_metrics_{scout_key}.csv", index=False )
# ββ Score eval prompts ββββββββββββββββββββββββββββββββββββββββββββββββββββ print(f"\nββ Scoring eval prompts ββββββββββββββββββββββββββββββββββββ") eval_scored = score_eval_prompts(pipelines, eval_df, scout_ids, scout_vecs)
probe_ok = eval_scored["cheap_probe"].notna().any() if not probe_ok: print(f" WARNING: No cheap_probe scores produced β check hidden states.")
# ββ Routing evaluation ββββββββββββββββββββββββββββββββββββββββββββββββββββ print(f"\nββ Routing accuracy ββββββββββββββββββββββββββββββββββββββββ")
results = { "random": route_random(eval_scored), "log_prob": route_single_signal(eval_scored, "mean_log_prob"), "neg_entropy": route_single_signal(eval_scored, "neg_entropy"), "cheap_router": route_single_signal(eval_scored, "cheap_probe") if probe_ok else float("nan"), "oracle": route_oracle(eval_scored), }
# Domain-aware cheap router if probe_ok: da_acc, da_per_ds = route_domain_aware_cheap(eval_scored) results["cheap_domain_aware"] = da_acc else: results["cheap_domain_aware"] = float("nan") da_per_ds = {}
# Load Step 3 domain-aware result for comparison (if available) step4_path = RESULTS_DIR / "domain_aware_routing.csv" if step4_path.exists(): step4_df = pd.read_csv(step4_path) da_row = step4_df[step4_df["signal"] == "domain_aware"] if not da_row.empty: results["step4_domain_aware"] = float(da_row["accuracy"].values[0])
descriptions = { "random": "Random expert selection", "log_prob": "Avg log-prob of answer tokens [A]", "neg_entropy": "Negated first-token entropy [B]", "cheap_router": f"Cheap router β {scout_key} hidden state only β
", "cheap_domain_aware": f"Cheap router + domain-aware ensemble β
β
", "step4_domain_aware": "Step 3 domain-aware (per-expert probes, reference)", "oracle": "Oracle β best expert, offline", }
print(f"\n {'Signal':<26} {'Description':<44} {'Accuracy':>9}") print(" " + "β" * 81) for name, acc in results.items(): acc_str = f"{acc:.4f}" if not np.isnan(acc) else " n/a" print(f" {name:<26} {descriptions.get(name,''):<44} {acc_str:>9}")
# ββ Per-domain breakdown ββββββββββββββββββββββββββββββββββββββββββββββββββ if da_per_ds: print(f"\nββ Per-domain (cheap domain-aware router) ββββββββββββββββββ") print(f"\n {'Domain':<18} {'Signal':<16} {'Accuracy':>9}") print(" " + "β" * 45) for ds in sorted(da_per_ds): sig = DOMAIN_SIGNAL.get(ds, "mean_log_prob") print(f" {ds:<18} {sig:<16} {da_per_ds[ds]:.4f}")
# ββ Cost summary ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ print(f"\nββ Compute cost summary ββββββββββββββββββββββββββββββββββββ") print(f" Step 2 / Step 3 router : 5 forward passes per prompt (all experts)") print(f" Cheap router ({scout_key}): 1 forward pass per prompt (scout only)") if not np.isnan(results.get("cheap_router", float("nan"))): cost_of_cheapness = results.get("step4_domain_aware", results["log_prob"]) - results["cheap_router"] print( f" Accuracy cost of using 1 pass instead of 5: " f"{cost_of_cheapness:+.4f} vs Step 3 domain-aware" ) if not np.isnan(results.get("cheap_domain_aware", float("nan"))): gap_to_oracle = results["oracle"] - results["cheap_domain_aware"] print(f" Gap to oracle: {gap_to_oracle:.4f}")
return {"scout": scout_key, "results": results, "per_domain": da_per_ds}
# ββ Main ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
def main(): parser = argparse.ArgumentParser( description="Train and evaluate a cheap single-forward-pass router." ) parser.add_argument( "--scout", default=DEFAULT_SCOUT, choices=MODELS, help=f"Scout model to use (default: {DEFAULT_SCOUT}).", ) parser.add_argument( "--sweep_scouts", action="store_true", help="Run all models as scout and compare. Ignores --scout.", ) args = parser.parse_args()
print("=== Step 4: Cheap Single-Pass Router ===\n")
# ββ Load and split data βββββββββββββββββββββββββββββββββββββββββββββββββββ df = load_all_results() train_df, eval_df = make_split(df)
scouts = MODELS if args.sweep_scouts else [args.scout] all_runs = []
for scout_key in scouts: run = run_scout(scout_key, df, train_df, eval_df) if run: all_runs.append(run)
# ββ Save combined results βββββββββββββββββββββββββββββββββββββββββββββββββ out_rows = [] for run in all_runs: scout = run["scout"] for signal, acc in run["results"].items(): out_rows.append({ "scout": scout, "signal": signal, "accuracy": acc, }) out_df = pd.DataFrame(out_rows) out_df.to_csv(RESULTS_DIR / "cheap_router_results.csv", index=False) print(f"\nβ Results β {RESULTS_DIR / 'cheap_router_results.csv'}")
# ββ Scout sweep summary βββββββββββββββββββββββββββββββββββββββββββββββββββ if args.sweep_scouts and len(all_runs) > 1: print(f"\n{'='*60}") print("Scout sweep summary β cheap_domain_aware accuracy by scout") print(f"{'='*60}") print(f"\n {'Scout':<16} {'cheap_router':>14} {'cheap_domain_aware':>20}") print(" " + "β" * 52) for run in all_runs: cr = run["results"].get("cheap_router", float("nan")) cda = run["results"].get("cheap_domain_aware", float("nan")) print( f" {run['scout']:<16} " f"{cr:>14.4f} " f"{cda:>20.4f}" ) best = max(all_runs, key=lambda r: r["results"].get("cheap_domain_aware", 0.0)) print(f"\n Best scout: {best['scout']} " f"({best['results'].get('cheap_domain_aware', float('nan')):.4f})")
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327"""collect_data_helpers.py=======================Shared utilities: model loading, prompt formatting, answer scoring.
All four domains now have clean ground-truth answer keys loaded directlyfrom HuggingFace (no RouterBench, no reference-answer extraction):
gsm8k β answer_key is the numeric final answer humaneval β answer_key is canonical_solution; scored by actually EXECUTING the generated code against test_code in a subprocess sandbox with a timeout mmlu β answer_key is a letter A/B/C/D commonsenseqa β answer_key is a letter A-E
No verbal confidence anywhere β all routing signals come from modelinternals (log-prob, entropy, hidden states), extracted in 01_collect_data.py."""
import reimport subprocessimport tempfileimport osimport torchfrom transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
def build_prompt(prompt_text, tokenizer, model_key, dataset=None): """ Apply the correct prompt format per model and task.
qwen25_math (all tasks): Requires a system prompt instructing it to reason step by step and put the final answer in \boxed{}. Without this system prompt, Qwen-Math either refuses or outputs prose with no parseable answer β this is why it scored near 0% on GSM8K in the first run. Source: https://huggingface.co/Qwen/Qwen2.5-Math-1.5B-Instruct
qwen25_coder (HumanEval): IS an instruct model β should receive a user message asking it to complete the function. Raw completion mode caused it to continue the docstring text rather than implement the function body. Source: https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct
HumanEval for all OTHER models: Raw completion β non-coder instruct models produce better code completing a function signature directly than conversationally.
All other combinations: Standard chat template with no system prompt. """ # ββ Qwen-Math: CoT system prompt required for all tasks ββββββββββββββββββββ if model_key == "qwen25_math": messages = [ { "role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}.", }, {"role": "user", "content": prompt_text}, ] try: return tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True ) except Exception: # Fallback: prepend instruction manually return ("Please reason step by step, and put your final answer " "within \\boxed{}.\n\n" + prompt_text)
# ββ Qwen-Coder on HumanEval: instruct-style, not raw completion βββββββββ if model_key == "qwen25_coder" and dataset == "humaneval": messages = [ { "role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.", }, { "role": "user", "content": ( "Complete the following Python function. " "Return only the completed function, no explanation.\n\n" + prompt_text ), }, ] try: return tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True ) except Exception: return prompt_text
# ββ HumanEval for all other models: raw completion ββββββββββββββββββββββββ if dataset == "humaneval": return prompt_text
# ββ Default: standard chat template, no system prompt βββββββββββββββββββββ try: messages = [{"role": "user", "content": prompt_text}] return tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True ) except Exception: return prompt_textdef load_model(model_key, model_id, logger, use_4bit=False, trust_remote_code=True): """ Load with configurable precision and trust_remote_code.
use_4bit=False (default) β fp16 for all models in our pool (β€3.8B). 4-bit quantisation overhead is not worth it at this size; fp16 is actually faster on a T4 for models this small.
trust_remote_code β set False for Phi-3, whose remote modeling code has a rope_scaling KeyError on some transformers versions. All other models in the pool use standard architectures and need it True (or it's simply ignored).
output_hidden_states=True so hidden states are available for the probe. """ use_cuda = torch.cuda.is_available() tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=trust_remote_code) if tokenizer.pad_token is None: tokenizer.pad_token = tokenizer.eos_token
if use_4bit and use_cuda: bnb_config = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_compute_dtype=torch.float16, bnb_4bit_use_double_quant=True, bnb_4bit_quant_type="nf4", ) model = AutoModelForCausalLM.from_pretrained( model_id, quantization_config=bnb_config, device_map={"": 0}, # explicit single-GPU placement β "auto" has # been observed silently placing some models # (e.g. Phi-3) on CPU instead of GPU output_hidden_states=True, trust_remote_code=trust_remote_code, ) elif use_cuda: model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype=torch.float16, device_map={"": 0}, output_hidden_states=True, trust_remote_code=trust_remote_code, ) else: model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype=torch.float32, output_hidden_states=True, trust_remote_code=trust_remote_code, )
model.eval() logger.info( f"Loaded {model_id} | CUDA: {use_cuda} | 4bit: {use_4bit} | " f"trust_remote_code: {trust_remote_code}" ) return model, tokenizer
# ββ MCQ scoring (mmlu, commonsenseqa) βββββββββββββββββββββββββββββββββββββββββββdef _extract_letter(text: str) -> str: """ Extract the first answer letter (A-E) from a model response. Handles: "A", "A)", "A.", "(A)", "The answer is A", etc. """ text = text.strip() if text and text[0].upper() in "ABCDE": return text[0].upper() m = re.search(r'\b([ABCDE])[).:\s]', text.upper()) if m: return m.group(1) m = re.search(r'answer[^A-E]*([ABCDE])', text.upper()) if m: return m.group(1) m = re.search(r'[ABCDE]', text.upper()) if m: return m.group(0) return ""
# ββ GSM8K scoring ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββdef _extract_number(text: str) -> str: """ Extract the final numeric answer from a math response.
Qwen-Math puts its answer inside \\boxed{} β check that first. Fall back to the last number in the text for other models. """ # Priority 1: \boxed{42} or \boxed{42.5} β Qwen-Math format boxed = re.findall(r'\\boxed\{([^}]+)\}', text) if boxed: # Take the last \boxed{} in case there are intermediate ones candidate = boxed[-1].replace(",", "").strip() nums = re.findall(r"-?\d+(?:\.\d+)?", candidate) if nums: return nums[-1]
# Priority 2: "The answer is 42" or "= 42" patterns m = re.search(r'(?:answer is|=)\s*(-?\d[\d,]*(?:\.\d+)?)', text, re.IGNORECASE) if m: return m.group(1).replace(",", "")
# Priority 3: last number in the response text_clean = text.replace(",", "") nums = re.findall(r"-?\d+(?:\.\d+)?", text_clean) return nums[-1] if nums else ""
# ββ HumanEval scoring β real code execution βββββββββββββββββββββββββββββββββββββdef _extract_code(response: str) -> str: """ Extract Python code from a model response. Since HumanEval now uses raw completion (not chat-wrapped), the response is typically the direct continuation of the function body. Markdown fences are still stripped defensively in case the model adds them anyway (common even in raw completion mode for instruct-tuned models). """ fence_match = re.search(r"```(?:python)?\s*\n(.*?)```", response, re.DOTALL) if fence_match: return fence_match.group(1) return response
def _score_humaneval(response: str, prompt_dict: dict, timeout: int = 5) -> int: """ Execute the generated code against HumanEval's unit tests in a subprocess sandbox with a timeout. Returns 1 if all tests pass, 0 otherwise.
Since generation is raw completion (build_prompt skips the chat template for humaneval), the response is the direct continuation of the prompt's function signature. The full program is therefore: original_prompt + response + test_code + check(entry_point)
If the model's response happens to redeclare "def {entry_point}" from scratch (some instruct models do this even in completion mode), we use the response alone instead of prompt+response to avoid a duplicate/ conflicting function definition.
Truncation handling: if generation hit max_new_tokens before completing the function body, the code will fail to parse/execute β scored as 0. This is the expected and correct behaviour (an incomplete answer is a wrong answer), not an error case requiring retry at this stage. """ prompt_text = prompt_dict["prompt"] # function signature + docstring test_code = prompt_dict["test_code"] # unit test code entry_point = prompt_dict["entry_point"] # function name being tested
code = _extract_code(response)
if f"def {entry_point}" in code: # Model redeclared the full function β use its version standalone full_program = code else: # Normal case: response is the continuation of the prompt's signature full_program = prompt_text + code
full_program += "\n\n" + test_code + f"\n\ncheck({entry_point})\n"
with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f: f.write(full_program) tmp_path = f.name
try: result = subprocess.run( ["python3", tmp_path], capture_output=True, timeout=timeout, text=True, ) return 1 if result.returncode == 0 else 0 except subprocess.TimeoutExpired: return 0 except Exception: return 0 finally: try: os.unlink(tmp_path) except OSError: pass
# ββ Unified scoring entry point βββββββββββββββββββββββββββββββββββββββββββββββββdef score_answer(response: str, prompt_dict: dict) -> int: """ Score a model's response as 0 (wrong) or 1 (correct).
Dispatches by prompt_dict['dataset']: gsm8k β numeric match against answer_key humaneval β real code execution against test_code (subprocess) mmlu β letter match against answer_key commonsenseqa β letter match against answer_key
All four domains have clean ground-truth answer_key values loaded directly from HuggingFace β no reference-answer extraction needed. """ dataset = prompt_dict.get("dataset", "") answer_key = prompt_dict.get("answer_key", "")
if dataset == "gsm8k": our_num = _extract_number(response) if not our_num or not answer_key: return 0 try: # Tolerance comparison β exact float equality fails on values # like 33.33 vs 33.333..., which are "correct" but not bit-equal return int(abs(float(our_num) - float(answer_key)) < 1e-4) except ValueError: return 0
elif dataset == "humaneval": return _score_humaneval(response, prompt_dict)
elif dataset in ("mmlu", "commonsenseqa"): our_letter = _extract_letter(response) ref_letter = str(answer_key).strip().upper() if answer_key else "" if not our_letter or not ref_letter: return 0 return int(our_letter == ref_letter)
else: # Fallback β substring match return int(str(answer_key).strip().lower() in response.strip().lower()).gitignoreAdded+18
README.mdAdded+480
notebooks/run_experiment.ipynbAdded+379
phase1/README.mdAdded+65
phase1/data/_done_pairs.jsonAdded+1
phase1/data/calibration_dataset.csvAdded
phase1/data/calibration_dataset_fixed.csvAdded
phase1/data/checkpoints_logprob/phi-3-mini-4k-instruct.csvAdded
phase1/data/checkpoints_logprob/qwen2.5-1.5b-instruct.csvAdded
phase1/data/checkpoints_logprob/qwen2.5-3b-instruct.csvAdded
phase1/data/checkpoints_logprob/qwen2.5-coder-1.5b-instruct.csvAdded
phase1/data/checkpoints_logprob/qwen2.5-math-1.5b-instruct.csvAdded
phase1/data/checkpoints_stated_conf/phi-3-mini-4k-instruct.csvAdded
phase1/data/checkpoints_stated_conf/qwen2.5-1.5b-instruct.csvAdded
phase1/data/checkpoints_stated_conf/qwen2.5-3b-instruct.csvAdded
phase1/data/checkpoints_stated_conf/qwen2.5-coder-1.5b-instruct.csvAdded
phase1/data/checkpoints_stated_conf/qwen2.5-math-1.5b-instruct.csvAdded
phase1/notebooks/01_calibration_data_collection.ipynbAdded
phase1/notebooks/02_calibration_analysis.ipynbAdded
phase1/results/phase02_calibration.csvAdded+21
phase1/results/phase05_cascade_simulation.csvAdded+22
requirements.txtAdded+40
src/01_collect_data.pyAdded+644
src/02a_train_probes.pyAdded+452
src/02b_train_probes_specialist.pyAdded+485
src/03_domain_aware_router.pyAdded+664
src/04_cheap_router.pyAdded+625
src/collect_data_helpers.pyAdded+327