Changelog¶
All notable changes to micm-nlp will be documented here. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
[Unreleased]¶
Added¶
NOTICEandLICENSE-APACHE: attribution for the code derived from HuggingFace Transformers and PEFT (Apache 2.0) inmodels/architectures.py,training/data_collators.py,training/trainers.py,models/xpe/save_load.pyandmodels/xpe/peft_models.py, each of which now names its source in a header.
[0.5.1] - 2026-10-02¶
Fixed¶
The eval/test token budget (
*_max_tokens_per_batch) now counts a prompt learner’s virtual tokens. They are not in the dataset’s length column but every row carries them, so batches of short rows could exceed the budget by up to ~20% and run out of GPU memory (seen with Aya’s 256k-vocab fp32 logits on 141 GB GPUs). This applies to an explicit integer budget as well as toauto: the budget now means tokens in the forward pass, so prompt-learner runs with a fixed budget get smaller batches. Batching only: predictions and metrics are unchanged.prediction_stepalways ignorespast_key_values. Composite (multimodal) configs such as Gemma 4 leavekeys_to_ignore_at_inferenceempty, so the cache reached accelerate and raisedUnsupported types (DynamicCache) passed to _pad_across_processes.A
multircmetric group no longer also runs the generic metric-group path, which replaced the MultiRC scores (or failed loading a metric namedmultirc). MultiRC results computed before this fix are not trustworthy.
[0.5.0] - 2026-09-19¶
Runs on transformers 5 and peft 0.21 (was 4.49 / 0.14). Adapters saved by 0.4.x load unchanged; replaying a 0.4-era Aya adapter reproduces its stored per-language test accuracies to within one item in 300 on a few languages (bf16 numerics).
Changed¶
Requires
transformers>=5.5,<6andpeft==0.21.0.Configs must use the transformers 5
TrainingArguments:warmup_ratio→warmup_steps(a value below 1 is a ratio of total steps, computed the same way),group_by_length: true→train_sampling_strategy: group_by_length, and nosave_safetensors,overwrite_output_dirorlogging_dir. Inmodel.pretrained.args,torch_dtypeis nowdtype.transformers 5 loads a checkpoint in its own dtype (
"auto", e.g. bf16 for Aya) and defaultsoptimtoadamw_torch_fused; transformers 4 loaded float32 and usedadamw_torch. To keep earlier numbers, setmodel.pretrained.args.dtypeandtraining_args.args.optimexplicitly.XPE registers through
register_peft_method, which peft now needs for its config, tuner and prefix mappings.Tokenized datasets are saved as
tokenized--{org}--{model}, nottokenized|…|…: datasets ≥ 4 reads a cache path as a regex, where|is alternation.requirements-lock.txtrecords the transformers 5 environment; the previous record isrequirements-lock.pre-micm-nlp-0.4.txt.
Added¶
info.jsonrecordsversions.micm_nlp_commit: the commit of the package’s own checkout, suffixed-dirtywhen its tree has uncommitted changes, andNonefor an installed copy. An editable install follows a working tree that moves between releases, so the version string alone does not identify the code a run used.Every metric group records
n, the number of predictions it was scored on, so per-group results can be pooled by weight.
Fixed¶
XPE adapters for
CAUSAL_LMsaved no prompt-encoder weights under peft ≥ 0.17, which stopped wrapping a prompt encoder’s parts inmodules_to_save; the encoder’s weights are now read and written directly. Loading raises if one is missing.A model with no length limit in its config (Bloom) crashed the collator setup; transformers 5 no longer backs
max_lengthwith the generation default of 20.dataloader_num_workers > 0crashed: transformers 5 gaveseed_workertwo more arguments.
[0.4.1] - 2026-09-16¶
Added¶
@micm_pluginmakes a class in your workspace selectable by name in a config’scls. On the first lookup the workspace is scanned and only files that declare a plugin are imported; resolve order is plugins → micm-nlp →transformers.
Changed¶
Trainer and data-collator names resolve in micm-nlp before
transformers.
[0.4.0] - 2026-09-14¶
Added¶
python -m micm_nlpreaches the CLI (__main__.py), so the commands work on--targetinstalls that have nobin/.run --configandrun-group --group-config: a group config names unit configs and lists runs over them (reserved keysconfig,overrides,seed,name,separate_test; every other scalar key becomes a result column, except the framework’s own column names —group,index,time_id,uuid4,metric_group,step— which an entry may not use). The entry is picked bySLURM_ARRAY_TASK_ID, then--run-index, else every entry runs;--seedsupplies a seed for entries that do not set their own, and--root-pathgives the workspace root.--runner module:attror--runner path/to/script.py[:fn]supplies the science (the attribute defaults torun); unknown flags reach it asctx.extras. Example shipped asgroups/xsc_tune_across_seeds.yml.Every run writes its resolved
config.yml,info.json, one metrics file per evaluation event and always-on predictions into its run directory, throughtraining/run_output.py(RunOutput) andevals/results.py(save_metrics/save_predictions).info.jsoncarriesstarted/finished, everySLURM*variable, host, Python,CUDA_VISIBLE_DEVICES, package versions and the wandb id/url/dir, and the directory also getsmodel/wandbsymlinks to the checkpoint and the wandb run. Anoutput:config block (dir,config_file,prefix,columns) redirects the directory, renames the saved config, sets a filename prefix and stamps static columns onto every row.A
separate_testentry resolves a second config into the same directory astest_config.ymlwithoutput.prefixset toseparate_, so its files sit beside the primary’s rather than over them. The runner receives it asctx.test_config, and its resolved values land underseparate_resolvedininfo.json.
Changed¶
The run directory is
artefacts/runs/groups/{group}/{time_id}_{name}; a run outside any group lands inartefacts/runs/units/{name}, keeping the generated model name. No segment above the group varies with the run, so a group that varies the backbone stays one directory. Re-dispatching one entry within the same second raisesFileExistsErrorrather than merging into the existing directory. This replacesevals/runs/{model name}, which a test run typically left empty.Breaking: the shipped-config package
micm_nlp.example_configsis nowmicm_nlp.configs, with no compatibility shim.Breaking:
get_compute_metricsandcalc_confusion_matrixtakeoutput_dirwhere they tookeval_path. Keyword callers must be updated; positional callers are unaffected.pipeline.run(config, ctx=None)accepts and ignores a run context, so it is the default runner.Breaking:
pipeline.run()returns the run’sRunOutputinstead of(model, test_output), andNoneinstead of(None, None)for amode: preprocessconfig. One object whose shape is the run directory:output.dir, plusoutput.resultsandoutput.predictionsholding the rows of every file written, keyed by event name (test_after_train,eval_validation_before_train, …) and in the same shape the CSV holds. The old pair named its two resultsfull_shot/zero_shot— a second vocabulary for the same events — and dropped the four_evaluateresults entirely, which were reachable only by reading the files back.Breaking:
TRAINER.run()returns the sameRunOutput—output = trainer.run()— instead of aSimpleNamespace(full_shot=…, zero_shot=…)of raw HuggingFace prediction outputs. The metrics those carried are inoutput.results, one row per metric group.Breaking:
micm_nlp.init()takes the workspace root positionally —init('/path/to/workspace', pretty_output=True). The dict andMicmNlpConfigforms still work, soinit({'root_path': ...})is unaffected.micm_nlpre-exportsCONFIGandrun, so a script needs one import line.runresolves on first access (PEP 562) rather than at import, keepingimport micm_nlp— and thereforeinit()— clear of torch.pipeline.run()accepts a path to a config’s YAML as well as aCONFIG, so a script needs no separate load step.pipeline.run()calls the core classes directly instead of the single-stage functions beside it, so its body is the pipeline written out and a consumer intervening between two stages copies it and changes one line. The single-stage functions are unchanged and still exported.tests/test_pipeline_stages.pypins the docs’ copy of the sequence againstrun’s source.Breaking:
ds.comes_with_splitsis nowds.splits. A config still using the old name raises rather than being kept as an unknown extra whilesplitssilently takes its default.Breaking:
group.run_solo()isgroup.run_unit(), andRunContext.groupisNonefor such a run rather than the sentinel_solo. The vocabulary is unit config / unit run / group config throughout.Breaking: the run-info file is
info.json, notrun.json— it pairs withoutput.info, and in a directory where everything describes the run, “info” is what distinguishes it.RunOutput.infoholds the run details as written, alongsideresultsandpredictions, sooutputanswers for the whole run directory in memory.micm-nlp run/run-grouptake--root-path, the workspace root the Python API takes asinit()’s first argument;PROJECT_ROOT_PATHstays the default. With neither, the command exits naming both — it never falls back to the working directory, which would scatter one experiment across as many trees as the directories it was launched from.micm_nlp.example(name)returns the path of a config shipped inside the package, so a script can run one withoutinit-examplescopying it out first.The CLI no longer accepts abbreviated options (
allow_abbrev=False), so an unknown flag is forwarded to the runner instead of being matched to a prefix.Predictions are always written,
predictions_<stage>.csvin the run directory, one row per sample after the metric’s preprocessing. The old writer produced a real file only for token classification, an empty three-column one for text classification, and none at all otherwise.The config is read-only for the trainer — what the run resolved is in
info.json.eval_validation_after_train.csvis written from the after-training evaluation of the best checkpoint, and itsstepcolumn is the final training step, not the best checkpoint’s own step (that is in HF’strainer_state.json, under the checkpoint directory); the best checkpoint’s path is recorded asinfo.json→paths.best_checkpoint.Event files carry
before_train/after_train, or no stage for atest/evaluaterun, which has one pass per event.The dockerfile builds on
python:3.12-slim; the CUDA runtime comes from torch’s ownnvidia-*wheels rather than a CUDA base image.
Fixed¶
pipeline.runstops after tokenising for amode: preprocessconfig and returnsNone. It previously went on to build a model and a trainer, so the shippedxsc_preprocess.ymlcould not be run through it.
Removed¶
Breaking:
init-exampleswrites toconfigs/examples/instead ofmicm-nlp-examples/— beside where real configs live, not a package-named directory at the repo root. A destination argument still overrides it.Breaking: the
examples/scripts are removed.run_model.pywasmicm-nlp run --config …andpreprocess_dataset.pywas the same command on amode: preprocessconfig, so both were a third path to what the CLI already does andinit-examplesalready prints. The configs they ran still ship.test.save_predictionsis removed — predictions are always written.Breaking:
MODEL.eval_pathandMODEL.logs_pathare removed. The trainer owns the output directory (RunOutput) and derives the logging directory from it;MODELkeepspath(the checkpoint location) only.
Documentation¶
The README and the docs site are organised around the three contributions — Pipeline Unification (unit config → unit run), Experiment Orchestration (group config → many unit runs) and Features — each page opening with its tagline and the question it answers. A section shared by both lives once, in the README, and the site includes it.
The runner contract is written out:
run(config: CONFIG, ctx: RunContext) -> RunOutput, ending inreturn trainer.run().The stage-by-stage listing in the quickstart runs as copied: it calls
init()and loads the shipped example config.Notes use GitHub alert syntax (
> [!NOTE]), which renders on GitHub and, through a local Sphinx extension, as note cards on the site.The site restyle: VS Code One Dark Pro Darker / GitHub Light palettes, code blocks coloured by role (calls, constants, keyword arguments, shell commands and flags) at build time, Inter and JetBrains Mono, and a readable “On this page” menu.
[0.3.1] - 2026-09-04¶
Fixed¶
micm_nlp.init()with no arguments raisedTypeError, though both the README and the Quickstart present it as the form to use whenPROJECT_ROOT_PATHis already set.configis now optional.The two example scripts never called
init(), so both died at the first pipeline stage withRuntimeError: Call micm_nlp.path.set_root(...) first— an error naming an API neither page documents. Both call it now.micm-nlp init-examplesexited 1 when it skipped an existing file, which breaks running it twice from a script. Skipping is a normal outcome; it exits 0.torch>=2.4made a source install impossible on macOS-Intel, where 2.2.2 is the last available wheel. The floor is now 2.2.
Changed¶
The example configs set
WANDB_MODE: offlinein theirenv:block, so they log toartefacts/wandb/and run without a W&B account. Both were previously unrunnable without one, and the installation page described the key as optional.
Added¶
micm-nlp init-exampleswrites the example configurations into a directory you can edit (micm-nlp-examples/by default). The configs now ship inside the package, so the copy you get always matches the version installed — nothing is downloaded, which keeps it working offline and on a cluster node. An existing file is reported and left alone unless--forceis given.
Changed¶
Dependency bounds instead of exact pins.
transformerswas pinned to==4.49.0, which both blocked co-installation with anything wanting a different version and was already violated by the project’s own container (4.48.2); it is now>=4.48,<4.50.torchwas not declared at all despite being imported directly, so it arrived transitively and a fresh install resolved 2.14 — it is now declared as>=2.4,<3.numpy<3anddatasets<6gained upper bounds for the same reason.peft==0.14.0stays exact: the Cross-Prompt Encoder subclasses its internals.
Added¶
requirements-lock.txt, recording the container the published results were produced on. It is a record rather than an installable file — 76 of its entries are wheels baked into the NGC image, torch among them.
Fixed¶
The documented
docker build -t micm-nlp .could never have worked.pyproject.tomldeclaresreadme = "README.md", but the dockerfile copied onlypyproject.tomlandsrc/, so the build backend failed withOSError: Readme file does not exist: README.md.tests/test_parity.pycompared snapshots by exact equality, including floats rounded to six decimals andrepr()of a module tree. On torch 2.14 that failed six tests while every number that matters – loss, logits, state-dict keys, parameter counts – was identical: a weight norm read3.372187instead of3.372186, andLayerNorm.__repr__gained abias=Truefield. Floats now compare with a tolerance and the repr is recorded but not compared.
Documentation¶
The Quickstart’s
CONFIG.from_yaml('examples/configs/xsc_finetune.yml')raisedFileNotFoundErrorfor anyone who followed thepip install micm-nlpdirectly above it, becauseexamples/ships in the sdist but not the wheel. The configs now ship in the package and the snippet points atmicm-nlp init-examplesoutput. The example scripts stay in the repository — each is four lines, both are reproduced in the Quickstart, and a runnable script tree does not belong inside an installed package.
[0.3.0] - 2026-09-03¶
Changed (breaking)¶
The
tokenizerssubpackage is flat. Two module paths moved:micm_nlp.tokenizers.bert_byt5.BertByT5Tokenizerandmicm_nlp.tokenizers.xlm_roberta.CustomXlmRobertaare now both inmicm_nlp.tokenizers.architectures, mirroringmicm_nlp.models.architectures. Each module held one wrapper class and nothing else; the split bought no isolation.micm_nlp.tokenizers.lib.sent.ka_sen_tok.KaSenTokis nowmicm_nlp.tokenizers.ka_sen_tok.KaSenTok, and its two data files moved fromlib/sent/data/totokenizers/data/. Thelibandlib.sentpackages held a docstring each and no code — three levels of nesting around one module.
No shims: the old paths are gone. Nothing in this repo or in
xpe-expimported either class outside of tests and one lazy import, both updated. Updatetokenizer.clsvalues in any consumer config that names them.
Added¶
Docstrings for every published class and function. 220 objects had none, so each API page opened with a module description and then listed bare signatures; the generated reference now documents the whole public surface.
Fixed¶
utils.print_traceback()importedmicm_nlp.setup, a module that stopped existing in 0.2.0 when it was merged intobootstrap, so every call raisedModuleNotFoundError.TokenizerTrainer.train()returned silently for amodel.typeit cannot train.TokTypeSEhas six members and only three have a trainer, so a valid config could finish a run reporting nothing wrong and leaving no tokenizer behind. It now raisesValueError.CrossPromptEncoder’s class docstring used a Markdown code fence, which reStructuredText cannot parse, and its example importedmicm_nlp.models.cross_prompt_encoder— a path that no longer exists.CrossPromptEncoderConfig.encoder_embedding_normalizedefaulted to'unit'(max_norm1.0). Because_filtered_kwargsstripsNone-valued kwargs at the factory boundary, a YAMLencoder_embedding_normalize: nullnever reached the dataclass — so every savedadapter_config.jsonrecorded"unit"regardless of what the run actually did. The defaults are nowNone/None, so a saved adapter config records what happened. Behaviour is unchanged: normalisation is driven by the callback, whose registration reads the top-levelpeftblock. Adapter configs written before this change misreport the field — do not read a normalisation claim out of them.CrossPromptEncoder.__init__now validates the normalisation settings: an unknown mode raises, and'clip'without amax_normraises rather than silently doing nothing (Tensor.clamp(max=None)is a no-op, which the newNonedefault would otherwise have turned into a silent non-normalising clip).
Documentation¶
The site’s API reference now mirrors
src/micm_nlp/rather than a hand-written taxonomy, and its prose comes fromREADME.mdthrough MyST{include}, so README is the single copy of every passage the two share.
[0.2.1] - 2026-08-11¶
Fixed¶
NormalizePromptEncoderEmbeddingswas never registered: the trainer read its settings fromtask.peft, butpeftis a top-level config block, so the lookup always returnedNone. Registration is now additionally gated onpeft.encoder_embedding_normalizebeing set — without itnormalize_embeddings()is a no-op that would still log a0.0norm to W&B on every step of every XPE run. Consequence for existing results: any run that setencoder_embedding_normalizedid not in fact normalise, and measured the unnormalised model.DataCollatorTaskIDDecorator.__call__opened with a leftoverprint()/exit()debug pair, which made the rest of the method dead code.tokenize_sentences()defaulted toSentTokTypeSE.KA, whose branch was commented out, so calling it without an explicit method raisedValueError. The default is nowSentTokTypeSE.NLTK, and theKAbranch works again.micm_nlp.tokenizers.lib.sent.ka_sen_tokcould not be imported at all: it read its abbreviation lists frommicm_nlp.datasets.storage.collections.abbreviations, a package that does not exist here. The two data files (885 Georgian abbreviations, 379 abbreviation endings) now ship inside the package attokenizers/lib/sent/data/and are loaded throughimportlib.resources, so they survive installation from a wheel.nltk.download('punkt')no longer runs at import time — the models are checked first and only fetched when genuinely missing.
Changed¶
Every module now carries a module-level docstring, so the generated API reference explains what each module is for instead of listing bare symbols. Three known defects are now documented where they live: the unregistered
NormalizePromptEncoderEmbeddingscallback, the leftover debug body inDataCollatorTaskIDDecorator.__call__, andka_sen_tok’s missing abbreviation data (it cannot be imported as shipped).
[0.2.0] - 2026-08-10¶
Added¶
Token-budget batching:
TokenBudgetBatchSamplerbuilds batches to a target token count instead of a fixed sample count, with acalibrate_token_budgetprobe that binary-searches the largest budget that fits in memory.eval_max_tokens_per_batch/test_max_tokens_per_batchconfig keys (validated), wiring token-budget batching into the eval and test dataloaders. When unset, the previous fixed-batch path is used unchanged.early_stopping_metriconCustomTrainingArgsConfig, decoupling early stopping from best-checkpoint selection:'metric_for_best_model'delegates totraining_args, any literal key (e.g.'eval_loss') is monitored directly with its direction inferred. Defaults to'eval_loss', preserving prior behaviour.A seed configured in
training_argsis now honoured without enablingfull_determinism; the seed is randomised only when none is configured. Lets callers share fixed seeds across methods for paired comparison at no determinism overhead.Label-restricted likelihood for
mcqa_ftpviapreproc_rules.label_restricted_likelihood(opt-in, lm-eval-harnessmultiple_choicestyle): restricts the answer-slot argmax to the candidate label tokens inds.label.namesrather than the full vocabulary.Documentation site (Sphinx + Furo, API reference generated from source), published on Read the Docs.
Changed¶
BREAKING
LossEarlyStoppingCallbackis nowCustomEarlyStoppingCallback. The callback monitors any metric, not only loss, so the old name was misleading.BREAKING
env.pyandsetup.pyhave been consolidated intobootstrap.py; both were small and conceptually overlapping, andsetup.pycollided with packaging tooling.PROJECT_ROOT_PATHis relaxed toPath | NonesoEnv()can be imported beforeinit()runs.get_preprocess_logits_for_metricsmoved fromtraining/callbacks.pytoevals/eval.py, next toget_compute_metrics— the two share the prediction-shape contract, and the hook was never aTrainerCallback.Token-budget calibration merged into the
training/batchingmodule.Sequence lengths now fall back to
input_idsin the HuggingFace style instead of requiring an explicit length-column override.Token-budget
HEADROOMlowered from 0.85 to 0.80; the 15% margin was consumed by cumulative memory fragmentation during long evaluation sweeps.calibrate_token_budget’stoleranceparameter is deprecated and ignored — the search now always runs to convergence.
Fixed¶
calibrate_token_budgetended its binary search once the window shrank belowtoleranceand then probed only the window’s top edge, so any true fitting batch size in the coarse-halving dead zone was skipped and the budget collapsed to a single sequence. Every heavily-tokenised language was silently batched at ~1, and those whose shortest sequence fell below the floor were skipped entirely.Predictions were zipped against
ds_splitin dataset order whileTokenBudgetBatchSampleryields globally length-sorted samples, so undereval_per_taskgrouping every per-task metric was attributed to the wrong task. Batch samplers now expose anorderpermutation and alignment is applied sampler-agnostically; theSequentialSamplerpath is unaffected.Calibration probe correctness: binary-search over sorted lengths for a deterministic, shape-correct probe; post-loop
hiprobe so datasets smaller than the tolerance get the right budget; probe withlabels=so the cross-entropy logits cost is included; probehard_capdirectly and guard misconfiguredstart/hard_cap.NormalizePromptEncoderEmbeddingshookedon_optimizer_step, which does not receivemodelunder transformers 4.48, making the callback a no-op.The length column was stripped by
_remove_unused_columnsbefore the token-budget and length-grouped samplers could read it.Boolean values were accepted where a token budget was expected.
Single-process runs on multi-GPU partitions inherited SLURM environment variables that pushed accelerate into
MULTI_GPUmode and aborted during NCCL init;init()now strips them whenWORLD_SIZE=1.pad_to_multiple_ofis sourced from the data collator instead of a duplicated parameter.micm_nlp.evals.metricshad no__init__.py, making it an implicit namespace package unlike every other subpackage. It is now a regular package.
[0.1.0] - 2026-04-30¶
Added¶
Initial public release of the micm-nlp toolkit.
Config-driven pipeline (tokenization → preprocessing → training → evaluation).
Example: HuggingFace Hub dataset loading + decoder-only tokenization (
examples/preprocess_dataset.py+examples/configs/xsc_preprocess.yml).Example: PEFT fine-tuning + evaluation using Cross-Prompt Encoder (XPE) on a decoder-only LM (
examples/run_model.py+examples/configs/xsc_finetune.yml).WandB experiment tracking integration.