Skip to main content

micm-nlp

PyPI Docs Python License: MIT

A research framework for NLP — the whole pipeline in a single YAML, run alone or in groups. Builds on the HuggingFace stack and adds a layer of features of its own.

micm-nlp.readthedocs.io — full documentation 📚

About

micm-nlp is developed at the Muskhelishvili Institute of Computational Mathematics (MICM), Georgian Technical University.

It has backed two peer-reviewed publications:

  1. Cross-Prompt Encoder for Low-Performing Languages
    Findings of IJCNLP–AACL 2025; ACL Anthology
    Beso Mikaberidze, Temo Saghinadze, Simon Ostermann, Philipp Müller

  2. A Comparison of Different Tokenization Methods for the Georgian Language
    ICNLSP 2024; ACL Anthology
    Beso Mikaberidze, Teimuraz Saghinadze, Guram Mikaberidze, Raphael Kalandadze, Konstantine Pkhakadze, Josef van Genabith, Simon Ostermann, Lonneke van der Plas, Philipp Müller

What micm-nlp offers

Contribution In short Answers
Pipeline Unification unit config → unit run How do I describe a whole run in one place, and make it reproducible?
Experiment Orchestration group config → many unit runs How do I run many variations, and collect their results together?
Features ready-made functionality What can I do here that the HuggingFace stack does not already do?

Install

pip install micm-nlp

Requires Python 3.10 or newer. For installing from source, with Docker, or setting up the .env file see the install docs.

Quickstart

from micm_nlp import init, run, example

init('/path/to/your/workspace')
output = run(example('xsc_finetune.yml'))
  • init() loads .env and sets your workspace root. A bare init() is enough when PROJECT_ROOT_PATH is set in .env or the environment.
  • run() takes a config, and chains: load tokenizer → load and preprocess dataset → load model, with PEFT if configured → train → evaluate.
  • example() resolves the path of a config shipped inside the package.
  • output holds info about run, raw predictions, metric results, and the dir path where everything is written.

Pipeline unification

One YAML unit config describes a whole pipeline that is executed as a unit run and lands in dedicated output dir.

mode:                 finetune # preprocess | train | finetune | evaluate | test
task:                 {category, name, metric_groups, preproc_rules}
tokenizer:            {source, name, args, ...}
ds:                   {category, dirs, name, type, splits, preproc_rules, ...}
model:                {architecture, pretrained: {cls, args, ...}}
peft:                 {peft_type, task_type, ...}
trainer:              {cls}
training_args:        {cls, args}
custom_training_args: {...}
data_collator:        {cls, args}
eval:                 {before_training, after_training, ...}
test:                 {run, zero_shot, ...}
generation_config:    {...}
cuda:                 {...}
env:                  {...}
  • model, tokenizer and ds each can take the HuggingFace Hub slug, or be loaded from local disk.
  • cls keys are class names, resolved at runtime from transformers — and, for trainers and collators, from this package too — so a new backbone or head needs no code.
  • args keys pass any extra keyword arguments verbatim to the cls constructor.
python -m micm_nlp run \
    --config        configs/units/tune.lm.aya.ds.bebe.yml \
    --root-path     /path/to/your/workspace
  • --root-path is only needed when PROJECT_ROOT_PATH is not set.

Everything the run writes is reachable from one directory:

artefacts/runs/units/{model.name}/
├── config.yml                       # the config as resolved
├── info.json                        # environment, versions, resolved seed and metric, wandb, paths
├── eval_validation_before_train.csv # one row per metric group
├── eval_validation_after_train.csv  # same, from the best checkpoint
├── test_after_train.csv             # same, on the test split
├── predictions_after_train.csv      # one row per sample, always written
├── model -> …                       # symlink to the checkpoint
└── wandb -> …                       # symlink to the wandb run

Console output is kept only by an online wandb run, in wandb/files/output.log; an offline run writes no such file.

The unit run is the full reference; the stage-by-stage form is the same chain unwrapped.

Experiment orchestration

One YAML group config varies your unit configs into many unit runs, each landing in its own dir under one group directory.

