Research log Small Model Experimentation
GitHub

Qwen3.5-4B Strategy Token Diversity LoRA

Naming coding tactics did not beat plain retries

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.

Problems the model failed on its quick first pass24 of 80about 1 in 3 coding tasks missed
Failures recovered by labeled tactics vs plain retries37.5% vs 41.7%same cost, and tactic labels did not win
Recovery when the tactic labels were scrambled to mean nothing41.7%matched the plain retries, so the labels added nothing
Best recovery from brute-force pooled sampling62.5%the pricey option at roughly triple the tries
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Question
    2. Result
    3. Arms
    4. Recovered Task IDs
    5. Recovery Overlap
    6. Training Data
    7. Design Notes
    8. Files
  4. Experiment log
  5. Figures
  6. Data files
  7. Reproduce
  8. Related

Results at a glance 2

Recovering failed problems: tactic labels vs plain extra tries

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.

0%20%40%60%80%base K4base K40%default K32default K3233.3%diverse K32diverse K3237.5%hot K32hot K3241.7%base + semantic strategy K32base + semantic strategy K3237.5%base + shuffled strategy K32base + shuffled strategy K3241.7%union K32union K3254.2%union K128union K12862.5%

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 armbase-miss recovery rate
base K40%
default K3233.3%
diverse K3237.5%
hot K3241.7%
base + semantic strategy K3237.5%
base + shuffled strategy K3241.7%
union K3254.2%
union K12862.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.

Share of all problems solved, by sampling method

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%.

0%25%50%75%100%base K4base K470%default K32default K3280%diverse K32diverse K3281.2%hot K32hot K3282.5%base + semantic strategy K32base + semantic strategy K3281.2%base + shuffled strategy K32base + shuffled strategy K3282.5%union K32union K3286.2%union K128union K12888.8%

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 armcoverage
base K470%
default K3280%
diverse K3281.2%
hot K3282.5%
base + semantic strategy K3281.2%
base + shuffled strategy K3282.5%
union K3286.2%
union K12888.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.

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

armrecordscoveragebase-miss recoveredbase-miss recoverymean candidatesfunctional diversityforward tokens
base_k48070.0%0/240.0%3.4547.7%69,645
default_k328080.0%8/2433.3%10.2835.8%235,491
hot_k328082.5%10/2441.7%11.3935.9%243,343
diverse_k328081.2%9/2437.5%11.0436.2%243,268
union_k328086.2%13/2454.2%24.0934.0%582,812
union_k1288088.8%15/2462.5%29.3133.8%698,783
base_plus_semantic_strategy_k328081.2%9/2437.5%11.5135.4%274,406
base_plus_shuffled_strategy_k328082.5%10/2441.7%11.6835.9%283,391
semantic_strategy_k32_base_missed2437.5%9/2437.5%27.3311.8%204,761
shuffled_strategy_k32_base_missed2441.7%10/2441.7%27.7113.8%213,746
semantic_strategy_k328081.2%11/2445.8%23.1013.8%627,176

Coverage and recovery

Recovered Task IDs

  • base_k4: none
  • default_k32: 22, 35, 36, 42, 67, 70, 81, 87
  • hot_k32: 15, 22, 35, 36, 42, 55, 59, 67, 70, 81
  • diverse_k32: 22, 34, 35, 36, 42, 59, 67, 81, 83
  • union_k32: 15, 22, 34, 35, 36, 42, 55, 59, 67, 70, 81, 83, 87
  • union_k128: 15, 22, 34, 35, 36, 42, 55, 59, 67, 70, 73, 81, 83, 84, 87
  • semantic_strategy_k32: 22, 31, 35, 36, 42, 48, 67, 73, 81, 84, 87
  • shuffled_strategy_k32_base_missed: 22, 31, 35, 36, 42, 67, 73, 81, 84, 87
  • semantic_strategy_k32_base_missed: 22, 31, 35, 36, 42, 67, 81, 84, 87
  • base_plus_semantic_strategy_k32: 22, 31, 35, 36, 42, 67, 81, 84, 87
  • base_plus_shuffled_strategy_k32: 22, 31, 35, 36, 42, 67, 73, 81, 84, 87

Recovery Overlap

arm Aarm Brecovered overlapA onlyB only
default_k32hot_k32713
default_k32diverse_k32623
default_k32union_k32805
default_k32union_k128807
default_k32semantic_strategy_k32714
default_k32shuffled_strategy_k32_base_missed713
default_k32semantic_strategy_k32_base_missed712
default_k32base_plus_semantic_strategy_k32712
default_k32base_plus_shuffled_strategy_k32713
hot_k32diverse_k32732
hot_k32union_k321003
hot_k32union_k1281005
hot_k32semantic_strategy_k32645
hot_k32shuffled_strategy_k32_base_missed644
hot_k32semantic_strategy_k32_base_missed643
hot_k32base_plus_semantic_strategy_k32643
hot_k32base_plus_shuffled_strategy_k32644
diverse_k32union_k32904
diverse_k32union_k128906
diverse_k32semantic_strategy_k32635
diverse_k32shuffled_strategy_k32_base_missed634
diverse_k32semantic_strategy_k32_base_missed633
diverse_k32base_plus_semantic_strategy_k32633
diverse_k32base_plus_shuffled_strategy_k32634
union_k32union_k1281302
union_k32semantic_strategy_k32764
union_k32shuffled_strategy_k32_base_missed763
union_k32semantic_strategy_k32_base_missed762
union_k32base_plus_semantic_strategy_k32762
union_k32base_plus_shuffled_strategy_k32763
union_k128semantic_strategy_k32962
union_k128shuffled_strategy_k32_base_missed961
union_k128semantic_strategy_k32_base_missed871
union_k128base_plus_semantic_strategy_k32871
union_k128base_plus_shuffled_strategy_k32961
semantic_strategy_k32shuffled_strategy_k32_base_missed1010
semantic_strategy_k32semantic_strategy_k32_base_missed920
semantic_strategy_k32base_plus_semantic_strategy_k32920
semantic_strategy_k32base_plus_shuffled_strategy_k321010
shuffled_strategy_k32_base_missedsemantic_strategy_k32_base_missed910
shuffled_strategy_k32_base_missedbase_plus_semantic_strategy_k32910
shuffled_strategy_k32_base_missedbase_plus_shuffled_strategy_k321000
semantic_strategy_k32_base_missedbase_plus_semantic_strategy_k32900
semantic_strategy_k32_base_missedbase_plus_shuffled_strategy_k32901
base_plus_semantic_strategy_k32base_plus_shuffled_strategy_k32901

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

Training losses

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.

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.

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

coverage and recovery
coverage and recovery · reports/figures/
training losses
training losses · reports/figures/

Data files 1

Result tables and metrics copied from the experiment folder — preview inline or open the raw file.

Reproduce

Run steps are documented inside the experiment folder (README and scripts).

Browse the experiment folder on GitHub ↗