Reuse wiring for compute-limited pretraining
Research question
With the decoder's parameters and the training data strictly fixed, which way of reusing computation
inside a decoder -- sharing or fusing keys and values across layers, reusing values, gating a
memory computed earlier instead of recomputing it, letting tokens skip blocks, routing
information across depth -- reaches a given loss with the least training compute? The
decoder's weights (shapes and initialisation), the data, the optimizer and its learning-rate
schedule, and the evaluation are fixed; how the blocks are called and what they share is yours,
and you may set the learning-rate value. The feed-forward sublayer (its norms, router, routed experts
and shared expert) is fixed: compute it only through routing.mlp_delta, mlp_half, block,
stack or block_step; where, how often and on which tokens you apply it, and how you reuse its
output, is yours.
Where a layer keeps softmax attention, the attention itself is computed as the decoder computes it,
with the same query and key normalisation, positional encoding, scale and exclusive self-attention,
as in every reference method. Memories that work at the level of tokens rather than across layers,
such as an n-gram memory, are outside the question.
The state kept for decoding holds its values at the decoder's working precision or wider; compressing its number format (quantisation, bit-packing, entropy coding) is outside the question.
The method must retain held-out language-model quality while reducing training computation or the state kept during decoding.
Setting names (names only): d128, d256, d384, d512, d640, d768, d896, d1024.
Metrics
Minimize language-modelling loss, training FLOPs and decoding-state bytes while preserving long-range recall.
/opt/task/selfcheck measures your recipe's training FLOPs per token and the default recipe's on a short development run, counted as the evaluation counts them, when MOE_SELFCHECK_DATA_DIR names a training data directory (MOE_SELFCHECK_LEVEL picks the setting).
Approach
Aim for an algorithmic contribution. Find the real problem in the component you
edit, build a deep understanding of it, whether through theoretical analysis or
experiments, and solve it. Do not rely on hyperparameter tuning or on recombining
existing methods.
What You May Change
You work inside /workspace; the task's code is the source tree
/workspace/moe-lm/. A copy of this instruction is at
/opt/task/INSTRUCTION.md.
Editable regions
Edit only these files, and only inside the listed line ranges: the code in these
regions is your submission. Line numbers are 1-based and inclusive, counted in
the file as it is in /workspace when your session starts (the numbering
cat -n shows). A range marks a region, not a line count: you may add or remove
lines inside it as long as everything outside it stays byte-identical. In the excerpts, > marks lines inside a region.
42 timing or counting probes, gradient hooks and file access are forbidden (moe_lm/guard.py lists them).
43 """
44 # ----- BEGIN EDITABLE REGION -----
> 45 import torch.nn as nn
> ... (lines 46-78)
> 79 return Routed(cfg, backbone)
80 # ----- END EDITABLE REGION -----
Creating or deleting any file in the task's own source trees
(/workspace/moe-lm/ and anything else present at the start) is not
allowed. Files you write elsewhere (scratch space, caches, checkpoints,
$OUTPUT_DIR, /tmp) are not part of the submission.
Interface
The signatures of the functions and classes in the editable regions stay as they
are; evaluation imports them by name.
Every parameter a model adds is assigned an optimizer group by shape: a matrix whose last
two dimensions are both at least 128 uses MuonH, everything else Adam. The decoder's own
parameters keep their groups, parameter tags do not change these assignments, and decoder
parameters must not be re-tagged. The optimizer (MuonH / Adam by shape) and the learning-rate
schedule (its type and shape, warmup, minimum-LR ratio and decay length) are fixed; only the
learning-rate value (the peak learning rate, one number) may be set, through the optional
lr_config hook in the plugin file; omitting it keeps the default per-level learning rate.
Limits
- Model size: the decoder's own parameters plus every tensor the model holds outside the decoder (parameters trainable or frozen, buffers persistent or not, including buffers first registered during training, and tensors held as attributes or inside lists, tuples and dicts) must not exceed the largest reference method's: at most 330,607,340, 748,971,561, 2,046,365,519 or 4,780,352,654 when
ctx.hidden_dim is 384, 512, 768 or 1024 respectively (the decoder alone has 329,720,064, 746,605,568, 2,039,268,864 and 4,764,581,888; the largest reference method holds 330,607,104, 748,971,008, 2,046,365,184 and 4,780,351,488). Backbone parameters a model leaves unused still count toward the total. /opt/task/selfcheck prints this count for your model at each of these widths.
- Evaluation compute per token: the trusted FlopCounter measures total evaluation FLOPs divided by the counted evaluation tokens, against the per-level cap passed to the runner. You can run the same FlopCounter on a representative batch before evaluation to check your design.
- Exact training-token accounting: the recorded total must equal the level plan,
batch_size * num_steps * seq_len with seq_len = 8192 (or max(1, round(token_fraction * num_steps)) * batch_size * seq_len for an explicitly shortened run). The runtime context exposes ctx.tokens with this total so the plugin can check it before evaluation.
- Exact parameter accounting:
abs(total / sum(p.numel() for p in the reference decoder's parameters) - 1) <= PTOL, where total is the model size above, counted as the trusted runner counts it: from each module's own parameter, buffer and submodule tables and its tensor attributes, each tensor once. The PTOL is 0.002691, 0.003169, 0.00348, or 0.00331 when ctx.hidden_dim is 384, 512, 768, or 1024 respectively; the editable module receives the reference decoder as backbone and can perform this count before evaluation.
- Decoding compute per token: when
ctx.hidden_dim is 512, decode_step may use at most 130,296,820 FLOPs per token, counted by the trusted FlopCounter (vocabulary work included, routing.EXACT_DECODE_KEYS = True) at any position of a context of up to 8,192 tokens decoded from its first token. You can run the same FlopCounter around your own decode_step on a long document before evaluation.
- Learning rate: only the peak value (peak_lr in (0, 1], or scale in (0, 1000] with the MuonH peak <= 1); the schedule is fixed.
- Time with EVAL = 'recurrent': training must still finish within the setting's stated time; the evaluation phase then has its own additional allowance, in which the token-by-token evaluation must not be slower than the slowest reference method's. With EVAL = 'parallel' the stated time covers training and evaluation, with no additional allowance.
Interface rules
- decode_init(batch, max_len, device) and decode_step(tok, pos, seg_start, state) are required for EVAL = 'recurrent' and optional otherwise; if provided they must reproduce hidden() for the context supplied to decode_init: against the parallel evaluation of the same text, per-token losses differ by at most 0.002 in absolute mean (float32 and bfloat16 decoding) and, in float32, by at most 0.01 in mean absolute difference.
- Outputs must be causal and independent across rows, with no memory retained across batches.
- Compute must run as PyTorch operations in the training process; off-dispatcher computation, other array libraries, custom kernels, graph replay, torch.compile, extra threads, timing or counting probes, gradient hooks and file access are forbidden (see the source restrictions in the notes).
Notes
- If the submission fails at any width for any reason (for example a crash, a timeout, a non-finite result, or a parameter or recorded-token mismatch), the whole run receives no score; results at the other widths do not offset it.
- The functions and methods of moe_lm and torch must be unchanged after the plugin loads, the data directories may not be opened, and no process may be started.
- Evaluation rebuilds the module with make_model(cfg, backbone) under the training seed and loads the saved state_dict: parameters and persistent buffers, including buffers first registered during training. Plain attributes set during training (for example a loop count driven by ctx.frac) are not saved, so evaluation sees their make_model values; keep anything evaluation must see in a persistent buffer.
Shared rules
The code you edit is checked statically before it runs. It may not hold a
string that could form a result line of the fixed code, nor rebind or redirect
print, sys.stdout or sys.stderr. It may not end the process with
os._exit, os.abort or os.kill (sys.exit is fine). It may not run
dynamically built code (exec, eval, the built-in compile). It may not
reach interpreter frames, tracers, the garbage collector or ctypes. It may
not write into imported modules or into names the fixed code binds (library
settings are fine). It may not read function or autograd-graph internals. An
edited file may not exceed 32 MiB.
/opt/task/selfcheck runs the edit-range check, these checks and this task's own source rules on your
workspace and prints each refusal with its file, line, rule and reason;
/opt/task/selfcheck --rules prints the full rule list, this task's own included.
Read-only context
Other files you may read for context (do not modify):
- moe-lm/moe_lm/routing.py
- moe-lm/moe_lm/model.py
- moe-lm/moe_lm/config.py
- moe-lm/moe_lm/optim.py
Reference Methods
Each reference method's code is in the image, read-only:
/opt/task/baselines/<name>/ holds your editable file(s) with that method
applied, at the same paths relative to /workspace/, so
diff /workspace/<path> /opt/task/baselines/<name>/<path> shows what it
changes. /opt/task/baselines/README.md has the full citations. Evaluation does
not read these files.
attnres: Attention Residuals (Full); Kimi Team, arXiv preprint 2026 (https://arxiv.org/abs/2603.15031). /opt/task/baselines/attnres/
cla: Cross-Layer Attention; Brandon et al., arXiv preprint 2024 (https://arxiv.org/abs/2405.12981). /opt/task/baselines/cla/
fusedkv: FusedKV; Lin et al., ICLR 2026 (https://arxiv.org/abs/2512.03870). /opt/task/baselines/fusedkv/
hc: Hyper-Connections; Zhu et al., ICLR 2025 (https://arxiv.org/abs/2409.19606). /opt/task/baselines/hc/
mhc: mHC: manifold-constrained hyper-connections; Xie et al., arXiv preprint 2025 (https://arxiv.org/abs/2512.24880). /opt/task/baselines/mhc/
mod: Mixture-of-Depths; Raposo et al., arXiv preprint 2024 (https://arxiv.org/abs/2404.02258). /opt/task/baselines/mod/
null: Grug MoE decoder (the starter). The starter: your workspace as given.
resformer: ResFormer: value residual learning; Zhou et al., arXiv preprint 2024 (https://arxiv.org/abs/2410.17897). /opt/task/baselines/resformer/
sambay_a: SambaY-A; Ren et al., arXiv preprint 2025 (https://arxiv.org/abs/2507.06607). /opt/task/baselines/sambay_a/
svformer: SVFormer: single-value transformer; Zhou et al., arXiv preprint 2024 (https://arxiv.org/abs/2410.17897). /opt/task/baselines/svformer/
swa: Sliding-window attention; Beltagy et al., arXiv preprint 2020 (https://arxiv.org/abs/2004.05150). /opt/task/baselines/swa/
yoco: YOCO, gated-retention self-decoder; Sun et al., NeurIPS 2024 (https://arxiv.org/abs/2405.05254). /opt/task/baselines/yoco/
yoco_swa: YOCO, sliding-window self-decoder; Sun et al., NeurIPS 2024 (https://arxiv.org/abs/2405.05254). /opt/task/baselines/yoco_swa/
Submission
There is no submit step. When your session ends, the workspace is evaluated as
it stands, by evaluation scripts that are not in your workspace.
- Leave it runnable: complete edits only, and code that runs from the files
on disk. Every process from your session (GPU jobs, servers, workers) is
killed before evaluation starts. During evaluation, every process your code
starts must exit before the step that started it ends; a process left
running makes the submission invalid.
- Evaluation runs in a separate container: only your editable files are
copied into it. Your container does not include the evaluation data; obtain
what you need for development yourself.
- Improve the algorithm, not the measurement. The score must come from what
your component computes. Do not hard-code or reconstruct the evaluation's
data or expected answers in your submission; do not compute, print,
overwrite or influence the score yourself; do not change the clocks the
evaluation measures time with; do not reach the evaluation through any route
other than the component you implement, and do not fetch anything at
evaluation that the interface does not pass in. Do not look up this task,
the benchmark it belongs to, or its code repository online, and do not use
ready-made solutions to this task.
- A general method, not a fit to this evaluation. The evaluation may use
other data, models, conditions or seeds than you can run. Do not infer, probe
or hard-code which conditions are scored, and do not rely on weaknesses of
the fixed evaluation. Use one method for every setting: your own method runs
on each of them. You may configure it per setting as the reference methods do
(for example with different hyperparameter values), using what the interface
passes in (a setting label,
ENV, sizes, context fields). You may not run a
different algorithm, learner, model or objective on some settings, run a
reference method or the starter on some settings, or hand-write a solution
for a particular setting or environment (a controller, stored answers or
constructions, coordinates). Do not special-case other properties of the
inputs you happen to see (the identity or size of a dataset or model, class
counts, the environment).
A submission that breaks either rule is not a valid solution.
Time and Hardware
You have 12 hours of wall-clock time in this session, covering
everything you do here: reading the code, editing it, and any trial runs
you launch.
Evaluation is separate from your session. Your method must not be slower than the
slowest reference method; their implementations are in the image (see Reference
Methods), so you can time yours against them.
Your container has 3 × NVIDIA H200 (141 GB each), 32 CPU cores and 256 GB of RAM.
Evaluation runs on the same hardware. Its settings run side by side there, each on its own
GPU(s), sharing the CPU cores and memory.
This workspace has 200.0 GiB of disk; filling it ends the run, so prune large intermediate files (checkpoints, model copies) and check with df.
Good luck.