# configs/groups/aya_lr_search.yml
configs:
  tune_aya_bebe: ../units/tune.lm.aya.ds.bebe.yml
runs:
  - {config: tune_aya_bebe, name: lr1e-4, seed: 1, overrides: {training_args.args.learning_rate: 1e-4}}
  - {config: tune_aya_bebe, name: lr5e-5, seed: 1, overrides: {training_args.args.learning_rate: 5e-5}}

In a group config each entry in runs: resolves one unit config from configs: and forms one unit run. The runs land side by side, in artefacts/runs/groups/{group}/{time_id}_{runs[i].name}/. Every result row is stamped with the run's identity, so the group's runs concatenate into one table.

python -m micm_nlp run-group \
    --group-config  configs/groups/aya_lr_search.yml \
    --run-index     0 \
    --root-path     /path/to/your/workspace \
    --runner        /path/to/your/custom/run.py
  • --run-index selects one run; skip it to run everything.
  • --root-path is only needed when PROJECT_ROOT_PATH is not set.
  • --runner allows your own custom run(config, ctx), or can be skipped — resolved config, run entry, and unknown CLI flags are passed. Append :fn to name a function other than run.
sbatch --array=0-1 my_wrapper.sh \
    "python -m micm_nlp run-group --group-config configs/groups/aya_lr_search.yml"

Under a SLURM array each task picks its own run by SLURM_ARRAY_TASK_ID.

The group run is the full reference: every reserved key, what each run writes, and how to supply a runner.

Features

Thirty features on top of the HuggingFace stack, grouped by the area of the package they live in.

Area Some of what is there
PEFT the Cross-Prompt Encoder — a published method, not a wrapper; soft prompts, the encoder, or any mix of the two, set by one ratio; save and load for adapters stock PEFT cannot serialise
Training token-budget batching with an 'auto' GPU probe; early stopping decoupled from model selection; per-parameter-group optimizer settings from YAML; collators HuggingFace lacks; closed-set generation
Evaluation label-restricted likelihood; length-normalised log-likelihood accuracy; a declarative post-processing chain
Data length statistics for choosing max_length from evidence; a declarative pre-processing chain; splitting, subsetting or concatenation based on config
Tokenizers an architecture-aware factory; SentencePiece / WordPiece / byte-level BPE training; a Georgian sentence splitter with 885 abbreviations

Every entry says what HuggingFace does on its own, so the difference is checkable rather than asserted, and links to the module behind it.

The feature list is all of them.

Examples

Three configs ship inside the package, covering one use case end to end — preprocessing, decoder-only PEFT fine-tuning on an FTP-reframed multilingual dataset from the HuggingFace Hub, and the same fine-tune as a group.

Config What it does
xsc_preprocess.yml loads FTP-reframed XStoryCloze (English) from the Hub, tokenizes it for BLOOM-560M, saves the result locally
xsc_finetune.yml fine-tunes BLOOM-560M with Cross-Prompt Encoder PEFT on the Arabic split, then evaluates
groups/xsc_tune_across_seeds.yml the same fine-tune at two seeds, one run directory each
micm-nlp init-examples
python -m micm_nlp run       --config       configs/examples/xsc_preprocess.yml
python -m micm_nlp run       --config       configs/examples/xsc_finetune.yml
python -m micm_nlp run-group --group-config configs/examples/groups/xsc_tune_across_seeds.yml

init-examples writes editable copies to configs/examples/; example() reaches the same files in place.
The package's surface is broader than these three demonstrate. Examples for encoder-only text classification, encoder-decoder seq2seq and MLM pretraining are planned.

Contributing

Pull requests are welcome. For non-trivial changes, please open an issue first to discuss the proposed change. A CONTRIBUTORS.md will be added with the first external contribution.

git clone https://github.com/bmikaberidze/micm-nlp.git
cd micm-nlp
pip install -e ".[dev]"   # the dev extra adds ruff and pytest

ruff check src/
ruff format src/
pytest

Where things live:

