Skip to content

Commit 76baedb

Browse files
ryanyxwclaude
andcommitted
models_fullextend: config #3 (random/always/detachF) + uniform MC9 plumbing
- add config #3 ghost run script (random coeff mode; completes the sweep) - register config #3 in CE-curves export - add uniform run to convert_to_hf (HF coeff-mode now derived from runname), launch_mc9_eval (idempotent: skips already-scored configs), and the MC9 results export columns - README status: config #2 complete (CE 2.690, neutral), config #3 launched Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 77d70e9 commit 76baedb

6 files changed

Lines changed: 103 additions & 8 deletions

File tree

scripts/models_fullextend/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ hist = {int(x["_step"]): x["train/CE loss"] for x in r.scan_history(keys=["_step
147147
hard-stop, **final CE 2.654** vs the no-ghost baseline's **2.689** at the same
148148
step (mean gap over the run &asymp; &minus;0.005). The ghost adds no convergence
149149
penalty (slight edge at 50B; within run-to-run noise).
150-
- In progress: config #2 (`uniform / always / detachF`); remaining
151-
coefficient-mode / `detach_coeff` configs chosen incrementally.
152-
- Not yet done: the downstream "actually add a new expert and measure
153-
degradation" evaluation; the `topk` route.
150+
- **Config #2 (`uniform / always / detachF`) complete** &mdash; trained to the 50B
151+
hard-stop, **final CE 2.690** vs the no-ghost baseline's **2.689** at the same
152+
step (essentially identical, +0.001). A naive uniform pool-average ghost is
153+
convergence-neutral; the usage-weighted blend's slight edge does not transfer
154+
to the uniform mode.
155+
- **Config #3 (`random / always / detachF`) launched** &mdash; completes the
156+
coefficient-mode sweep. `detach_coeff` is a no-op for `random` (alpha constant).
157+
- Not yet done: MC9 distribution-shift probe for config #2 (HF conversion + eval
158+
in flight); the downstream "actually add a new expert and measure degradation"
159+
evaluation; the `topk` route.

scripts/models_fullextend/convert_to_hf.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MODELS_DIR="${MODELS_DIR:-models_fullextend}"
1212
# "<olmo-core checkpoint dir>|<HF output dir>". Add configs as they finish.
1313
MODELS=(
1414
"${MODELS_DIR}/emo_1b14b_130b_ghost_usage_always_detachF/step11921|${MODELS_DIR}/emo_1b14b_130b_ghost_usage_always_detachF/step11921-hf"
15+
"${MODELS_DIR}/emo_1b14b_130b_ghost_uniform_always_detachF/step11921|${MODELS_DIR}/emo_1b14b_130b_ghost_uniform_always_detachF/step11921-hf"
1516
)
1617

1718
for PAIR in "${MODELS[@]}"; do
@@ -32,10 +33,17 @@ for PAIR in "${MODELS[@]}"; do
3233
done
3334

3435
# Materialize the ghost-on variant (symlinked weights + config.json with the toggle) for
35-
# each converted checkpoint, so the MC9 eval can run the with-ghost arm.
36+
# each converted checkpoint, so the MC9 eval can run the with-ghost arm. The eval-time
37+
# ghost coeff_mode is matched to the run's training coeff_mode, read off the runname
38+
# (..._ghost_<mode>_always_detachF/...): usage -> usage, uniform -> uniform, random -> random.
3639
for PAIR in "${MODELS[@]}"; do
3740
OUTPUT="${PAIR##*|}"
3841
if [ -f "${OUTPUT}/config.json" ]; then
39-
python scripts/models_fullextend/make_ghost_hf_variant.py --src "${OUTPUT}" --coeff-mode usage
42+
case "$OUTPUT" in
43+
*_ghost_uniform_*) COEFF_MODE=uniform ;;
44+
*_ghost_random_*) COEFF_MODE=random ;;
45+
*) COEFF_MODE=usage ;;
46+
esac
47+
python scripts/models_fullextend/make_ghost_hf_variant.py --src "${OUTPUT}" --coeff-mode "${COEFF_MODE}"
4048
fi
4149
done
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# PARENT: "scripts/models_fullextend/emo_1b14b_130b_ghost_uniform_always_detachF.sh"
2+
# DESCRIPTION:
3+
# - models_fullextend ghost-expert SWEEP run, config #3.
4+
# Ghost knobs: coeff_mode=random, route=always, detach_coeff=false, num=1, random_k=8.
5+
# Completes the coeff_mode sweep (usage / uniform / random). Each ghost is the
6+
# uniform average over a random sample of random_k=8 document-pool experts
7+
# (re-sampled per forward). detach_coeff is a no-op for random (alpha is constant).
8+
# - 16 nodes, max_duration=130B, hard_stop=50B. 2-deep rolling checkpoints + final;
9+
# pre_train_checkpoint disabled (skip the useless random-init step0).
10+
##############################################################
11+
source "$(dirname "${BASH_SOURCE[0]}")/../launch_common.sh"
12+
13+
EXPERIMENT_NAME="models_fullextend"
14+
MODELS_DIR="/weka/oe-training-default/ryanwang/EMO/${EXPERIMENT_NAME}"
15+
DATA_ROOT="s3://ai2-llm"
16+
17+
BEAKER_NODES=16
18+
BEAKER_GPUS=8
19+
20+
min_document_expert_pool=8
21+
max_document_expert_pool=128
22+
eval_document_expert_pool=32
23+
lr=4e-3
24+
lb=1e-1
25+
26+
num_shared_experts=1 # 1 out of 8 will be shared experts
27+
28+
# --- ghost-expert knobs (this run) ---
29+
ghost_extend_num=1 # fixed across the sweep
30+
ghost_extend_random_k=8 # fixed across the sweep
31+
ghost_extend_coeff_mode="random" # swept: usage | uniform | random
32+
ghost_extend_route="always" # swept: always (topk not implemented)
33+
ghost_extend_detach_coeff=false # swept: false | true (no-op for random)
34+
35+
runname="emo_1b14b_130b_ghost_random_always_detachF"
36+
37+
launch src/scripts/train/olmoe-1B-7B_fsl.py $runname \
38+
--save-folder="${MODELS_DIR}/$runname" \
39+
--dataset.mix=OLMoE-mix-0824 \
40+
--work-dir="${DATASET_CACHE}" \
41+
--trainer.max_duration='{value: 130_000_000_000, unit: tokens}' \
42+
--trainer.hard_stop='{value: 50_000_000_000, unit: tokens}' \
43+
--trainer.callbacks.checkpointer.save_interval=1000000 \
44+
--trainer.callbacks.checkpointer.ephemeral_save_interval=500 \
45+
--trainer.callbacks.checkpointer.keep_ephemeral=2 \
46+
--trainer.callbacks.checkpointer.pre_train_checkpoint=false \
47+
--trainer.callbacks.wandb.enabled=true \
48+
--trainer.callbacks.wandb.entity=ryanyxw \
49+
--trainer.callbacks.wandb.project=emo-extension \
50+
--trainer.callbacks.wandb.name="${runname}" \
51+
--trainer.callbacks.wandb.tags="[pretraining, ${EXPERIMENT_NAME}]" \
52+
--model.block.feed_forward_moe.num_experts=128 \
53+
--dataset.generate_doc_lengths=true \
54+
--model.block.sequence_mixer.backend=flash_2 \
55+
--model-type="two-level_lb-batch_reduce-dp_sharedexp_randpool" \
56+
--min_document_expert_pool=${min_document_expert_pool} \
57+
--max_document_expert_pool=${max_document_expert_pool} \
58+
--eval_document_expert_pool=${eval_document_expert_pool} \
59+
--num_shared_experts=$num_shared_experts \
60+
--dataset.instance_filter_config='{repetition_max_period: 13, repetition_min_period: 1, repetition_max_count: 32}' \
61+
--model.block.name="moe" \
62+
--model.block.sequence_mixer.qk_norm=null \
63+
--lr=${lr} \
64+
--model.block.feed_forward_moe.lb_loss_weight=${lb} \
65+
--model.block.feed_forward_moe.router.ghost_extend_mode=true \
66+
--model.block.feed_forward_moe.router.ghost_extend_num=${ghost_extend_num} \
67+
--model.block.feed_forward_moe.router.ghost_extend_coeff_mode=${ghost_extend_coeff_mode} \
68+
--model.block.feed_forward_moe.router.ghost_extend_random_k=${ghost_extend_random_k} \
69+
--model.block.feed_forward_moe.router.ghost_extend_route=${ghost_extend_route} \
70+
--model.block.feed_forward_moe.router.ghost_extend_detach_coeff=${ghost_extend_detach_coeff}

