Qwen3.5-4B Strategy Token Diversity LoRA
The one idea you need
Picture nudging a coder to "try a loop," then "try recursion," then "try math," hoping the varied attempts crack problems a quick pass missed. A small trained add-on learned to obey these tactic labels. But scrambling which label meant what worked exactly as well.
The question
If you train a small coding model to attempt problems under different labeled tactics, does it recover more failed problems than just taking extra plain tries?
What we found
No. Feeding the model labeled coding tactics recovered 37.5% of the problems it first failed, slightly below plain extra sampling at the same cost, which recovered 41.7%. Tellingly, scrambling the labels so they meant nothing recovered just as many, proving the model was not truly switching tactics — it only gained from taking more shots. Only far pricier pooling of roughly triple the tries reached 62.5%.
Why it matters
Do not pay to fine-tune tactic or persona labels hoping for complementary attempts on hard problems. A small coder recovers the same failures from plain extra sampling at equal cost. Spend the budget on more samples, not clever labels.
On this page
Results at a glance 2
How to read
Each bar is one sampling method; its height is the share of the 24 first-pass failures it eventually solves, and taller is better. The far-left bar is the cheap first pass, the two middle bars add tactic labels, and the two rightmost pool the most tries.
Takeaway → The tactic-label bars sit no higher than plain extra retries, and the scrambled-label bar matches them; only the far costlier pooled bars climb clearly higher.
Data table
| sampling arm | base-miss recovery rate |
|---|---|
| base K4 | 0% |
| default K32 | 33.3% |
| diverse K32 | 37.5% |
| hot K32 | 41.7% |
| base + semantic strategy K32 | 37.5% |
| base + shuffled strategy K32 | 41.7% |
| union K32 | 54.2% |
| union K128 | 62.5% |
Numbers from reports/summary.json (zero_to_one_rate per arm)
Technical framing
Base-miss recovery: strategy-token adapters vs plain sampling at K32 — The semantic strategy adapter (37.5%) does not beat plain hot K32 (41.7%), and the shuffled-token control matches or beats it.
How to read
Each bar is one sampling method; its height is the fraction of all 80 coding problems it solves, and taller is better. The far-left cheap first pass solves 70%; the tactic-label bars sit near 81-83%; the two rightmost pooled bars reach 86-89%.
Takeaway → Adding tactic labels leaves total coverage in the same low-80s band as ordinary extra retries; clear gains come only from spending far more samples.
Data table
| sampling arm | coverage |
|---|---|
| base K4 | 70% |
| default K32 | 80% |
| diverse K32 | 81.2% |
| hot K32 | 82.5% |
| base + semantic strategy K32 | 81.2% |
| base + shuffled strategy K32 | 82.5% |
| union K32 | 86.2% |
| union K128 | 88.8% |
Numbers from reports/summary.json (coverage per arm)
Technical framing
Overall MBPP coverage by sampling arm (80 tasks) — Adding semantic strategy samples lands at 81-83% coverage, the same band as one hot K32 arm; only the expensive unions go higher.
In the author’s words from the Overview · “Summary”
Can a small QLoRA adapter with explicit strategy tokens make extra samples on base-missed MBPP tasks behave like a more complementary ensemble, recovering misses at roughly the cost of one hot K32 arm instead of a three-policy union?
Overview
This top-level README was generated during repository normalization because the imported experiment did not include one.
- Source track:
track-z - Primary report: reports/final_report.md
- Metadata: metadata.yaml
How To Read
Start with the primary report, then inspect data/, reports/, analysis/, src/, and scripts/ as available. This folder remains self-contained; do not move its run data into shared directories.
Summary
Can a small QLoRA adapter with explicit strategy tokens make extra samples on base-missed MBPP tasks behave like a more complementary ensemble, recovering misses at roughly the cost of one hot K32 arm instead of a three-policy union?
Report
Rendered from reports/final_report.md
Question
Can a small QLoRA adapter with explicit strategy tokens make extra samples on base-missed MBPP tasks behave like a more complementary ensemble, recovering misses at roughly the cost of one hot K32 arm instead of a three-policy union?
Result
- The semantic strategy-token adapter did not beat the hot K32 inference baseline, so the training objective did not buy the desired sampling-efficiency win.
- The shuffled-key control matched or beat the semantic adapter on base-miss recovery, so any recovery is not attributable to meaningful strategy-key semantics.
Arms
| arm | records | coverage | base-miss recovered | base-miss recovery | mean candidates | functional diversity | forward tokens |
|---|---|---|---|---|---|---|---|
| base_k4 | 80 | 70.0% | 0/24 | 0.0% | 3.45 | 47.7% | 69,645 |
| default_k32 | 80 | 80.0% | 8/24 | 33.3% | 10.28 | 35.8% | 235,491 |
| hot_k32 | 80 | 82.5% | 10/24 | 41.7% | 11.39 | 35.9% | 243,343 |
| diverse_k32 | 80 | 81.2% | 9/24 | 37.5% | 11.04 | 36.2% | 243,268 |
| union_k32 | 80 | 86.2% | 13/24 | 54.2% | 24.09 | 34.0% | 582,812 |
| union_k128 | 80 | 88.8% | 15/24 | 62.5% | 29.31 | 33.8% | 698,783 |
| base_plus_semantic_strategy_k32 | 80 | 81.2% | 9/24 | 37.5% | 11.51 | 35.4% | 274,406 |
| base_plus_shuffled_strategy_k32 | 80 | 82.5% | 10/24 | 41.7% | 11.68 | 35.9% | 283,391 |
| semantic_strategy_k32_base_missed | 24 | 37.5% | 9/24 | 37.5% | 27.33 | 11.8% | 204,761 |
| shuffled_strategy_k32_base_missed | 24 | 41.7% | 10/24 | 41.7% | 27.71 | 13.8% | 213,746 |
| semantic_strategy_k32 | 80 | 81.2% | 11/24 | 45.8% | 23.10 | 13.8% | 627,176 |