micm_nlp/
├── cli.py          # micm-nlp / python -m micm_nlp: run, run-group, init-examples
├── pipeline.py     # Top-level wiring: load_dataset, preprocess_dataset, load_model, run
├── group.py        # Group config → runs: entry selection, overrides, RunContext
├── config.py       # CONFIG.from_yaml; resolves nested namespaces
├── path.py         # The artefact tree: models, datasets, tokenizers, runs
├── tokenizers/     # Tokenizer factory, custom tokenizer classes, Georgian sentence splitter
├── datasets/       # DATASET class — local + HF Hub + HF saved + CSV/TXT/JSON
├── models/         # MODEL wrapper, PEFT dispatch, Cross-Prompt Encoder
├── training/       # TRAINER — wraps HF Trainer with custom callbacks + WandB;
│                   #   RunOutput — the run's output directory and info.json
└── evals/          # Metrics, confusion matrices, plotting; one result file per event

Acknowledgements

micm-nlp was developed at the Muskhelishvili Institute of Computational Mathematics (MICM, Georgian Technical University), in close research collaboration with Teimuraz Saghinadze (MICM), Simon Ostermann (DFKI / CERTAIN), and Philipp Müller (Max Planck Institute for Intelligent Systems), whose joint work on the Cross-Prompt Encoder (XPE) drove much of the framework's design and validation.

This work was partially supported by the European Union under Horizon Europe project "GAIN" (GA #101078950) and by the German Federal Ministry of Research, Technology and Space (BMFTR) as part of the project TRAILS (01IW24005).

Citation

If you use micm-nlp in your research, please cite the package and (if relevant to your work) the XPE paper that drove its design:

@software{micm_nlp,
  author        = {Mikaberidze, Beso},
  title         = {micm-nlp: a research framework for {NLP} built on {HuggingFace}},
  organization  = {Muskhelishvili Institute of Computational Mathematics, Georgian Technical University},
  url           = {https://github.com/bmikaberidze/micm-nlp},
  version       = {0.4.0},
  year          = {2026},
}

@inproceedings{mikaberidze-etal-2025-cross,
  title        = {Cross-Prompt Encoder for Low-Performing Languages},
  author       = {Mikaberidze, Beso and Saghinadze, Temo and Ostermann, Simon and M{\"u}ller, Philipp},
  booktitle    = {Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics},
  month        = dec,
  year         = {2025},
  address      = {Mumbai, India},
  publisher    = {The Asian Federation of Natural Language Processing and The Association for Computational Linguistics},
  url          = {https://aclanthology.org/2025.findings-ijcnlp.144/},
  doi          = {10.18653/v1/2025.findings-ijcnlp.144},
  pages        = {2380--2393},
}

Contact

Beso Mikaberidze · beso.mikaberidze@gmail.com

Metadata

Release files for micm-nlp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for micm-nlp 0.4.0
File Size Uploaded Provenance Actions
micm_nlp-0.4.0.tar.gz 246.8 kB Without provenance Details for micm_nlp-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for micm-nlp 0.4.0
File Interpreter ABI Platform Actions
micm_nlp-0.4.0-py3-none-any.whl Python 3 none any Details for micm_nlp-0.4.0-py3-none-any.whl

Total release size: 406.1 kB

Release files / micm_nlp-0.4.0.tar.gz

Download URL micm_nlp-0.4.0.tar.gz
Size 246.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b39f0baf3bb5313c3eb211afa14c8b355a288d17ce450cc5ca2d61f8e29a1657
BLAKE2b-256 checksum
How to use checksums
e52dbe36281a09bc5fb6386df42b89be7cdc396eec8a1304ca5e101d52e626ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / micm_nlp-0.4.0-py3-none-any.whl

Download URL micm_nlp-0.4.0-py3-none-any.whl
Size 159.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6d1d481ab3dc9b90f0ffe4e8eeda343a1015ed50367fa89eb1928af5052c2e4
BLAKE2b-256 checksum
How to use checksums
66b82951a4f84bedafbc8515b5373b9017e44bdf15d3d1f9db557ce6a85bd0df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for micm-nlp 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page