scripts/models_fullextend/export_ce_curves.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
),
3535
("ryanyxw/emo-extension", "emo_1b14b_130b_ghost_usage_always_detachF", "usage / always / detachF"),
3636
("ryanyxw/emo-extension", "emo_1b14b_130b_ghost_uniform_always_detachF", "uniform / always / detachF"),
37+
("ryanyxw/emo-extension", "emo_1b14b_130b_ghost_random_always_detachF", "random / always / detachF"),
3738
]
3839

3940
# (chart key, wandb metric key, chart title, make_chart). make_chart=False metrics are

scripts/models_fullextend/export_mc9_results.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
# (run dir, mode, column label). Order = display order.
1818
COLUMNS = [
1919
("no_ghost_baseline_130b", "standard", "no-ghost baseline (130B)"),
20-
("ghost_usage_50b", "standard", "ghost-trained, ghost OFF (50B)"),
21-
("ghost_usage_50b", "ghost", "ghost-trained, ghost ON (50B)"),
20+
("ghost_usage_50b", "standard", "usage ghost-trained, ghost OFF (50B)"),
21+
("ghost_usage_50b", "ghost", "usage ghost-trained, ghost ON (50B)"),
22+
("ghost_uniform_50b", "standard", "uniform ghost-trained, ghost OFF (50B)"),
23+
("ghost_uniform_50b", "ghost", "uniform ghost-trained, ghost ON (50B)"),
2224
]
2325