Recovered Task IDs
base_k4: nonedefault_k32: 22, 35, 36, 42, 67, 70, 81, 87hot_k32: 15, 22, 35, 36, 42, 55, 59, 67, 70, 81diverse_k32: 22, 34, 35, 36, 42, 59, 67, 81, 83union_k32: 15, 22, 34, 35, 36, 42, 55, 59, 67, 70, 81, 83, 87union_k128: 15, 22, 34, 35, 36, 42, 55, 59, 67, 70, 73, 81, 83, 84, 87semantic_strategy_k32: 22, 31, 35, 36, 42, 48, 67, 73, 81, 84, 87shuffled_strategy_k32_base_missed: 22, 31, 35, 36, 42, 67, 73, 81, 84, 87semantic_strategy_k32_base_missed: 22, 31, 35, 36, 42, 67, 81, 84, 87base_plus_semantic_strategy_k32: 22, 31, 35, 36, 42, 67, 81, 84, 87base_plus_shuffled_strategy_k32: 22, 31, 35, 36, 42, 67, 73, 81, 84, 87
Recovery Overlap
| arm A | arm B | recovered overlap | A only | B only |
|---|---|---|---|---|
| default_k32 | hot_k32 | 7 | 1 | 3 |
| default_k32 | diverse_k32 | 6 | 2 | 3 |
| default_k32 | union_k32 | 8 | 0 | 5 |
| default_k32 | union_k128 | 8 | 0 | 7 |
| default_k32 | semantic_strategy_k32 | 7 | 1 | 4 |
| default_k32 | shuffled_strategy_k32_base_missed | 7 | 1 | 3 |
| default_k32 | semantic_strategy_k32_base_missed | 7 | 1 | 2 |
| default_k32 | base_plus_semantic_strategy_k32 | 7 | 1 | 2 |
| default_k32 | base_plus_shuffled_strategy_k32 | 7 | 1 | 3 |
| hot_k32 | diverse_k32 | 7 | 3 | 2 |
| hot_k32 | union_k32 | 10 | 0 | 3 |
| hot_k32 | union_k128 | 10 | 0 | 5 |
| hot_k32 | semantic_strategy_k32 | 6 | 4 | 5 |
| hot_k32 | shuffled_strategy_k32_base_missed | 6 | 4 | 4 |
| hot_k32 | semantic_strategy_k32_base_missed | 6 | 4 | 3 |
| hot_k32 | base_plus_semantic_strategy_k32 | 6 | 4 | 3 |
| hot_k32 | base_plus_shuffled_strategy_k32 | 6 | 4 | 4 |
| diverse_k32 | union_k32 | 9 | 0 | 4 |
| diverse_k32 | union_k128 | 9 | 0 | 6 |
| diverse_k32 | semantic_strategy_k32 | 6 | 3 | 5 |
| diverse_k32 | shuffled_strategy_k32_base_missed | 6 | 3 | 4 |
| diverse_k32 | semantic_strategy_k32_base_missed | 6 | 3 | 3 |
| diverse_k32 | base_plus_semantic_strategy_k32 | 6 | 3 | 3 |
| diverse_k32 | base_plus_shuffled_strategy_k32 | 6 | 3 | 4 |
| union_k32 | union_k128 | 13 | 0 | 2 |
| union_k32 | semantic_strategy_k32 | 7 | 6 | 4 |
| union_k32 | shuffled_strategy_k32_base_missed | 7 | 6 | 3 |
| union_k32 | semantic_strategy_k32_base_missed | 7 | 6 | 2 |
| union_k32 | base_plus_semantic_strategy_k32 | 7 | 6 | 2 |
| union_k32 | base_plus_shuffled_strategy_k32 | 7 | 6 | 3 |
| union_k128 | semantic_strategy_k32 | 9 | 6 | 2 |
| union_k128 | shuffled_strategy_k32_base_missed | 9 | 6 | 1 |
| union_k128 | semantic_strategy_k32_base_missed | 8 | 7 | 1 |
| union_k128 | base_plus_semantic_strategy_k32 | 8 | 7 | 1 |
| union_k128 | base_plus_shuffled_strategy_k32 | 9 | 6 | 1 |
| semantic_strategy_k32 | shuffled_strategy_k32_base_missed | 10 | 1 | 0 |
| semantic_strategy_k32 | semantic_strategy_k32_base_missed | 9 | 2 | 0 |
| semantic_strategy_k32 | base_plus_semantic_strategy_k32 | 9 | 2 | 0 |
| semantic_strategy_k32 | base_plus_shuffled_strategy_k32 | 10 | 1 | 0 |
| shuffled_strategy_k32_base_missed | semantic_strategy_k32_base_missed | 9 | 1 | 0 |
| shuffled_strategy_k32_base_missed | base_plus_semantic_strategy_k32 | 9 | 1 | 0 |
| shuffled_strategy_k32_base_missed | base_plus_shuffled_strategy_k32 | 10 | 0 | 0 |
| semantic_strategy_k32_base_missed | base_plus_semantic_strategy_k32 | 9 | 0 | 0 |
| semantic_strategy_k32_base_missed | base_plus_shuffled_strategy_k32 | 9 | 0 | 1 |
| base_plus_semantic_strategy_k32 | base_plus_shuffled_strategy_k32 | 9 | 0 | 1 |
Training Data
- Semantic SFT rows: 244 from 60 tasks; final logged loss 0.10642203688621521.
- Shuffled SFT rows: 244 from 60 tasks; final logged loss 0.14613600075244904.
- Semantic row counts by assigned strategy: COMPREHENSION=28, DIRECT=34, LOOP=45, MATH=19, RECURSION=73, SET_DICT=8, SORTING=8, STRING_REGEX=29
- Shuffled row counts by assigned strategy: COMPREHENSION=36, DIRECT=28, LOOP=23, MATH=31, RECURSION=32, SET_DICT=21, SORTING=43, STRING_REGEX=30

