FemtoScience: pretraining a small open scientific MoE
Pretraining a 994M-total / 229M-active open scientific Mixture-of-Experts model from scratch on 250B tokens across eight domains and 4K→16K context.
FemtoScience: pretraining a small open scientific MoE
In my earlier Femto posts, I used coding agents to build and probe tiny 48M–390M language models from scratch in JAX. The natural next question was how far that same workflow could stretch toward something closer to a genuinely useful domain model: a small, open, from-scratch scientific language model inspired by Galactica
FemtoScience is the result: a 994M-parameter Mixture-of-Experts model with 229M active parameters per token, trained from scratch on 250B tokens across eight scientific and agentic domains and extended from 4K to 16K context. This post covers pretraining only—from tokenizer design and controlled proxy ablations through Stage 1 pretraining, Stage 2a/2b mid-training, Stage 3 cooldown, and base-model analysis. Post-training (supervised fine-tuning, preference alignment, and verifiable RL) is out of scope here and will be written up separately. As with the Femto series, an AI agent (Gemini 4 Neon) designed and wrote the pretraining stack, tokenizer, data pipeline, and cluster runs with me directing the project, while Claude packaged the public release and drafted the initial figures.
Why a small scientific MoE
Galactica
A small scientific model today faces a sharper tension than a general chatbot. Scientific pretraining spans genuinely distinct distributions—LaTeX proofs, Python code, reaction mechanisms, protein chains, genomic DNA, and multi-step tool trajectories. A dense 230M model runs fast enough on a single workstation, yet quickly saturates its parameter budget when asked to store facts and syntax across eight modalities at once. Conversely, a 1B dense model has room for broader recall but pays roughly four times the training and inference FLOPs on every token.
Fine-grained Mixture-of-Experts
- Open end-to-end: release weights, intermediate stage checkpoints, tokenizer, data recipe, and pretraining code under an MIT license.
- Small active footprint, large capacity: run at ~229M active FLOPs per token while storing nearly 1B parameters across sparse experts.
- Native scientific & agentic tokens: handle proteins, DNA, molecules, citations, code, and tool-use markup inside one unified vocabulary from step 0.
- Long context (16K): enough room for full papers, multi-file code context, and long reasoning traces.
A modality-aware tokenizer
FemtoScience uses a 65,536-entry BPE vocabulary so every token ID fits cleanly in a uint16 shard—keeping 250B tokens of training storage compact without compression overhead. Digits are split into individual characters (\d) so numbers never fuse into arbitrary multi-digit chunks during arithmetic or chemical formulas.
On top of standard text BPE, sequence spans are tokenized atomically by modality:
-
[START_AMINO]…[END_AMINO]maps each residue to its own amino-acid token ([AA:A]…[AA:Z],[AA:*]). -
[START_DNA]…[END_DNA]maps each nucleotide base to a single token ([DNA:A],[DNA:C],[DNA:G],[DNA:T],[DNA:U],[DNA:N]). -
[START_SMILES]…[END_SMILES]uses a regex atom/bond/ring tokenizer ([SMI:...]), while[START_SELFIES]…[END_SELFIES]splits bracketed SELFIES tokens ([SF:...]) and[START_REF]…[END_REF]marks citations. - ChatML, fill-in-the-middle, and agentic delimiters are single reserved tokens from step 0:
<|im_start|>,<|im_end|>,<|think|>,<|/think|>,<|tool_call|>,<|/tool_call|>,<|tool_response|>,<|/tool_response|>,<|code_exec|>,<|/code_exec|>, and<|fim_prefix|>,<|fim_middle|>,<|fim_suffix|>.
There is one important caveat in how this worked out on real data. Most of the chemistry sources we used store SMILES inline inside prose rather than wrapped in explicit [START_SMILES] tags. As a result, the specialized [SMI:*] tokens saw far less training traffic than [AA:*] and [DNA:*]. Even so, in our controlled 149M-total / 54M-active proxy ablation (262M tokens each), the modality-aware tokenizer beat an identical-vocabulary plain BPE baseline overall (1.0035 vs. 1.0070 BPB), with the biggest per-domain gains landing on chemistry (−0.047 BPB) and DNA (−0.054 BPB). (On proteins, plain BPE achieves lower raw BPB because multi-character merges amortize predictable sequences over fewer tokens; atomic [AA:*] tokenization buys clean residue-level alignment and 100% in-modality prediction instead.)
Architecture and ablations
The backbone is a 16-layer, d_model = 1024 decoder-only transformer with untied input embeddings and output LM head (67.11M parameters each). Attention uses Grouped-Query Attention (16 query heads, 4 KV heads, head_dim = 64) with RoPE θ = 10⁶ from step 0. Following Qwen’s gated attention work
Following DeepSeek-V3 d_ff = 2560), and Layers 1–15 are fine-grained MoE layers. Each MoE layer combines one always-on shared expert (d_ff = 512) with 64 routed experts (d_ff = 256), selecting top-6 experts per token via a sigmoid router. Load balancing uses auxiliary-loss-free dynamic bias updates (moe_bias_lr = 1e-3, frozen to 0 during the final Stage 3 cooldown) alongside a tiny sequence-level auxiliary loss (1e-4), and routed experts execute as fused grouped GEMMs via PyTorch’s torch._grouped_mm. We chose 64 finer-grained experts over 32 larger ones because our iso-parameter, iso-active proxy sweep (64E top-8 vs. 32E top-4) showed finer segmentation taking first place (1.0022 vs. 1.0035 BPB) while keeping expert load well balanced.
We also train with a 1-step Multi-Token Prediction (MTP-1) head (loss weight 0.3) branching off the Layer 15 hidden state. Beyond improving next-token validation BPB by −0.0121 across every domain in ablation, MTP-1 serves as a zero-extra-memory draft head at inference time: on intermediate Stage 1 checkpoints (steps 25k and 50k), speculative decoding with the MTP head achieved 79–81% draft acceptance and a 1.26–1.36× average decoding speedup.
Running all six controlled ablations at the 149M/54M proxy scale gave us a clear ranking of what mattered before launching the 250B run: modernizing the data mix (−0.1294 BPB) and switching to Muon (−0.0504 BPB) dwarfed everything else, followed by gated attention + QK-Norm (−0.0145 BPB), MTP-1 (−0.0121 BPB), modality-aware tokenization (−0.0036 BPB), and finer expert granularity (−0.0012 BPB).
Data
Our pretraining corpus, corpus_v1_modal, totals 116.38B unique training tokens across eight domains (103.9M documents stored in 1,186 shards of 100M uint16 tokens, 217 GB on disk) plus 31.97M held-out validation tokens. Everything is built from 57 public sources—academic papers, educational STEM web/PDF/encyclopedic corpora, curated math, scientific and general code, chemistry datasets, protein sequences, genomic DNA, and open reasoning/agentic trajectories.
Rather than holding one static mix for 250B tokens, the curriculum shifts weight progressively from broad scientific literacy toward mathematical reasoning, code, chemistry, and agentic tool traces: agentic trajectories climb from 2% → 16% → 25%, math rises from 14% → 18% → 20%, and chemistry rises from 7% → 8% → 12%, while papers taper from 34% → 24% → 15% and STEM-edu from 25% → 12% → 8%. Averaged over the full 250B-token run, each domain is seen roughly 1.0× to 2.65× (~2.15× overall). In the proxy ablation, this modern 8-domain mix beat a Galactica-2022-style papers-heavy mix (83% papers) by 0.1294 BPB—the largest single effect we measured.
Corpus inventory and primary public sources (57 sources, 116.38B unique tokens)
| Domain | Unique train tokens | Shards | Epochs @ 250B | Primary public sources |
|---|---|---|---|---|
papers | 28.91B | 291 | 2.65× | common-pile/arxiv_papers, common-pile/pubmed, jablonkagroup/chempile-paper (EuroPMC, bioRxiv, medRxiv, cond-mat) |
stem_edu | 25.11B | 255 | 2.12× | FineWeb-Edu, FinePDFs-Edu, CLIMB, Wikipedia |
math | 18.39B | 185 | 2.07× | HuggingFaceTB/finemath (finemath-4plus, infiwebmath-4plus), TinyGSM |
code | 14.74B | 150 | 2.20× | common-pile/stackv2_edu_filtered, jablonkagroup/chempile-code, codeparrot/github-jupyter-parsed, Python/shell corpora |
chemistry | 8.17B | 87 | 2.32× | jablonkagroup/chempile-{education,reasoning,instruction,lift,paper} |
agentic | 8.11B | 87 | 1.96× | Agent-Ark/Toucan-1.5M, open-thoughts/OpenThoughts3-1.2M, SWE-bench/SWE-smith-trajectories, MegaScience, nvidia/OpenCodeReasoning, SmolTalk, terminal/FC traces |
proteins | 7.96B | 81 | 1.26× | ConvergeBio/uniref50, DanielHesslow/SwissProt-Pfam, tumorailab/protein2text-swissprot-split |
dna | 5.00B | 50 | 0.96× | arcinstitute/opengenome2 |
| Total | 116.38B | 1,186 | ~2.15× | All recipe configs are in MJ10/FemtoScience |
The 3-stage schedule
Training follows a Warmup–Stable–Decay (WSD) schedule torch.compile, weight decay 0.1, gradient clipping at 1.0, and peak learning rates of 6e-4 (AdamW) and 1.2e-3 (Muon). Each stage initializes from the previous stage’s final checkpoint, carries over optimizer state seamlessly, resets the stage step counter, and saves a single 1 − sqrt decay for the very end.
| Stage | Tokens (cum.) | Context | Steps | LR schedule | Notes |
|---|---|---|---|---|---|
| 1 · pretrain | 185B (185B) | 4K | 176,429 | 2,000 warmup, then constant | 3 Slurm chunks with preemption resume |
| 2a · midtrain | 30B (215B) | 4K | 28,610 | constant | Shifted mix, optimizer state carried over |
| 2b · midtrain | 15B (230B) | 16K, doc-masked | 14,305 | 200 warmup, then constant | Batch 4 × grad-accum 2 per GPU |
| 3 · cooldown | 20B (250B) | 16K, doc-masked | 19,073 | 1 − sqrt decay to 0 | MoE routing bias frozen (bias_lr = 0) |
Looking at the validation curve, overall BPB plunges early (0.9351 at 2B → 0.7472 at 69B) and then spends the second half of Stage 1 looking remarkably flat around 0.735–0.742. That plateau is classic WSD behavior at peak learning rate: iterates keep bouncing around a wide basin floor while internal features still sharpen. Switching to the Stage 2a/2b mixes nudges overall BPB down (0.7354 → 0.7321 → 0.7166), and then the final 20B-token 1 − sqrt cooldown triggers a sharp −0.0672 BPB drop (0.7166 → 0.6494, perplexity 5.25 → 4.49), pulling down every domain simultaneously. One nice side effect of saving the un-decayed Stage 1 and Stage 2a checkpoints is that future mid-training experiments or alternative cooldowns can branch straight from them without re-running the 185B base.
Muon + AdamW
For optimization, we pair Muon 0.2 · √max(d_out, d_in))
Handling 3D expert tensors cleanly is worth a brief note. In our grouped-GEMM MoE implementation, each layer stores its 64 routed experts as a single stacked (64, d_out, d_in) parameter rather than 64 separate modules. Rather than flattening experts together, our Newton–Schulz orthogonalizer runs batched over the trailing two matrix dimensions (-2, -1), so every individual expert’s gate, up, and down projection is orthogonalized independently.
In the proxy ablation, MuonAdamW beat AdamW alone by −0.0504 BPB (1.0035 vs. 1.0538)—the largest architectural or optimizer win in the matrix. On the systems side, pre-transposing tensors into wide canonical shapes, compiling the 5-step quintic Newton–Schulz core, and sharding orthogonalization work across DDP ranks by parameter size (followed by all_gather_into_tensor, paired with fused AdamW) cut optimizer step time from 124.5 ms down to 29.4 ms per step.
Context extension to 16K
Because RoPE was initialized with θ = 10⁶ from step 0, extending from 4K to 16K in Stage 2b required no frequency rescaling or YaRN patches—we simply rebuilt the cosine/sine caches for 16,384 tokens, ran 15B tokens of 16K mid-training plus 20B tokens of 16K cooldown, and enabled a FlexAttention block-diagonal document mask so packed documents never attend across <|eos|> boundaries. On the same 8×H200 node, 16K training drops steady-state throughput from roughly 1.05M to ~0.73M tokens/s.
Evaluating 16,384-token windows across papers, code, STEM education, and DNA confirms that the extension worked cleanly. Under document-masked scoring matching training, Stage 3 beats Stage 1 in every single position bucket, and at the farthest 12K–16K slice improves papers (0.603 → 0.537 BPB), code (0.536 → 0.451), STEM edu (0.766 → 0.734), and DNA (1.776 → 1.754). Across the full 16K window, papers fall from 0.708 → 0.642, code from 0.586 → 0.473, and STEM edu from 0.803 → 0.755.
Toggling between the two scoring modes above reveals a subtle evaluation trap we hit during Stage 2b. When we scored packed 16K windows without the document mask, DNA appeared to collapse catastrophically past 4K—climbing to 4.15 BPB at 12K–16K for Stage 3—because late positions were attending across unrelated genomic fragments concatenated into the same window. Turning on the document mask immediately flattens DNA to 1.75–1.85 BPB across the entire 16K span. (Note that we did not run synthetic needle-in-a-haystack retrieval probes on the base checkpoints.)
Base-model evaluations
Across all eight held-out validation domains, the final Stage 3 checkpoint reaches 0.6494 overall BPB, with the largest stage-to-stage drops coming from the mid-training curriculum shifts on agentic (0.3845 → 0.1984) and the final cooldown on proteins (1.6229 → 1.3556) and chemistry (0.6195 → 0.5153):
| Domain | S1 (185B) | S2a (215B) | S2b (230B) | S3 (250B) |
|---|---|---|---|---|
papers | 0.7126 | 0.7174 | 0.6861 | 0.6384 |
stem_edu | 0.8222 | 0.8438 | 0.7983 | 0.7482 |
math | 0.5144 | 0.5050 | 0.5110 | 0.4490 |
code | 0.5335 | 0.5145 | 0.5135 | 0.4594 |
chemistry | 0.6304 | 0.6295 | 0.6195 | 0.5153 |
proteins | 1.5325 | 1.5222 | 1.6229 | 1.3556 |
dna | 1.8190 | 1.8179 | 1.8257 | 1.8110 |
agentic | 0.3845 | 0.2959 | 0.2755 | 0.1984 |
| Overall (weighted) | 0.7354 | 0.7321 | 0.7166 | 0.6494 |
General language ability (CORE)
On the 22-task DCLM CORE benchmark 0.169 (26B) → 0.198 (52B) → 0.208 (79B) → 0.191 (105B) → 0.2510 at 250B after cooldown—nearly matching the 0.2565 reference score of dense 1.5B GPT-2 XL while using 229M active parameters. Inspecting per-task logs explains the 100k-step (105B) dip: while the other 20 tasks improved monotonically (0.213 → 0.224 → 0.236 → 0.240), peak-LR oscillations on binary/MCQ tasks (boolq swinging down to −0.606, commonsense_qa dropping +0.205 → +0.008) dragged down the composite mean. On the final Stage 3 checkpoint, the strongest tasks are arc_easy (0.531), bigbench_qa_wikidata (0.519), bigbench_operators (0.510), bigbench_cs_algorithms (0.464), and squad (0.445), while the weakest are boolq (−0.171), agi_eval_lsat_ar (0.038), and bigbench_repeat_copy_logic (0.062).
Scientific probes against Galactica
Comparing the base checkpoints zero-shot against Galactica-125M and Galactica-1.3B yields a sharp split between biology and chemistry:
- Clear wins in protein and DNA modeling: Stage 3 reaches 0.226 bits/residue gain over shuffled controls on protein sequences (nearly 3× Galactica-1.3B’s
0.076), 0.1031 mean Spearman ρ across 217 ProteinGym DMS assays (5.1× Galactica-1.3B’s0.0202), and 0.4751 macro MCC across six Nucleotide Transformer DNA linear probes (0.4621for Galactica-1.3B). - The SMILES format split: Inside
[START_SMILES]span tags, Galactica completes 35–41% of ChEBI-20 half-molecules into RDKit-valid SMILES, whereas FemtoScience scores only 1–6%. Flip the prompt to plain-text"SMILES: "and the ranking reverses: FemtoScience hits 22–34% valid vs. 8–9% for Galactica. That mirrors our corpus directly—almost all chemistry incorpus_v1_modalused inline plain-text SMILES rather than[START_SMILES]tags. (One reporting lesson here: an earlier run in an environment without RDKit silently fell back to bracket-balance counting and inflated validity; all numbers reported here use RDKit.) - Biomedical QA regression:
PubMedQAdrops from 0.560 in Stage 1 to 0.405 in Stage 3, echoingboolq’s yes/no likelihood instability in base checkpoints before instruction tuning. OnChemBench(0.309),LAB-Bench(0.233), andSciQ(0.700), Stage 3 sits cleanly between Galactica-125M and Galactica-1.3B.
Metric definitions for the scientific probes
All probes run zero-shot on base models via eval_multimodal.py:
- Protein bits: Mean next-residue bits-per-residue gain over monomer-shuffled controls across
LLM-bioseq-probe,SwissProt-Pfam, andProtein2Textheld-out sequences. - ProteinGym DMS ρ: Mean zero-shot wild-type-marginal Spearman rank correlation across 217 deep mutational scanning assays.
- DNA probe MCC: Macro Matthews correlation coefficient across 6 stratified Nucleotide Transformer linear-probe tasks (
enhancers,promoter_tata,promoter_no_tata,H3K4me3,splice_sites_donors,splice_sites_acceptors). - Tagged SMILES valid / Plain SMILES valid: RDKit chemical validity rate on greedy completions of half-molecules from ChEBI-20, prompted either with
[START_SMILES]tags or plain"SMILES: "text. - ChemBench: Accuracy across 9 chemistry multiple-choice and numeric subsets.
- LAB-Bench: Accuracy across 6 text subsets (
SeqQA,CloningScenarios,LitQA2,ProtocolQA,DbQA,SuppQA). - PubMedQA: Yes/no/maybe biomedical QA accuracy.
- SciQ: 4-way science multiple-choice accuracy.
Inside the experts
With 64 routed experts per layer and top-6 routing, a natural question is whether experts divide up cleanly by scientific domain. I ran the final Stage 3 checkpoint over 12K held-out tokens from each of the eight domains and recorded every routing choice.
Specialization turns out to be real, but partial. Mutual information between a token’s domain and its chosen experts starts near zero at layer 1 (0.13 bits), jumps sharply to 0.53 bits by layer 4, dips through the middle layers (0.33–0.41 bits across layers 6–9), and settles around 0.46–0.54 bits in layers 10–15—substantial signal, though well below the 3.0 bits needed to separate eight domains cleanly.
Most experts remain generalists rather than single-domain specialists. Counting an expert as “owned” by a domain when that domain sends more than half of its traffic (under equal tokens per domain), layer 1 has none, layer 4 has three, layer 8 has one (code), and layer 15 has seven: two for chemistry and one each for papers, STEM education, math, proteins, and DNA. Only two experts in the entire network exceed 70% single-domain traffic, both in layer 15 (protein expert 26 at 73.6% and DNA expert 61 at 70.9%).
The token-level routing lens shows what drives that behavior: routing responds to local token morphology as much as document topic. Inside a [START_SMILES] span, single-character atom tokens route to the same experts as single-character protein residues ([AA:*]) rather than to the chemistry prose immediately surrounding the molecule.
What it writes
Aggregate numbers smooth over what a base model actually feels like to prompt, so we probed the checkpoints directly across prose, citations, proteins, DNA, SMILES, math, scientific Python, and tool use (mostly greedy decoding, plus T = 0.7 checks for synthesis and prose). The browser above holds 28 curated runs across Stage 1 and Stage 3—failures included—and traces a crisp boundary between what pretraining already unlocks and what still waits on post-training:
- Memorized biology and cross-modal motifs surface with the right framing: Given the first 40 residues of human ubiquitin, Stage 3 completes the remaining 36 residues with 33 exact matches (the first 16 in a row; scoring on the true sequence gives 94.4% top-1 next-residue accuracy vs. 5.6% shuffled). Given only 20 residues it collapses into a poly-lysine run, and neither hemoglobin beta nor GFP is recalled at either stage. On DNA, prompting with a raw
[START_DNA]sequence containing canonicalTTGACAandTATAATmotifs causes Stage 3 to immediately recognize the-10and-35bacterial sigma-70 boxes (before mixing up the transcription start site with the start codon). - Citations and SMILES follow the corpus format, not unused tags: In a standard reference list, Stage 3 completes He et al. (CVPR 2016, pp. 770–778) and Jumper et al. (Nature 596, 583–589, 2021) accurately before hallucinating the following entry. In all four attempts with
[START_REF], the tag was ignored—matching a pretraining corpus that rarely wrapped references in tags. Likewise, zero-shot SMILES-to-name lookup still hallucinates (Aspirin from plain SMILESturns into 1-methyl-2-butene), and DNA continuations collapse into homopolymer runs. - Cooldown sharpens reasoning, arithmetic, and tool grounding: Inside
<|think|>blocks, Stage 3 sets up free fall ($t = \sqrt{2h/g} = 2.0205\,\text{s}$) before second-guessing itself and derives $\text{Var}(X) = p(1 - p)$ cleanly, whereas Stage 1 uses the wrong kinematics formula and concludes $\text{Var}[X] = p$. In ChatML, Stage 3 computes the molecular weight of glucose (C6H12O6) to exact 180.156 g/mol before looping back to repeat Step 3, and after a<|tool_response|>it reads out"The logP of ibuprofen is 3.5."while Stage 1 overwrites the tool output. Still, reasoning fails smoothly on subtler traps: inside<|think|>on a medical screening question, it walks straight into the textbook base-rate fallacy (99 / 104instead of16.7%), and integral arithmetic takes $\int_0^1 e^x\,dx$ to be $e$ instead of $e - 1$. - Classical scientific code works; FIM and edge cases do not: Prompted cleanly right after the docstring’s closing quotes, Stage 3 writes an exact 4th-order Runge-Kutta step (
rk4_step, integrating $y’=y$ to2.25e-10error) before drifting into an unfinishedrk5_step. By contrast, the 9 earlier unit-tested Python prompts (such asreverse_complement) all failed, and Fill-in-the-Middle prompts using<|fim_prefix|>,<|fim_suffix|>, and<|fim_middle|>simply copy the suffixassertlines—showing that the reserved FIM tokens saw little or no FIM-formatted code during pretraining. - Creative synthesis & decoding quirks: Greedy prose loops heavily (
30–55%repeated trigrams at Stage 3), whereas sampling atT = 0.7eliminates loops (4%) and lets the model draft plausible cross-disciplinary abstracts (such as a cell-free CRISPR seawater microplastics biosensor or a folding-funnel vs. loss-landscape analogy) with occasional late conceptual slips. For code completion, never end a prompt on a bare trailing newline: because our tokenizer merges\nplus indentation into single tokens, a trailing newline stalls generation, whereas ending at the docstring’s closing quotes lets the model emit the indented token directly.
Lessons learned
Several cluster and evaluation bugs mattered as much to finishing the 250B run as the architecture choices:
- Forward preemption signals down the process tree. Our first 24-hour Stage 1 chunk hit its Slurm limit without writing an end-of-job checkpoint because the wrapper script lacked a
SIGUSR1trap—losing 650 steps back to the last periodiclatest.pt. Adding a BFS descendantUSR1forwarder down to thescigal.trainworker ranks let subsequent chunks all-reduce a clean stop flag and checkpoint gracefully. - Evaluate the exact way you train. Our first Stage 2b attempt crashed at step 6,000 inside validation: materializing full-vocab logits over 16K sequences triggered a 16 GiB allocation OOM, and it had also been scoring packed 16K windows without the document mask (reading
1.22–1.31BPB instead of~0.72). Switching validation to chunked linear cross-entropy over normalized hidden states, threadingdoc_maskinto validation, and settingexpandable_segments:Truefixed both. - Raise
ulimit -nfor large sharded corpora. Memory-mapping all 1,186 shards per DDP rank immediately exceeds the cluster’s default 1,024 open-file soft limit; the job script and data loader now raise it automatically. - Keep Python environments off parallel filesystems. Concurrent imports from a shared virtualenv on Lustre/BeeGFS triggered transient
ENOENTfailures under load. Packing the virtualenv into a tarball once and untarring to node-local disk per job eliminated them completely. - Zero-math-change throughput tuning pays for itself. Eliminating MoE graph breaks (
scatter_add_+ 32-bitargsortinstead ofone_hot/bincount), writing a Triton-fused chunked cross-entropy kernel, DDP-sharding compiled Muon, using fused AdamW, adding async prefetching, and compressing DDP gradients in bf16 lifted real Lustre throughput +22.6% (from ~833K to ~1.02M tokens/s at 4K), saving roughly 12 hours of 8×H200 node time.
Looking back, three things stand out that I would change on a second pretraining pass: (1) wrapping inline SMILES strings from chemistry datasets into [START_SMILES]…[END_SMILES] spans during tokenization so the dedicated chemistry tokens actually get trained, (2) mixing 16K documents earlier rather than confining long context to the final 35B tokens, and (3) running short diagnostic cooldown branches off intermediate Stage 1 checkpoints to separate real regressions (like PubMedQA) from peak-LR noise before the final cooldown.
Release
The base weights, intermediate stage checkpoints, and pretraining codebase are released under the MIT license:
- Weights & model card:
mokshjain/FemtoScienceon Hugging Face. Themainbranch holds the Stage 3 final base checkpoint (250B tokens, 16K context), and revisionsstage1-185B,stage2a-215B, andstage2b-230Bexpose each earlier stage viafrom_pretrained(..., revision="stage1-185B"). Checkpoints include bf16safetensors(with MoE routing biases kept in fp32), tokenizer files, standalonetrust_remote_codemodeling files, and the separate MTP head. - Pretraining code:
github.com/MJ10/FemtoScience, containing the model, modality-aware tokenizer, data sharding pipeline, Muon + AdamW trainer, WSD and1 − sqrtschedules, FlexAttention document masking, BPB/CORE/multimodal evaluation suites, Slurm launch scripts, and Hugging Face export script.
Credits
The model architecture, modality-aware tokenizer, data recipe, training schedule, pretraining codebase, and cluster experiments were designed, implemented, and run by Gemini 4 Neon with me directing the project. Claude (Anthropic) prepared the public release—checkpoint conversion, standalone transformers remote-code fixes, release tests, the model card, and the initial figures and draft of this post.