2426

scripts/models_fullextend/launch_mc9_eval.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ DRY_RUN="${DRY_RUN:-0}"
3535
# "name|hf_path|modes" (modes = space-separated subset of {standard, ghost})
3636
MODELS=(
3737
"ghost_usage_50b|${WEKA_ROOT}/models_fullextend/emo_1b14b_130b_ghost_usage_always_detachF/step11921-hf|standard ghost"
38+
"ghost_uniform_50b|${WEKA_ROOT}/models_fullextend/emo_1b14b_130b_ghost_uniform_always_detachF/step11921-hf|standard ghost"
3839
"no_ghost_baseline_130b|${WEKA_ROOT}/models_sizescaling/emo_1b14b_130b/step30995-hf|standard"
3940
)
4041

@@ -68,6 +69,13 @@ launch_one() {
6869
job="mc9-${name}-${mode}-${safe_task}"
6970
job=$(echo "$job" | sed 's/[^a-zA-Z0-9_-]//g' | cut -c1-80)
7071

72+
# Idempotent: skip configs already scored (so re-running to add a new model doesn't
73+
# re-submit the finished usage/baseline jobs). Set FORCE=1 to re-run regardless.
74+
if [ "${FORCE:-0}" != "1" ] && [ -f "${out}/metrics.json" ]; then
75+
echo "=== skip ${name} | ${mode} | ${task} (metrics.json exists) ==="
76+
return
77+
fi
78+
7179
echo ">>> ${name} | ${mode} | ${task} -> ${out}"
7280
if [ "$DRY_RUN" = "1" ]; then
7381
echo " model: ${hf_path}"

0 commit comments

Comments
 (0)