Text Generation
Transformers
Safetensors
English
qwen3_moe
qwen3-moe
qlora
distillation
reasoning
math
conversational
AlreadyAI commited on
Commit
7eb610d
·
verified ·
1 Parent(s): 3552845

Add published paper: bala_report.tex

Browse files
Files changed (1) hide show
  1. paper/bala_report.tex +849 -0
paper/bala_report.tex ADDED
@@ -0,0 +1,849 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ \documentclass[11pt]{article}
2
+ \usepackage[T1]{fontenc}
3
+ \usepackage{lmodern}
4
+ \usepackage[margin=1in]{geometry}
5
+ \usepackage{amsmath,amssymb}
6
+ \usepackage{booktabs}
7
+ \usepackage{graphicx}
8
+ \usepackage[hidelinks]{hyperref}
9
+ \usepackage{xcolor}
10
+ \usepackage{enumitem}
11
+ \usepackage{algorithm}
12
+ \usepackage{algpseudocode}
13
+ \usepackage{microtype}
14
+ \setlength{\emergencystretch}{3em}
15
+
16
+ \title{\textbf{Distilling Open Reasoning Corpora into a 3B-Active MoE on\\
17
+ Commodity GPUs: What Transfers, What Doesn't, and a Decontamination Check}}
18
+ \author{Tushar Chauhan\\ TushLab, AlreadyAI\\ \url{https://huggingface.co/AlreadyAI}}
19
+ \date{\today}
20
+
21
+ \begin{document}
22
+ \maketitle
23
+
24
+ \begin{abstract}
25
+ We present an honest, reproducible study of budget-constrained knowledge
26
+ distillation for reasoning, carried out on commodity hardware (a single node of
27
+ 4$\times$ NVIDIA L40S, no NVLink) for \$2{,}723 in GPU compute (\$3{,}091 all-in
28
+ with tax) against a \$3{,}000 budget. We LoRA-fine-tune
29
+ (QLoRA, 4-bit NF4, attention-only) the Mixture-of-Experts model
30
+ \textbf{Qwen3-30B-A3B-Thinking-2507} ($\sim$30B total, $\sim$3B active) on a
31
+ 15{,}296-example mixture assembled from three open reasoning-distillation
32
+ corpora (OpenCodeReasoning, Mixture-of-Thoughts, OpenThoughts3) plus a small
33
+ model-identity set. To use the four GPUs on a node that lacks NVLink, we run
34
+ four hyperparameter configurations \emph{in parallel}, one model per card, as a
35
+ single-node A/B/C/D comparison rather than a communication-bound
36
+ tensor-parallel job. The best checkpoint raises overall greedy pass@1 from
37
+ \textbf{84.0 to 88.5} across GSM8K, MATH-500, HumanEval+, and MBPP+. Crucially,
38
+ the improvement is \textbf{almost entirely mathematical}: MATH-500 rises
39
+ \textbf{53.6 $\to$ 77.2 (+23.6)}, GSM8K is flat at ceiling, and coding is
40
+ flat-to-slightly-negative (HumanEval+ $-3.7$, MBPP+ $+3.4$). We then run an
41
+ n-gram-containment plus exact/substring decontamination pass between the entire
42
+ data pool and every benchmark. The data the released model was actually trained
43
+ on is \textbf{clean against all four benchmarks} at both $n{=}13$ and a stricter
44
+ $n{=}8$; the only leakage ($\sim$12\% of MBPP+) lives in an auxiliary
45
+ teacher-generated trace pool that --- as we verify from the winning
46
+ checkpoint's optimizer-step count --- was \emph{never folded into the released
47
+ model}. Our contribution is not a new method but a candid, checked, low-cost
48
+ recipe, a transfer-asymmetry finding (verified reasoning distillation transfers
49
+ strongly to mathematics and weakly to code in this regime), and a
50
+ reproducibility artifact that includes the decontamination tooling most reports
51
+ omit. All weights, adapters, recipe, and evaluation logs are released under
52
+ Apache-2.0.
53
+ \end{abstract}
54
+
55
+ \tableofcontents
56
+
57
+ \section{Introduction}
58
+ The public record of open-model fine-tuning is dominated by reports that lead
59
+ with a headline gain and quietly skip the two checks that decide whether that
60
+ gain is real: (i) whether the evaluation benchmarks leaked into training, and
61
+ (ii) whether the reported number is stable rather than an artifact of a small
62
+ evaluation sample. This report deliberately foregrounds both. It documents a
63
+ short, deliberately modest ``proof-of-capability'' effort: take a strong open
64
+ base model, distill open reasoning data into it under a tight compute budget on
65
+ whatever GPUs were actually available, and report --- with the checks attached
66
+ --- exactly how much genuinely improved and how much did not.
67
+
68
+ The framing throughout is \emph{honesty over magnitude}. We do not compare
69
+ against closed frontier systems, we do not claim a new method, and we treat a
70
+ null result (coding did not improve) and a contamination near-miss (an auxiliary
71
+ data pool overlapped a benchmark) as first-class findings rather than
72
+ embarrassments to hide.
73
+
74
+ \paragraph{Setting.} The work was executed as a time-boxed sprint. Hardware was
75
+ dictated by availability, not preference: the intended single H100
76
+ (\texttt{p5.4xlarge}) was unobtainable across every availability zone we tried
77
+ in four AWS regions, so the project ran on a single \texttt{g6e.12xlarge} node
78
+ (4$\times$ L40S 48\,GB, no NVLink). That constraint --- four decent but
79
+ un-interconnected GPUs --- shaped the entire design (\S\ref{sec:systems}).
80
+
81
+ \paragraph{Contributions.}
82
+ \begin{enumerate}[leftmargin=*]
83
+ \item \textbf{A transfer-asymmetry result.} From a single mixture and recipe,
84
+ attention-only QLoRA distillation into a 3B-active MoE yields a large
85
+ mathematics improvement (MATH-500 $+23.6$) but no coding improvement
86
+ (\S\ref{sec:results}). We characterize where the gain concentrates and offer
87
+ hypotheses (\S\ref{sec:discussion}).
88
+ \item \textbf{A decontamination case study.} We formalize and run a standard
89
+ n-gram-containment decontamination pass over the full data pool against all four
90
+ benchmarks, confirm the released model's training data is clean, and disclose in
91
+ full the $\sim$12\% MBPP+ overlap we found in an \emph{unused} auxiliary pool
92
+ (\S\ref{sec:decontam}).
93
+ \item \textbf{A reproducible commodity-hardware recipe and its engineering
94
+ record.} We release configs, data-prep, evaluation harness, and the
95
+ decontamination tool, and we document the systems decisions and dead ends
96
+ (no-NVLink design, an abandoned DDP transition, self-healing overnight training,
97
+ and a full cost accounting) that budget-constrained teams actually confront
98
+ (\S\ref{sec:systems}).
99
+ \item \textbf{An evaluation-noise caution.} We show a concrete case where a
100
+ small-sample screen ($n{=}50$) reorders the model ranking relative to a larger
101
+ screen ($n{=}150$), and we adopt a ``ship the best-\emph{eval} checkpoint''
102
+ protocol accordingly (\S\ref{sec:results}).
103
+ \end{enumerate}
104
+
105
+ \paragraph{Non-goals.} No frontier comparison, no novel algorithm, no claim of a
106
+ coding improvement, and --- given single-seed training --- no claim about
107
+ variance. We are explicit about each (\S\ref{sec:limits}).
108
+
109
+ \section{Related Work}
110
+ \paragraph{Parameter-efficient fine-tuning.} LoRA~\cite{hu2021lora} injects
111
+ low-rank adapters into frozen weight matrices; QLoRA~\cite{dettmers2023qlora}
112
+ adds 4-bit NF4 base quantization with paged optimizers, making single-GPU
113
+ fine-tuning of large models practical. We use QLoRA and, because the student is
114
+ a 128-expert Mixture-of-Experts model, restrict adapters to the attention
115
+ projections (\S\ref{sec:train}) to avoid the parameter blow-up of adapting every
116
+ expert MLP.
117
+
118
+ \paragraph{Reasoning distillation and its data.} A growing body of open corpora
119
+ package chain-of-thought traces for supervised distillation, including
120
+ OpenCodeReasoning~\cite{opencodereasoning}, Mixture-of-Thoughts~\cite{mixofthoughts},
121
+ and OpenThoughts~\cite{openthoughts}. Our released model is effectively a
122
+ \emph{re-distillation} of such corpora into a smaller-active-parameter student,
123
+ rather than a distillation from a freshly queried teacher.
124
+
125
+ \paragraph{Benchmarks.} We evaluate on GSM8K~\cite{cobbe2021gsm8k} and
126
+ MATH~\cite{hendrycks2021math} (mathematical reasoning; we use the
127
+ MATH-500~\cite{lightman2023letsverify} subset), and HumanEval~\cite{chen2021codex}
128
+ and MBPP~\cite{austin2021mbpp} (code), in their EvalPlus~\cite{liu2023evalplus}
129
+ hardened forms (HumanEval+, MBPP+) with expanded test suites.
130
+
131
+ \paragraph{Contamination and decontamination.} Benchmark leakage into training
132
+ data is a well-known threat to reported gains; large pretraining efforts
133
+ routinely decontaminate via n-gram overlap, e.g.\ GPT-3~\cite{brown2020gpt3} and
134
+ the Dolma corpus~\cite{soldaini2024dolma}. We apply the same family of methods
135
+ at the fine-tuning-data scale and, unusually for a fine-tuning report, ship the
136
+ tool and the resulting report.
137
+
138
+ \section{Preliminaries and Definitions}
139
+ \label{sec:prelim}
140
+ We define the concepts used throughout so the report is self-contained for
141
+ readers new to the specific techniques.
142
+
143
+ \paragraph{Knowledge distillation and re-distillation.} \emph{Knowledge
144
+ distillation} trains a (usually smaller) \emph{student} model to imitate a
145
+ stronger \emph{teacher}. In \emph{sequence-level} distillation the student is
146
+ fine-tuned on text the teacher produced. When those teacher outputs are not
147
+ freshly generated but taken from an existing corpus of teacher-written
148
+ solutions, we call the process \emph{re-distillation}: the student learns from
149
+ previously distilled data rather than from a live teacher. Our released model is
150
+ a re-distillation (\S\ref{sec:data}).
151
+
152
+ \paragraph{Chain-of-thought and ``Thinking'' models.} A \emph{chain-of-thought}
153
+ (CoT) is the intermediate, step-by-step reasoning a model emits before its final
154
+ answer; training on CoT teaches the model to reason explicitly rather than to
155
+ guess an answer in one step. ``Thinking'' checkpoints are trained to produce an
156
+ explicit reasoning span (here delimited by \texttt{<think>}\,\dots\,\texttt{</think>})
157
+ and are best fine-tuned in that same format so the adaptation does not fight the
158
+ base model's native behavior.
159
+
160
+ \paragraph{Supervised fine-tuning and loss masking.} We use \emph{supervised
161
+ fine-tuning} (SFT): given (prompt, completion) pairs, the model is trained to
162
+ predict the completion tokens. \emph{Loss masking} sets the training loss to
163
+ zero on the prompt tokens, so the model is rewarded only for producing the
164
+ target completion, not for parroting the prompt --- which both stabilizes
165
+ training and prevents the prompt style from leaking into behavior.
166
+
167
+ \paragraph{LoRA: rank and \texorpdfstring{$\alpha$}{alpha}.} \emph{Low-Rank Adaptation} freezes a base
168
+ weight matrix $W\in\mathbb{R}^{d\times k}$ and learns a low-rank update
169
+ $\Delta W=\tfrac{\alpha}{r}BA$ with $B\in\mathbb{R}^{d\times r}$,
170
+ $A\in\mathbb{R}^{r\times k}$, and $r\ll\min(d,k)$. The \emph{rank} $r$ sets the
171
+ capacity of the update (larger $r$ = more trainable parameters and expressive
172
+ power, but more overfitting risk) and $\alpha$ scales its magnitude. Only $A$
173
+ and $B$ are trained, so the trainable-parameter count is a tiny fraction of the
174
+ base --- the source of LoRA's memory efficiency.
175
+
176
+ \paragraph{Quantization, NF4, QLoRA, and paged optimizers.} \emph{Quantization}
177
+ stores weights in fewer bits to save memory. \emph{NF4} (4-bit NormalFloat) is a
178
+ 4-bit format designed for the approximately-normal distribution of neural
179
+ weights, preserving accuracy better than naive 4-bit rounding. \emph{QLoRA}
180
+ keeps the base model frozen and quantized to NF4 while training LoRA adapters in
181
+ higher precision on top; a \emph{paged} optimizer moves optimizer state between
182
+ GPU and CPU memory under pressure to avoid out-of-memory crashes. Together these
183
+ are what make fine-tuning a 30B-scale model on a single 48\,GB card feasible at
184
+ all.
185
+
186
+ \paragraph{Mixture-of-Experts: total vs.\ active parameters.} A
187
+ \emph{Mixture-of-Experts} (MoE) layer contains many parallel ``expert''
188
+ sub-networks and a \emph{router} that sends each token to only a few of them. The
189
+ model therefore has a large \emph{total} parameter count but a much smaller
190
+ \emph{active} count per token. Our student holds $\sim$30B total but activates
191
+ only $\sim$3B per token, so it runs at roughly the compute cost of a 3B dense
192
+ model while storing far more knowledge --- the property we exploit for cheap
193
+ training and serving.
194
+
195
+ \paragraph{Sequence packing, gradient accumulation, effective batch.}
196
+ \emph{Sequence packing} concatenates several short examples into one
197
+ fixed-length training sequence so computation is not wasted on padding.
198
+ \emph{Gradient accumulation} sums gradients over several micro-batches before
199
+ taking an optimizer step; the \emph{effective batch size} equals (per-device
200
+ batch) $\times$ (accumulation steps) $\times$ (devices). We use per-device batch
201
+ 1 and accumulation 16 (effective batch 16), which is precisely what converts a
202
+ count of packed sequences into a count of optimizer steps
203
+ (\S\ref{sec:train}) --- the relationship we later use to prove which data the
204
+ model was trained on.
205
+
206
+ \paragraph{Evaluation: greedy decoding and pass@1.} \emph{Greedy decoding}
207
+ selects the highest-probability token at each step (deterministic, temperature
208
+ 0). \emph{pass@1} is the fraction of problems solved by a single attempt; with
209
+ greedy decoding it is fully reproducible, which is why we use it in preference to
210
+ sampled metrics. ``Solved'' means passing the test suite (code) or matching the
211
+ gold answer (math).
212
+
213
+ \paragraph{Contamination, \texorpdfstring{$n$}{n}-grams, and containment.} \emph{Contamination} is
214
+ the presence of evaluation problems (or close variants) in the training data,
215
+ which silently inflates scores. An \emph{$n$-gram} is a contiguous span of $n$
216
+ word tokens. The \emph{containment} of an evaluation item $e$ in a training
217
+ document $t$ is the fraction of $e$'s $n$-grams that also occur in $t$
218
+ (formalized in \S\ref{sec:decontam}). \emph{Decontamination} flags or removes
219
+ training documents whose containment of any evaluation item exceeds a threshold
220
+ --- catching not just verbatim copies but reworded, reformatted, or embedded
221
+ ones.
222
+
223
+ \section{Model and Problem Setup}
224
+ \subsection{Student selection}
225
+ The intended student was a 14B ``Thinking'' checkpoint; on inspection, the
226
+ 2507 ``Thinking'' line ships only at 4B, 30B-A3B, and 235B scales --- there is
227
+ no 14B. We therefore selected \textbf{Qwen3-30B-A3B-Thinking-2507}, a
228
+ Mixture-of-Experts model with $\sim$30B total and $\sim$3B active parameters.
229
+ The consequences were deliberate and are carried through the paper: (i) the
230
+ ``sub-15B parameters'' framing is replaced by an active-parameter framing
231
+ ($\sim$3B active); and (ii) full bf16 LoRA does not fit a 48\,GB L40S at this
232
+ scale, forcing QLoRA (4-bit NF4) as the primary method rather than a fallback.
233
+
234
+ \subsection{Task and metric}
235
+ We measure zero-shot, greedy \textbf{pass@1} on each benchmark: for code, the
236
+ generated program must pass the (expanded) test suite under a sandbox; for math,
237
+ the extracted final answer must match the gold answer under a comparison ladder
238
+ (\S\ref{sec:evalmethod}). The success criterion is a clear, reproducible
239
+ improvement over the \emph{unmodified base} on this slice --- not a comparison
240
+ to any external system.
241
+
242
+ \section{Data}
243
+ \label{sec:data}
244
+ \subsection{Offline corpora (what the released model trained on)}
245
+ The released model was trained on \textbf{15{,}296 examples}
246
+ (Table~\ref{tab:data}). Each corpus was subsampled by taking the first 3{,}000
247
+ examples in streaming order (no shuffle, no seed). Offline traces are treated as
248
+ \emph{verified-by-construction}: they carry a marker to that effect and were
249
+ \emph{not} independently re-executed. We state this plainly rather than implying
250
+ a verification we did not perform on this portion.
251
+
252
+ \begin{table}[h]
253
+ \centering
254
+ \begin{tabular}{llrl}
255
+ \toprule
256
+ Source & Domain & Count & Provenance\\
257
+ \midrule
258
+ OpenCodeReasoning & coding & 3{,}000 & open corpus~\cite{opencodereasoning}\\
259
+ Mixture-of-Thoughts / code & coding & 3{,}000 & open corpus~\cite{mixofthoughts}\\
260
+ Mixture-of-Thoughts / math & math & 3{,}000 & open corpus~\cite{mixofthoughts}\\
261
+ Mixture-of-Thoughts / science & reasoning & 3{,}000 & open corpus~\cite{mixofthoughts}\\
262
+ OpenThoughts3 & mixed & 3{,}000 & open corpus~\cite{openthoughts}\\
263
+ Identity Q\&A (self-generated) & reasoning & 296 & 37 unique $\times$8\\
264
+ \midrule
265
+ \textbf{Total} & & \textbf{15{,}296} &\\
266
+ \bottomrule
267
+ \end{tabular}
268
+ \caption{Training mixture of the released model.}
269
+ \label{tab:data}
270
+ \end{table}
271
+
272
+ \subsection{Model-identity data}
273
+ A small set of 296 identity examples (37 unique prompts, each repeated 8$\times$
274
+ with light phrasing variation) teaches the model to answer identity questions as
275
+ ``Bala, made by TushLab'' and to redirect ``are you \textless other
276
+ model\textgreater?'' probes. This is a product-branding detail, disclosed here
277
+ for completeness; it is deliberately small (over-weighting identity data
278
+ degrades general quality) and is not part of any capability claim.
279
+
280
+ \subsection{A self-hosted generation pipeline that was built but not used}
281
+ \label{sec:freshgen}
282
+ We also implemented a self-hosted teacher-generation pipeline that
283
+ \emph{verifies as it generates}: code is executed against tests and math answers
284
+ are checked programmatically at generation time, and only verified traces are
285
+ kept, with per-domain yield tracked continuously. It produced \textbf{3{,}189
286
+ verified traces} --- 2{,}884 mathematics traces from GSM8K-train prompts
287
+ (teacher: \texttt{Magistral-Small-2509}; 96.1\% verified yield) and 305 coding
288
+ traces from MBPP-train prompts (teacher: \texttt{Qwen3.6-27B-FP8}; $\sim$80\%
289
+ yield).
290
+
291
+ These fresh traces were \textbf{not folded into the released model}. The plan
292
+ was a rolling data refresh tied to a two-GPU DDP transition; when that transition
293
+ was abandoned as unreliable (\S\ref{sec:systems}), the training data was frozen
294
+ to keep checkpoints resumable, and the fresh pool was left out. We verify this
295
+ directly in \S\ref{sec:decontam} from the winning checkpoint's optimizer-step
296
+ count. The consequence is important for interpreting our results: the released
297
+ model is a re-distillation of the \emph{offline} corpora (plus identity), and
298
+ the benchmark contamination we later find lives entirely in this \emph{unused}
299
+ pool.
300
+
301
+ \section{Training Methodology}
302
+ \label{sec:train}
303
+ \paragraph{QLoRA on an MoE.} We fine-tune with QLoRA: the base is loaded in
304
+ 4-bit NF4, computation is bf16, the optimizer is paged 8-bit AdamW, and gradient
305
+ checkpointing is enabled. Adapters are attached to the attention projections
306
+ \texttt{\{q,k,v,o\}\_proj} \emph{only}. On a 128-expert model, adapting the
307
+ expert MLPs (gate/up/down) would attach LoRA to every expert and explode both
308
+ parameter count and memory; attention-only adaptation keeps the run inside a
309
+ 48\,GB card while still steering the model's behavior.
310
+
311
+ \paragraph{Sequence handling.} Examples are formatted to the model's chat
312
+ template with the \texttt{<think>} reasoning format preserved, and loss is masked
313
+ on prompt tokens so the model is trained only to produce the completion.
314
+ Sequences are packed; packing reduced the 15{,}296 examples to $\approx$13{,}617
315
+ packed sequences (offline reasoning traces are long, so there is limited
316
+ opportunity to combine them). \texttt{max\_seq\_length} was set to 4096; 8192
317
+ overflowed memory on the backward pass and offered little coverage gain given
318
+ the trace-length distribution.
319
+
320
+ \paragraph{Software stack.} Fine-tuning uses Hugging Face Transformers~\cite{wolf2020transformers} with PEFT
321
+ for the LoRA adapters and bitsandbytes for 4-bit NF4 quantization and the paged
322
+ 8-bit optimizer. \textbf{vLLM}~\cite{kwon2023vllm} is used for \emph{inference}, not training: it
323
+ drives the self-hosted teacher trace generation (\S\ref{sec:freshgen}) and, in
324
+ FP8, the evaluation serving of both the base and fine-tuned checkpoints. In
325
+ other words vLLM accelerates generation and evaluation throughput, while the
326
+ optimization itself runs through the Transformers/PEFT path.
327
+
328
+ \paragraph{The four-configuration design.} Rather than one run, we trained four
329
+ configurations concurrently (one per GPU), spanning adapter capacity and
330
+ learning rate so the comparison is informative rather than cosmetic
331
+ (Table~\ref{tab:configs}). All share: cosine schedule, warmup ratio 0.03, 3
332
+ epochs, per-device batch 1 with gradient accumulation 16 (effective batch 16),
333
+ seed 0. At effective batch 16 over $\approx$13{,}617 packed sequences, one epoch
334
+ is $\approx$852 optimizer steps; three epochs is 2{,}556 steps, matching the
335
+ released checkpoint exactly (\S\ref{sec:decontam}).
336
+
337
+ \begin{table}[h]
338
+ \centering
339
+ \begin{tabular}{lrrrl}
340
+ \toprule
341
+ Config & rank & $\alpha$ & learning rate & character\\
342
+ \midrule
343
+ A & 32 & 64 & $1.0\times10^{-4}$ & conservative (small, gentle)\\
344
+ \textbf{B} & \textbf{128} & \textbf{256} & $\mathbf{2.5\times10^{-4}}$ & high-capacity (released winner)\\
345
+ C & 64 & 128 & $1.5\times10^{-4}$ & mid\\
346
+ D & 64 & 128 & $5.0\times10^{-5}$ & low learning rate / stable\\
347
+ \bottomrule
348
+ \end{tabular}
349
+ \caption{The four training configurations. All attention-only QLoRA, 3 epochs,
350
+ effective batch 16, seed 0.}
351
+ \label{tab:configs}
352
+ \end{table}
353
+
354
+ \section{Systems and Engineering}
355
+ \label{sec:systems}
356
+ This section records the constraints and decisions that a budget-constrained,
357
+ availability-constrained team actually faces. We consider it part of the
358
+ contribution.
359
+
360
+ \paragraph{Hardware and the no-NVLink design.} The intended H100
361
+ (\texttt{p5.4xlarge}) returned \texttt{Insufficient\-Instance\-Capacity} in every
362
+ availability zone we tried across us-east-1, us-west-2, us-east-2, and
363
+ ap-south-1. We therefore ran on a single \texttt{g6e.12xlarge}: 4$\times$ L40S
364
+ (48\,GB, Ada, GDDR6), 48 vCPU, 384\,GB RAM, \textbf{no NVLink} (PCIe Gen4 only).
365
+ Because the cards are not tightly interconnected, we deliberately avoided
366
+ tensor-parallel and FSDP-sharded training and instead assigned \emph{one model
367
+ per GPU}: two teacher/serving-or-generation roles and two (later four) student
368
+ training runs, each an independent process. This trades theoretical throughput
369
+ for robustness and debuggability under a tight clock.
370
+
371
+ \paragraph{Options under the capacity crunch.} When H100 on-demand launches
372
+ failed across all zones we tried, we weighed four options: (i) \emph{wait} for
373
+ capacity via a polling launcher --- an unbounded delay against a 9-day clock;
374
+ (ii) reserve a \emph{Capacity Block} for guaranteed H100s --- available, but with
375
+ an upfront cost and a fixed commitment window; (iii) \emph{relocate} to a region
376
+ with both quota and live capacity; or (iv) \emph{pivot} to the readily-available
377
+ L40S (\texttt{g6e.12xlarge}). We chose (iv). The L40S is the weaker card (lower
378
+ memory bandwidth, no NVLink), but it was immediately available in multiple
379
+ zones, and for a LoRA-scale workload on a $\sim$3B-active model the throughput
380
+ penalty was an acceptable price for starting the same day. The governing
381
+ principle --- take the hardware that exists and adapt the design to it, rather
382
+ than block on the preferred hardware --- shaped every subsequent decision.
383
+
384
+ \paragraph{An abandoned DDP transition.} We attempted to accelerate a single
385
+ configuration by moving it to 2-GPU DDP once a teacher GPU freed up. The run
386
+ repeatedly died; the root cause was \texttt{SIGTERM} from our own rapid
387
+ kill/relaunch churn rather than a genuine DDP fault, but after several cycles we
388
+ judged the reliability cost not worth the speedup and reverted to
389
+ single-GPU-per-config. The lesson we record: on a short clock, a reliable
390
+ slower path beats a fast fragile one, and the full three epochs single-GPU were
391
+ sufficient.
392
+
393
+ \paragraph{Unattended robustness.} Training ran in per-GPU \texttt{tmux}
394
+ sessions independent of any interactive session, with an on-instance watchdog
395
+ that restarted only genuinely dead runs from their last checkpoint (with a
396
+ completion guard so a \emph{finished} run is not relaunched into a restart
397
+ loop). This let multi-day training survive crashes without human intervention.
398
+
399
+ \paragraph{Cost accounting.} From AWS Cost Explorer, the \texttt{g6e.12xlarge}
400
+ accrued \textbf{259.5 instance-hours} ($\approx$10.8 days of billed
401
+ instance-runtime across the 2026-07-25 to 08-05 window) at the on-demand rate
402
+ \$10.49/hr $=$ \textbf{\$2{,}723 in GPU
403
+ compute}, under the \$3{,}000 ceiling. Including EBS/networking/storage
404
+ ($\sim$\$22), tax (\$254), and ancillary cloud-hosted assistant usage
405
+ ($\sim$\$92), total project spend was \textbf{\$3{,}091}
406
+ (Appendix~\ref{app:cost}). We report both figures: the training/generation
407
+ compute was comfortably within budget; the all-in total, once tax and ancillary
408
+ services are counted, sat marginally over the nominal ceiling.
409
+
410
+ \section{Evaluation Methodology}
411
+ \label{sec:evalmethod}
412
+ \paragraph{Benchmarks.} GSM8K (test, 1{,}319 problems), MATH-500 (500),
413
+ HumanEval+ (164), MBPP+ (378). Metric: zero-shot greedy pass@1.
414
+
415
+ \paragraph{Verification harness.} Code solutions are extracted from the model
416
+ output and executed in a subprocess sandbox with a wall-clock timeout and
417
+ \texttt{RLIMIT} caps on CPU time, memory, and file size, in its own process
418
+ group; we distinguish pass / fail / error / timeout, supporting both
419
+ assert-style (HumanEval+/MBPP+) and stdio-style judging. Math answers are
420
+ extracted (\texttt{\textbackslash boxed\{\}}, the GSM8K \texttt{\#\#\#\#}
421
+ convention, or a trailing-number fallback) and compared with a ladder: exact
422
+ string, then numeric with tolerance, then symbolic equality via SymPy. The same
423
+ harness scores the base and the fine-tuned model identically; merged adapters
424
+ were served in FP8 for evaluation, and the base was served the same way.
425
+
426
+ \paragraph{Two-stage protocol and selection rule.} Stage 1 screens all four
427
+ configurations at epochs 2 and 3 on a 150-example-per-benchmark ``core-3'' slice
428
+ (GSM8K/HumanEval+/MATH). Stage 2 evaluates the base and the selected winner on
429
+ the full benchmark sets. We \textbf{ship the best-\emph{evaluation} checkpoint},
430
+ not the last-trained one.
431
+
432
+ \section{Results}
433
+ \label{sec:results}
434
+ \subsection{Stage 1: hyperparameter screen (core-3, \texorpdfstring{$n{=}150$}{n=150}/benchmark)}
435
+ The unmodified base scores core-3 pass@1 $=$ \textbf{0.789}. All four
436
+ configurations beat it at epoch 3 (Table~\ref{tab:screen}). Configuration B (the
437
+ largest adapter, highest learning rate) wins at $n{=}150$; configuration A is
438
+ the only one to \emph{regress} from epoch 2 to 3, a mild overfitting signal,
439
+ while B/C/D all improve at epoch 3. We therefore select configuration~B at epoch~3
440
+ --- the highest of the eight configuration$\times$epoch points, and a clean
441
+ (non-overfitting) improvement rather than a peaked one --- as the released
442
+ model, and carry only that checkpoint forward to the full-set evaluation
443
+ (Table~\ref{tab:fullset}). The alternatives are retained in
444
+ Table~\ref{tab:screen} and Appendix~\ref{app:percfg} precisely so the choice is
445
+ auditable: every configuration we did not ship, at both epochs, is reported.
446
+
447
+ \begin{table}[h]
448
+ \centering
449
+ \begin{tabular}{lrr}
450
+ \toprule
451
+ Configuration & epoch 2 & epoch 3\\
452
+ \midrule
453
+ A (r32) & 0.824 & 0.802\\
454
+ \textbf{B (r128)} & 0.838 & \textbf{0.847}\\
455
+ C (r64) & 0.809 & 0.829\\
456
+ D (r64, low LR) & 0.811 & 0.818\\
457
+ \midrule
458
+ base & \multicolumn{2}{c}{0.789}\\
459
+ \bottomrule
460
+ \end{tabular}
461
+ \caption{Stage-1 core-3 pass@1 ($n{=}150$ per benchmark) for all four
462
+ configurations at epochs 2 and 3, against the base. Configuration~B at epoch~3
463
+ (0.847) is the highest of the eight configuration$\times$epoch points and is the
464
+ released model.}
465
+ \label{tab:screen}
466
+ \end{table}
467
+
468
+ \paragraph{An evaluation-noise caution.} An earlier, cheaper screen at $n{=}50$
469
+ per benchmark ranked configuration A best (0.873) --- a ranking the trustworthy
470
+ $n{=}150$ screen overturns. We flag this explicitly: at small evaluation
471
+ samples, the ordering of closely-spaced configurations is not stable, and
472
+ model-selection decisions should not be made on $n{=}50$-scale screens.
473
+
474
+ \subsection{Stage 2: base vs.\ released model (config B, epoch 3), full sets}
475
+ \begin{table}[h]
476
+ \centering
477
+ \begin{tabular}{lrrrr}
478
+ \toprule
479
+ Benchmark & $n$ & Base & Bala (B, ep3) & $\Delta$\\
480
+ \midrule
481
+ GSM8K & 1{,}319 & 95.6 & 94.2 & $-1.4$\\
482
+ \textbf{MATH-500} & 500 & \textbf{53.6} & \textbf{77.2} & \textbf{+23.6}\\
483
+ HumanEval+ & 164 & 78.7 & 75.0 & $-3.7$\\
484
+ MBPP+ & 378 & 86.0 & 89.4 & $+3.4$\\
485
+ \midrule
486
+ \textbf{Overall} & 2{,}361 & \textbf{84.0} & \textbf{88.5} & \textbf{+4.5}\\
487
+ \bottomrule
488
+ \end{tabular}
489
+ \caption{Full-set greedy pass@1. The base is the unmodified
490
+ Qwen3-30B-A3B-Thinking-2507, evaluated identically.}
491
+ \label{tab:fullset}
492
+ \end{table}
493
+
494
+ \subsection{The transfer asymmetry}
495
+ The overall $+4.5$ is almost entirely mathematics. MATH-500 improves by 23.6
496
+ points; GSM8K is flat because the base is already near ceiling ($95.6$); and
497
+ \emph{both} coding benchmarks fail to improve --- HumanEval+ drops 3.7 points
498
+ and MBPP+ rises only 3.4. In effect, distilling these open reasoning corpora
499
+ into this student produces a \textbf{mathematics-reasoning booster}, not a
500
+ general coding model. This asymmetry --- a large, clean positive in one domain
501
+ and a null (or mild regression) in another, from the \emph{same} data and
502
+ recipe --- is the central empirical finding of the paper.
503
+
504
+ \section{Decontamination}
505
+ \label{sec:decontam}
506
+ \subsection{Why exact dedup is insufficient}
507
+ A content-hash over normalized prompts catches only \emph{verbatim} duplicate
508
+ problems. Benchmark contamination typically appears in subtler forms: a problem
509
+ reworded, reformatted (whitespace/punctuation/case), or embedded as a substring
510
+ of a longer training document. We therefore use n-gram containment plus
511
+ normalized exact/substring matching, following standard large-scale
512
+ practice~\cite{brown2020gpt3,soldaini2024dolma}.
513
+
514
+ \subsection{Method}
515
+ For an evaluation item $e$ and a training document $t$, let $G_n(\cdot)$ denote
516
+ the set of word $n$-grams after normalization (lowercase, alphanumeric tokens,
517
+ collapsed whitespace). We flag $t$ as contaminating $e$ when the
518
+ \emph{containment} of $e$ in $t$,
519
+ \[
520
+ C_n(e,t)\;=\;\frac{|G_n(e)\cap G_n(t)|}{|G_n(e)|},
521
+ \]
522
+ meets a threshold $\tau$. Evaluation items too short to form an $n$-gram fall
523
+ back to a normalized substring match with a minimum token length (to avoid
524
+ generic one-liners matching everything), and any normalized whole-prompt
525
+ equality is always flagged. We use $n{=}13$, $\tau{=}0.8$ as the default and
526
+ also report a stricter $n{=}8$ pass. Algorithm~\ref{alg:decontam} sketches the
527
+ inverted-index implementation; the tool is released.
528
+
529
+ \begin{algorithm}[h]
530
+ \caption{n-gram containment decontamination (per training doc)}
531
+ \label{alg:decontam}
532
+ \begin{algorithmic}[1]
533
+ \State build inverted index $I:\ \text{$n$-gram}\to\{\text{eval ids}\}$ and counts $|G_n(e)|$
534
+ \For{each training document $t$}
535
+ \State $H\gets$ empty hit-counter over eval ids
536
+ \For{each $g\in G_n(t)$}
537
+ \For{each $e\in I[g]$} \State $H[e]\mathrel{+}=1$ \EndFor
538
+ \EndFor
539
+ \For{each $e$ with $H[e]/|G_n(e)|\ge\tau$} \State flag $(t,e)$ \EndFor
540
+ \State additionally flag exact / short-item substring matches
541
+ \EndFor
542
+ \end{algorithmic}
543
+ \end{algorithm}
544
+
545
+ \subsection{Was the contaminated pool even trained on?}
546
+ Before interpreting any overlap we establish which data the released model saw.
547
+ The winning checkpoint's trainer state records 852 optimizer steps at epoch 1.0
548
+ and 2{,}556 at epoch 3.0. At effective batch 16 this is $852\times16\approx
549
+ 13{,}632$ packed sequences per epoch --- matching the $\approx$13{,}617 packed
550
+ sequences of the 15{,}296-example offline+identity mixture, and \emph{excluding}
551
+ the 3{,}189-example fresh pool (which would have pushed epoch 1 to
552
+ $\approx$1{,}025 steps). We therefore confirm the released model trained on the
553
+ offline+identity data only.
554
+
555
+ \subsection{Results}
556
+ Table~\ref{tab:decontam} reports, for the full 18{,}485-document pool
557
+ (15{,}296 trained $+$ 3{,}189 auxiliary), the number of evaluation items exposed
558
+ per benchmark.
559
+
560
+ \begin{table}[h]
561
+ \centering
562
+ \begin{tabular}{lrrrr}
563
+ \toprule
564
+ Exposed eval items & MATH-500 & GSM8K & HumanEval+ & MBPP+\\
565
+ \midrule
566
+ $n{=}13$, $\tau{=}0.8$ & 0 & 0 & 0 & 46 / 378\\
567
+ $n{=}8$, $\tau{=}0.8$ & 0 & 0 & 0 & 49 / 378\\
568
+ \bottomrule
569
+ \end{tabular}
570
+ \caption{Decontamination over the full data pool. Every flagged item is MBPP+
571
+ and every contaminating document is from the \emph{auxiliary} (untrained) fresh
572
+ pool.}
573
+ \label{tab:decontam}
574
+ \end{table}
575
+
576
+ Every flagged item is an MBPP+ problem, and every contaminating document comes
577
+ from the fresh coding pool --- unsurprising, since those traces were generated
578
+ from MBPP-train prompts, which share problems with MBPP+ by construction. The
579
+ \textbf{offline corpora and identity set --- i.e.\ all data the released model
580
+ actually trained on --- contribute zero contamination against all four
581
+ benchmarks}, at both $n{=}13$ and the stricter $n{=}8$. The headline MATH-500
582
+ result therefore rests on clean data.
583
+
584
+ \subsection{Disclosure and method limitations}
585
+ The auxiliary pool, released separately, contains $\sim$12\% MBPP+ overlap; it
586
+ was not used to train the released model, but anyone reusing it should
587
+ decontaminate first (the tool is provided). N-gram/exact matching catches
588
+ verbatim, reformatted, embedded, and short-item leakage; it does \emph{not}
589
+ catch deep paraphrase or numerically-perturbed variants. ``Clean'' means clean
590
+ under this standard check, not a proof of zero semantic overlap.
591
+
592
+ \section{Discussion}
593
+ \label{sec:discussion}
594
+ \paragraph{Why might mathematics transfer and code not?} We offer hypotheses,
595
+ not conclusions. First, headroom: the base already sits near ceiling on GSM8K
596
+ (95.6) and is strong on both code benchmarks (78.7 / 86.0) but weak on MATH-500
597
+ (53.6), so MATH simply has the most room to move. Second, the offline mixture is
598
+ reasoning-heavy and its mathematics traces are plausibly closer in form to
599
+ competition-style MATH problems than its code traces are to the
600
+ short-specification style of HumanEval+/MBPP+. Third, a math-dominated
601
+ supervised signal can mildly trade off code behavior, consistent with the small
602
+ HumanEval+ regression. Distinguishing these would require ablations we did not
603
+ run.
604
+
605
+ \paragraph{Practical guidance.} For budget-constrained teams: (i) a small
606
+ ($\sim$15k) re-distillation of open reasoning corpora is enough to move a weak
607
+ mathematics score substantially, but should not be expected to improve already-
608
+ strong coding; (ii) attention-only QLoRA is a reliable, memory-safe way to adapt
609
+ a large MoE on a single mid-range card; (iii) evaluation-sample size matters for
610
+ model selection; and (iv) benchmark decontamination is cheap and should be run
611
+ by default, especially when any training data is generated from benchmark-train
612
+ prompts.
613
+
614
+ \section{Design Principles and Strategy}
615
+ \label{sec:strategy}
616
+ Several recurring principles guided the concrete decisions above; we state them
617
+ explicitly because they, more than any single hyperparameter, determined the
618
+ outcome, and because they transfer to other budget-constrained efforts even when
619
+ the specific numbers do not.
620
+
621
+ \paragraph{Honesty-first reporting.} Every headline number is paired with the
622
+ check that could falsify it (contamination, evaluation-sample size), and null
623
+ results are reported with the same prominence as positive ones. The goal is a
624
+ result a skeptical reader can trust, not the largest number obtainable. This is
625
+ a strategy, not merely an attitude: it dictated building the decontamination
626
+ tool, running the larger evaluation screen, and verifying which data the model
627
+ actually trained on.
628
+
629
+ \paragraph{Availability-driven hardware, decoupled roles.} Rather than block on
630
+ scarce H100 capacity, we took the GPUs that were actually available and adapted
631
+ the design to them. Because the L40S node lacks NVLink (the high-bandwidth
632
+ GPU-to-GPU interconnect), tightly-coupled multi-GPU training would be
633
+ communication-bound and fragile; we instead ran independent single-GPU processes
634
+ --- one model or one training run per card. This ``parallel roles'' strategy
635
+ converts four weakly-connected GPUs into four productive workers and, as a
636
+ side benefit, turns an otherwise-serial hyperparameter search into a
637
+ same-wall-clock A/B/C/D comparison.
638
+
639
+ \paragraph{Verify-as-generated.} Where we generated data, correctness was
640
+ checked \emph{at generation time} (code executed against tests, math answers
641
+ compared to gold) rather than trusted after the fact, and only verified traces
642
+ were kept. This keeps a data pipeline honest by construction, and its per-domain
643
+ \emph{yield} (verified\,/\,total) doubles as a cheap, continuous quality signal.
644
+
645
+ \paragraph{Decontaminate by default.} Any data derived from a benchmark's
646
+ training split risks overlapping its test split; we therefore treat
647
+ decontamination as a mandatory step rather than an afterthought, and ship the
648
+ tool so the check is repeatable by anyone. This principle is exactly what
649
+ surfaced (and contained) the MBPP+ overlap in the auxiliary pool.
650
+
651
+ \paragraph{Ship the best-evaluation checkpoint, screened at adequate \texorpdfstring{$n$}{n}.} Model
652
+ selection is made on evaluation performance --- not training loss, and not the
653
+ last checkpoint --- using an evaluation sample large enough that the ranking is
654
+ stable. We adopted this only after observing directly that a small ($n{=}50$)
655
+ screen mis-ranked the field relative to $n{=}150$.
656
+
657
+ \paragraph{Cost discipline.} Compute was treated as a budget to be spent
658
+ deliberately: instances were stopped when idle, a reliable slow path was
659
+ preferred over a fast fragile one (the abandoned DDP transition), and the full
660
+ spend was reconciled against the ceiling after the fact rather than assumed
661
+ (\S\ref{sec:systems}, Appendix~\ref{app:cost}).
662
+
663
+ \section{Limitations}
664
+ \label{sec:limits}
665
+ \begin{itemize}[leftmargin=*]
666
+ \item \textbf{Single seed.} One run per configuration; we report no variance.
667
+ The $n{=}50\to n{=}150$ reordering shows evaluation noise is non-trivial.
668
+ \item \textbf{Subsample reproducibility.} The offline subset is the first 3{,}000
669
+ streaming examples per corpus with no saved seed; exact reconstruction depends
670
+ on upstream dataset revisions being stable.
671
+ \item \textbf{Offline traces not re-verified.} That portion is
672
+ verified-by-construction only.
673
+ \item \textbf{Unused generation pipeline.} The self-hosted teacher generation
674
+ did not contribute to the released model; claims about it are process, not
675
+ result.
676
+ \item \textbf{No coding gain.} The recipe is a mathematics booster; we do not
677
+ claim otherwise.
678
+ \item \textbf{Decontamination scope.} n-gram/exact only; deep paraphrase is not
679
+ detected.
680
+ \item \textbf{Not a frontier comparison.} Positioned against the unmodified base
681
+ only, on the same benchmark suite; no external or frontier model is compared.
682
+ \end{itemize}
683
+
684
+ \section{Reproducibility and Release}
685
+ Released under Apache-2.0: the merged weights, the LoRA adapters for epochs 2 and
686
+ 3, all training configurations, the data-preparation and identity-generation
687
+ code, the evaluation harness, and the decontamination tool with its report.
688
+ Reproduction: regenerate the offline subset with the preparation script, train
689
+ with a released configuration, merge the adapter, and evaluate with the harness;
690
+ the decontamination check is a single command. The known reproducibility caveat
691
+ is the unseeded streaming subsample (\S\ref{sec:limits}).
692
+
693
+ \section{Intended Use and Access}
694
+ \label{sec:intended}
695
+ \paragraph{Who may use it, and from where.} The model is released publicly under
696
+ \textbf{Apache-2.0} at \url{https://huggingface.co/AlreadyAI/Bala-30B-A3B} and
697
+ may be downloaded and used by anyone --- for research \emph{or} commercial
698
+ purposes --- subject only to the permissive license. Both the fully-merged
699
+ weights (load directly) and the LoRA adapters (apply to the public base) are
700
+ provided, so users who already host the base can adopt Bala by adding only the
701
+ $\sim$0.4\,GB adapter.
702
+
703
+ \paragraph{Where it is a good fit.} Bala's measured profile makes it best suited
704
+ to:
705
+ \begin{itemize}[leftmargin=*]
706
+ \item \textbf{Mathematical and multi-step reasoning}, where it improves markedly
707
+ over its base (MATH-500 $+23.6$) --- e.g.\ step-by-step problem solving and
708
+ math-tutoring-style tasks.
709
+ \item \textbf{Cost-sensitive deployment.} As a $\sim$3B-active MoE it serves at
710
+ roughly the compute cost of a 3B dense model while retaining a large knowledge
711
+ store, so it runs on modest GPUs.
712
+ \item \textbf{Open / self-hosted settings} that need a permissively-licensed,
713
+ transparently-documented reasoning model with a published, reproducible recipe.
714
+ \item \textbf{A research baseline} for budget-constrained distillation and
715
+ decontamination studies, since the full recipe and checking tools ship with it.
716
+ \end{itemize}
717
+
718
+ \paragraph{System requirements.} Because every expert must be resident even
719
+ though only $\sim$3B parameters are \emph{active} per token, \emph{memory} is set
720
+ by the total parameter count while \emph{compute} tracks the active count. In
721
+ practice: QLoRA fine-tuning (as done here) fits on a single $\geq$48\,GB GPU
722
+ (e.g.\ one L40S); bf16 inference of the merged model ($\sim$61\,GB of weights)
723
+ wants one 80\,GB card or two 48\,GB cards; FP8 serving ($\sim$31\,GB) fits a
724
+ single 48\,GB card; and 4-bit quantized inference ($\sim$18\,GB) fits a single
725
+ 24\,GB card --- in each case plus KV-cache headroom that grows with context
726
+ length.
727
+
728
+ \paragraph{Where it is not.} Bala is \emph{not} a coding-assistant upgrade
729
+ (coding was flat-to-negative relative to the base), not a frontier system, and
730
+ not appropriate for high-stakes decisions without independent evaluation; the
731
+ standard language-model caveats (hallucination, insecure generated code, bias)
732
+ apply.
733
+
734
+ \section{Ethics and Broader Impact}
735
+ \label{sec:ethics}
736
+ This work releases an open model and its recipe under Apache-2.0 for research
737
+ use; several considerations bear noting.
738
+ \emph{Licensing:} the base model and all training corpora are permissively
739
+ licensed, and the released artifacts comply with those terms.
740
+ \emph{Provenance:} a small identity set trains the model to present as ``Bala'';
741
+ we disclose this and the base lineage explicitly, so the release does not
742
+ misrepresent where the model came from.
743
+ \emph{Contamination:} we report, rather than conceal, the benchmark overlap
744
+ found in an auxiliary (untrained) data pool, and ship the tool to detect it.
745
+ \emph{Capability and misuse:} the model is a mid-scale reasoning fine-tune with
746
+ no new hazardous capability beyond its already-public base; the standard risks
747
+ of language models (hallucination, insecure generated code, biased outputs)
748
+ apply, and it should not be deployed in high-stakes settings without independent
749
+ evaluation.
750
+ \emph{Environmental cost:} training and generation used $\approx$260
751
+ instance-hours (Appendix~\ref{app:cost}), reported here for transparency.
752
+
753
+ \section{Artifact Availability}
754
+ \label{sec:artifacts}
755
+ The model (merged weights and LoRA adapters), the training and evaluation code,
756
+ the configuration files, and the decontamination tool are publicly available
757
+ under Apache-2.0 at \url{https://huggingface.co/AlreadyAI/Bala-30B-A3B}. The
758
+ per-benchmark evaluation logs and the decontamination report are released
759
+ alongside this paper as part of the same artifact.
760
+
761
+ \section{Conclusion}
762
+ On commodity, NVLink-less GPUs and a small mixture of open reasoning corpora,
763
+ attention-only QLoRA distillation into a 3B-active MoE produced a large,
764
+ decontaminated mathematics improvement (MATH-500 $+23.6$; overall
765
+ $84.0\to88.5$) and no coding improvement. We reported the positive, the null,
766
+ and a contamination near-miss with equal weight, verified that the released
767
+ model trained on clean data, and released the recipe and the checking tools. The
768
+ result is intentionally modest and, we hope, trustworthy: a demonstration that a
769
+ small team can produce a real, checkable improvement cheaply --- and can say
770
+ precisely what did and did not work.
771
+
772
+ \appendix
773
+ \section{Full cost breakdown}
774
+ \label{app:cost}
775
+ \begin{table}[h]
776
+ \centering
777
+ \begin{tabular}{lrr}
778
+ \toprule
779
+ Item & Amount (USD) & Note\\
780
+ \midrule
781
+ g6e.12xlarge compute & 2{,}723.17 & 259.5 metered instance-hrs (on-demand)\\
782
+ EC2-Other (EBS/networking) & 19.20 &\\
783
+ S3 storage & 1.38 &\\
784
+ VPC / FSx / KMS / misc & 1.66 &\\
785
+ Tax & 253.91 &\\
786
+ Ancillary cloud AI-assistant & $\sim$91.55 & (Bedrock usage)\\
787
+ \midrule
788
+ \textbf{Total} & \textbf{3{,}090.87} & Jul 1--Sep 7 billing window\\
789
+ \bottomrule
790
+ \end{tabular}
791
+ \caption{AWS spend from Cost Explorer (billing-report window Jul 1--Sep 7, 2026;
792
+ the instance itself ran 2026-07-25 to 08-05). GPU compute alone was \$2{,}723
793
+ (under the \$3{,}000 ceiling); the all-in total was \$3{,}091.}
794
+ \end{table}
795
+
796
+ \section{Configuration and protocol details}
797
+ All configurations: attention-only QLoRA (\texttt{q,k,v,o\_proj}), 4-bit NF4
798
+ base, bf16 compute, paged 8-bit AdamW, gradient checkpointing, cosine schedule,
799
+ warmup ratio 0.03, 3 epochs, per-device batch 1, gradient accumulation 16,
800
+ \texttt{max\_seq\_length} 4096, sequence packing, seed 0, \texttt{<think>}
801
+ format preserved, loss masked on prompt tokens. Ranks/$\alpha$/learning rates as
802
+ in Table~\ref{tab:configs}. Evaluation: zero-shot greedy pass@1; merged models
803
+ served in FP8; math comparison ladder string$\to$numeric$\to$symbolic; code
804
+ judged by sandboxed execution.
805
+
806
+ \section{Per-configuration Stage-1 breakdown}
807
+ \label{app:percfg}
808
+ Table~\ref{tab:percfg} gives the per-benchmark core-3 pass@1 at epoch 3 for all
809
+ four configurations against the base. The mathematics column drives the
810
+ ranking: every configuration improves substantially on MATH while remaining
811
+ close to the base on GSM8K (near ceiling) and mixed on HumanEval+.
812
+
813
+ \begin{table}[h]
814
+ \centering
815
+ \begin{tabular}{lrrrr}
816
+ \toprule
817
+ Model (epoch 3) & GSM8K & HumanEval+ & MATH & core-3 overall\\
818
+ \midrule
819
+ base & 98.7 & 82.7 & 55.3 & 78.9\\
820
+ A (r32) & 98.0 & 73.3 & 69.3 & 80.2\\
821
+ \textbf{B (r128)} & 96.0 & 80.0 & \textbf{78.0} & \textbf{84.7}\\
822
+ C (r64) & 98.0 & 80.0 & 70.7 & 82.9\\
823
+ D (r64, low LR) & 96.0 & 76.7 & 72.7 & 81.8\\
824
+ \bottomrule
825
+ \end{tabular}
826
+ \caption{Stage-1 core-3 pass@1 by benchmark at epoch 3 ($n{=}150$ per
827
+ benchmark, 450 total). Configuration B (released) leads, driven by MATH.}
828
+ \label{tab:percfg}
829
+ \end{table}
830
+
831
+ \begin{thebibliography}{99}
832
+ \bibitem{hu2021lora} E.~Hu et al. LoRA: Low-Rank Adaptation of Large Language Models. \emph{arXiv:2106.09685}, 2021.
833
+ \bibitem{dettmers2023qlora} T.~Dettmers et al. QLoRA: Efficient Finetuning of Quantized LLMs. \emph{NeurIPS}, 2023.
834
+ \bibitem{cobbe2021gsm8k} K.~Cobbe et al. Training Verifiers to Solve Math Word Problems (GSM8K). \emph{arXiv:2110.14168}, 2021.
835
+ \bibitem{hendrycks2021math} D.~Hendrycks et al. Measuring Mathematical Problem Solving with the MATH Dataset. \emph{NeurIPS Datasets}, 2021.
836
+ \bibitem{lightman2023letsverify} H.~Lightman et al. Let's Verify Step by Step (MATH-500 subset). \emph{arXiv:2305.20050}, 2023.
837
+ \bibitem{chen2021codex} M.~Chen et al. Evaluating Large Language Models Trained on Code (HumanEval). \emph{arXiv:2107.03374}, 2021.
838
+ \bibitem{austin2021mbpp} J.~Austin et al. Program Synthesis with Large Language Models (MBPP). \emph{arXiv:2108.07732}, 2021.
839
+ \bibitem{liu2023evalplus} J.~Liu et al. Is Your Code Generated by ChatGPT Really Correct? (EvalPlus / HumanEval+ / MBPP+). \emph{NeurIPS}, 2023.
840
+ \bibitem{brown2020gpt3} T.~Brown et al. Language Models are Few-Shot Learners (GPT-3; n-gram decontamination). \emph{NeurIPS}, 2020.
841
+ \bibitem{soldaini2024dolma} L.~Soldaini et al. Dolma: An Open Corpus for Language Model Pretraining. \emph{ACL}, 2024.
842
+ \bibitem{kwon2023vllm} W.~Kwon et al. Efficient Memory Management for Large Language Model Serving with PagedAttention (vLLM). \emph{SOSP}, 2023.
843
+ \bibitem{wolf2020transformers} T.~Wolf et al. Transformers: State-of-the-Art Natural Language Processing. \emph{EMNLP (demos)}, 2020.
844
+ \bibitem{opencodereasoning} NVIDIA. OpenCodeReasoning dataset. Hugging Face, 2025.
845
+ \bibitem{mixofthoughts} Open-R1. Mixture-of-Thoughts dataset. Hugging Face, 2025.
846
+ \bibitem{openthoughts} OpenThoughts. OpenThoughts3 dataset. Hugging Face, 2025.
847
+ \end{thebibliography}
848
+
849
+ \end{document}