# Changelog ## 0.3.0 (2026-12-04) The first stable release since 0.2.1. MAMMOTH now runs on a native PyTorch transformer, exports models to Hugging Face, and ships a local translation server. Models and configs from 0.2.x need changes (see *Breaking changes*). If you tried 0.3.0rc1, see *Changes since 0.3.0rc1* at the end. ### Highlights - **Native PyTorch backend.** The transformer is built from plain `torch.nn` modules in `mammoth/modules/transformer/` (RoPE, attention with KV cache and grouped-query attention, SwiGLU / GeGLU / GELU feed-forward, RMSNorm). The x-transformers dependency is gone. - **Hugging Face export.** `mammoth_export_hf` writes three formats: *modular* (the default; every component is stored once and a model is assembled per direction at load time, including untrained zero-shot directions), *standalone* (one model per task) and *single artifact* (all tasks in one directory). Exported models run with only `transformers` and `torch` installed. `mammoth_upload` and `mammoth_download` move them to and from the Hub. - **Translation server.** `mammoth_serve` starts a local server with an OPUS-MT compatible HTTP API and a web page. All directions share one pool of components, directions (zero-shot included) can be loaded at runtime, and `--src` / `--output` translate a file and exit. Install with `pip install 'mammoth-nlp[server]'`. - **Extending a trained model.** Train a new language without touching the rest of the model: `freeze_components` / `train_components` freeze whole components by name (`@pretrained` selects everything in the `train_from` checkpoint), each language has its own post-embedding norm, and every checkpoint of a `train_from` run is a complete model. - **Tools.** `python -m mammoth.scripts.count_params` reports parameters per component, per task and in total. New docs pages explain estimating GPU memory and choosing sequence lengths. ### Breaking changes - **Requirements:** Python ≥ 3.11, torch ≥ 2.8, transformers ≥ 5.24 (< 6). Dependencies are declared in the package, so `pip install mammoth-nlp` installs torch, transformers and the rest. - **Configs:** the x-transformers options (`x_transformers_opts`) are removed; the model is set with top-level keys (`model_dim`, `heads`, `ff_mult`, `enc_layers`, `dec_layers`, ...). The FFN default is SwiGLU, and `model_dtype` now defaults to `bf16` (was `fp32`; set `model_dtype: fp32` on GPUs without bf16, e.g. V100). - **Checkpoints from 0.2.x** (x-transformers backend) do not load. - **Best checkpoint and early stopping:** `--metric_for_best_model` takes `mean_ppl` (default), `mean_bleu` or `mean_chrf`, averaged over every validated task. `--greater_is_better` and `--early_stopping_criteria` are removed. - **Tokenizers:** Hugging Face tokenizers are the supported path. SentencePiece is deprecated and only available as the `sentencepiece` extra. - **Commands:** - `mammoth_config_config`, `mammoth_generate_synth_data` and `mammoth_iterate_tasks` are no longer installed. `config_config` and `generate_synth_data` still run with `python -m mammoth.bin.`; `config_config` is planned for deprecation. `mammoth_iterate_tasks` is replaced by several `--task_id` values in one `mammoth_translate` run. - The OpenNMT translation server (`server.py`, the `/translator` API) and the Streamlit demo are removed; use `mammoth_serve`. - `--yes_i_messed_with_the_checkpoint` is renamed `--allow_partial_checkpoint` (the old name still works but is deprecated). ### Added - `mammoth_serve` (see *Highlights*). - `mammoth_export_hf`, `mammoth_upload`, `mammoth_download` and `mammoth_build_vocab` commands. - `mammoth_translate` translates several tasks in one run: give several `--task_id` values, with per-task `src` / `tgt` / `output` under `tasks.`. - `freeze_components` / `train_components` (see the *Freezing components* page). - `rope_theta` sets the RoPE base (default 10000); it is saved in the checkpoint and in exported models. - Gemma3-270M can be converted into MAMMOTH, with logits matching Hugging Face exactly in fp32. - Training logs the MAMMOTH version, the git commit and the effective `ff_mult` at startup. - Docs: install, quickstart, LUMI & Roihu quickstart (pip-installed venv, CPU job templates), Hugging Face export, serving, extending a model with a new language, freezing components, counting parameters, estimating memory, choosing sequence lengths, option pages for every `mammoth_*` command, and an API reference for the native modules, serving and HF export. ### Changed - New models get one post-embedding norm per language, saved with the language's embedding. Older checkpoints keep one norm per encoder/decoder path and load unchanged for translation. - Training: fewer GPU-to-CPU syncs, overlapped gradient all-reduce, fused AdamW by default. - Freezing options apply on every rank (before, only rank 0 froze). ### Fixed - RoPE base of rotary decoders: since 2026-09-17 (including 0.3.0rc1) every rotary decoder used base 160000 in training but 10000 in exported models. Checkpoints trained with this bug are not supported; retrain them. - Hugging Face export of GELU / GeGLU models: they were exported as SwiGLU with a randomly initialised weight. Weight loading is now strict. Re-export such models. - Causal self-attention with a KV cache and several new tokens could attend to later tokens (generation, one token per step, was not affected). - The exported model on transformers 5: `use_cache` was lost and `generate()` recomputed the whole prefix at every step. - Resuming a run with frozen components, and checkpoints of `train_from` runs that missed the components the run did not use. - NCCL deadlocks on the final save and on early stopping. ### Changes since 0.3.0rc1 For users of the release candidate; everything here is also covered above. - Python ≥ 3.11 and transformers ≥ 5.24 (rc1: Python ≥ 3.10, transformers ≥ 4.57). - Hugging Face commands renamed: `mammoth_convert2hf` → `mammoth_export_hf`, `mammoth_push2hf` → `mammoth_upload`, `mammoth_download_hf` → `mammoth_download`. - `mammoth_export_hf` writes the modular format by default. The former default (one model per task) is `--standalone`; `--modular`, `--standalone` and `--single-artifact` are mutually exclusive, and `--task` requires `--standalone`. - `model_dtype` defaults to `bf16`. - `--metric_for_best_model` values are `mean_ppl` / `mean_bleu` / `mean_chrf`; `--greater_is_better` and `--early_stopping_criteria` are removed. - Rotary-decoder checkpoints trained with rc1 are affected by the RoPE base bug (see *Fixed*). - GELU / GeGLU models exported with rc1 must be re-exported. - New: `mammoth_serve`, component freezing, per-language post-embedding norms, multi-task `mammoth_translate`, `count_params`, `rope_theta`. ## 0.3.0rc1 (2026-10-26) Release candidate for 0.3.0, published to test the release process. See the 0.3.0 entry. ## 0.2.1 (2024-12-16) Last release on the x-transformers backend.