Design Notes
- The adapters were trained only on verified hidden-correct samples from MBPP train tasks.
- The semantic adapter maps each correct sample to a structural strategy token; the shuffled control keeps the same target programs but breaks the mapping between token and program mode.
- The primary comparison is base-miss recovery at K32-equivalent sampling cost: base + semantic strategy K32 on misses vs hot K32 vs the more expensive K32 union.
- Forward-token totals are cumulative for full 80-task arms; base-missed-only diagnostic rows show the extra strategy-token sampling cost on the 24 missed tasks.
- The all-80 semantic strategy pass is reported as a diagnostic only; it is not the fair budget comparison because it also spends strategy-token samples on tasks the base K4 pool already solved.
- Large adapter artifacts are stored outside this experiment package under
/workspace/large_artifacts/qwen35_4b_strategy_token_diversity_lora.
Files
- Config:
configs/experiment.json - Log:
logs/experiment_log.md - Records and manifests:
data/ - Scripts:
scripts/ - Figures:
reports/figures/
Experiment log 8
Show the running log (8 entries)
Date: 2026-06-25
Experiment directory: /workspace/experiments/qwen35_4b_strategy_token_diversity_lora
Large artifact directory: /workspace/large_artifacts/qwen35_4b_strategy_token_diversity_lora
Objective
Train a small QLoRA adapter that conditions generation on explicit strategy keys, then test whether K=32 strategy-conditioned sampling recovers more held-out MBPP base misses than hot K=32 sampling at comparable budget and whether it approaches the K=32 multi-policy union at lower cost.
Design Commitments
- Use Qwen3.5-4B only.
- Keep this package standalone with its own config, scripts, data, logs, reports, and figures.
- Store adapters outside the experiment directory.
- Train on self-generated solutions verified by execution on MBPP train tasks.
- Evaluate on held-out MBPP tasks with hidden tests reserved for scoring.
- Use hot K=32 and K=32 multi-policy union as mandatory baselines.
- Include a shuffled-strategy-assignment control.
- Judge diversity by hidden-test coverage and functional failure-set diversity, not surface variety alone.
Initial Package
- Created standalone experiment and large-artifact directories.
- Added package-local execution, sampling, evaluation, and model utilities.
- Added local baseline artifacts for the held-out K=4, hot K=32, and union K=32 comparisons.
Smoke: Train Mining and SFT Row Construction
Completed smoke_train_k8 on 8 MBPP train tasks with 8 samples/task.
- Hidden coverage: 6 / 8 = 75.0%.
- Mean hidden-pass candidates/task: 2.875.
- Estimated forward tokens: 15,412.
Built semantic and shuffled smoke SFT rows.
- Semantic rows: 11 rows from 6 tasks.
- Shuffled rows: 11 rows from the same 6 tasks.
- Smoke caught and fixed a fragile structural-classifier regex before any long run.
Decision: mining, execution verification, strategy classification, and shuffled assignment work. Proceed to main train-data mining.
Main Train-Data Mining
Completed main_train_k16 on 80 MBPP train tasks with 16 samples/task.
- Hidden coverage: 60 / 80 = 75.0%.
- Mean deduped candidates/task: 13.03.
- Mean hidden-pass candidates/task: 6.53.
- Mean functional diversity rate: 0.194.
- Estimated forward tokens: 303,040.
Built full SFT datasets from verified hidden-correct self-generated candidates.
- Semantic strategy rows: 244 rows from 60 tasks.
- Shuffled strategy rows: 244 rows from the same 60 tasks.
- Semantic strategy counts: COMPREHENSION 28, DIRECT 34, LOOP 45, MATH 19, RECURSION 73, SET_DICT 8, SORTING 8, STRING_REGEX 29.
- Shuffled control preserves the same targets but breaks the semantic strategy-to-target mapping.
Decision: the data is broad enough for a pilot adapter, though SET_DICT and SORTING are sparse. Train semantic and shuffled QLoRA adapters and compare them on held-out K=32 strategy sampling.
Adapter Training
Completed semantic strategy LoRA training.
- Train rows: 244.
- Steps: 120.
- LoRA rank/alpha/dropout: 16 / 32 / 0.05.
- Final logged loss: 0.106.
- Adapter path:
/workspace/large_artifacts/qwen35_4b_strategy_token_diversity_lora/models/semantic_strategy_lora.
Completed shuffled strategy LoRA training with the same hyperparameters and targets but shuffled strategy assignments.
- Train rows: 244.
- Steps: 120.
- Final logged loss: 0.146.
- Adapter path:
/workspace/large_artifacts/qwen35_4b_strategy_token_diversity_lora/models/shuffled_strategy_lora.
Decision: both adapters fit the small verified dataset. Proceed to held-out K=32 strategy sampling; the comparison against shuffled assignment will decide whether semantic strategy labels add anything.
Held-Out Strategy Sampling
Completed an all-80 semantic strategy diagnostic first.
- Standalone semantic K=32 coverage: 65 / 80 = 81.25%.
- Base-miss recovery: 11 / 24.
- Forward tokens: 627,176.
- Interpretation: this diagnostic was useful for coverage shape, but it is not the fair efficiency comparison because it spends strategy-token samples on tasks the base K=4 pool already solved.
Created the exact 24-task base-miss subset and reran the intended deployable setting: base K=4 for all tasks plus strategy K=32 only on the base-missed tasks.
Fair held-out comparison:
base_k4: 56 / 80 coverage, 0 / 24 recovered, 69,645 forward tokens.hot_k32: 66 / 80 coverage, 10 / 24 recovered, 243,343 cumulative forward tokens.union_k32: 69 / 80 coverage, 13 / 24 recovered, 582,812 cumulative forward tokens.base_plus_semantic_strategy_k32: 65 / 80 coverage, 9 / 24 recovered, 274,406 cumulative forward tokens.base_plus_shuffled_strategy_k32: 66 / 80 coverage, 10 / 24 recovered, 283,391 cumulative forward tokens.
Recovered task IDs:
- Semantic subset: 22, 31, 35, 36, 42, 67, 81, 84, 87.
- Shuffled subset: 22, 31, 35, 36, 42, 67, 73, 81, 84, 87.
- Hot K=32: 15, 22, 35, 36, 42, 55, 59, 67, 70, 81.
- Union K=32: 15, 22, 34, 35, 36, 42, 55, 59, 67, 70, 81, 83, 87.
Decision: the strategy-token LoRA is a clear null for the intended claim. The semantic adapter did not beat hot sampling at matched scale, did not approach the union, and underperformed the shuffled-key control. The shuffled control matching hot K=32 means the recoveries are attributable to extra stochastic samples under longer strategy prompts, not to a meaningful learned strategy-key-to-mode mapping.
Report
Generated the final report and figures.
- Report:
reports/final_report.md - Summary JSON:
reports/summary.json - Figures:
reports/figures/coverage_and_recovery.png,reports/figures/training_losses.png
Main conclusion: small strategy-token QLoRA did not buy sampling efficiency. For this run, inference-time diverse/hot sampling remains the stronger lever.
Figures 2
Data files 1
Result tables and metrics copied from the experiment folder — preview inline or open the raw file.
reports/summary.json6.7 kB
Reproduce
Run steps are documented inside the experiment folder (README and scripts).