Skip to main content

micm-nlp

PyPI Python License: MIT Docs

NLP research toolkit for tokenization, pretraining, fine-tuning, and PEFT across encoder-only, decoder-only, and encoder-decoder architectures. Built on top of HuggingFace transformers, peft, and datasets.

About

micm-nlp is a config-driven research toolkit for multilingual NLP work. It wraps the HuggingFace stack with a small set of high-level building blocks — CONFIG, TOKENIZER, DATASET, MODEL, and a unified TRAINER — that compose into reproducible training, fine-tuning, and evaluation pipelines.

It has backed two peer-reviewed publications: Cross-Prompt Encoder for Low-Performing Languages (Findings of IJCNLP–AACL 2025; ACL Anthology) and A Comparison of Different Tokenization Methods for the Georgian Language (ICNLSP 2024; ACL Anthology).

The package currently ships two examples that exercise a single use case end-to-end: preprocessing and decoder-only PEFT fine-tuning (XPE) on an FTP-reframed multilingual dataset hosted on the HuggingFace Hub. The toolkit's underlying surface is broader than these two examples demonstrate.

Additional examples covering encoder-only text classification, encoder-decoder seq2seq, and MLM pretraining will land in subsequent releases. Contributions and issue reports are welcome.

📖 Full documentation: micm-nlp.readthedocs.io

Install

Requires Python 3.10 or newer.

From PyPI:

pip install micm-nlp

From source (development):

git clone https://github.com/bmikaberidze/micm-nlp.git
cd micm-nlp
pip install -e ".[dev]"

The dev extra adds pytest and ruff.

Docker (recommended for reproducibility on GPU machines):

docker build -t micm-nlp .
docker run --gpus all -it --rm -v $(pwd):/app -w /app micm-nlp bash

Credentials and the workspace root come from a .env file:

cp .env.example .env
Variable Purpose
PROJECT_ROOT_PATH Workspace directory; artefacts/ (datasets, models, evals, wandb) is created under it. Used as the fallback when init() is called without root_path.
WANDB_API_KEY Required only if training_args.args.report_to includes wandb.
HF_TOKEN Required only for gated HuggingFace models or datasets.

Quickstart

import micm_nlp
from micm_nlp.config import CONFIG
from micm_nlp.pipeline import run

# Sets the workspace root (where artefacts/ goes) and, optionally,
# enables Rich pretty-printing and traceback formatting.
micm_nlp.init({'root_path': '/path/to/your/workspace', 'pretty_output': True})
# Or, if PROJECT_ROOT_PATH is set in .env or the environment:
# micm_nlp.init()

config = CONFIG.from_yaml('examples/configs/xsc_finetune.yml')
model, test_output = run(config)

init() resolves the workspace root from its root_path argument, falling back to PROJECT_ROOT_PATH in the environment. Call it once before any pipeline call so artefacts/ lands in the right place. It is not triggered on import.

run(config) chains: load tokenizer → load and preprocess dataset → load model (with PEFT if configured) → train → evaluate. Every stage is configured by YAML; no plumbing code required.

Package tour

micm_nlp/
├── pipeline.py     # Top-level wiring: load_dataset, preprocess_dataset, load_model, run
├── config.py       # CONFIG.from_yaml; resolves nested namespaces
├── 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
└── evals/          # Metrics, confusion matrices, plotting helpers

The same flow, unwrapped — useful when a consumer repository needs to intervene between stages (swap a dataset, concatenate languages, reuse one tokenizer):

from micm_nlp.config import CONFIG
from micm_nlp.tokenizers.tokenizer import load as load_tokenizer
from micm_nlp.datasets.dataset import DATASET
from micm_nlp.models.model import MODEL
from micm_nlp.training.runner import TRAINER

config = CONFIG.from_yaml('path/to/config.yml')
tokenizer = load_tokenizer(config)
dataset = DATASET(config)
dataset.preprocess(tokenizer)
model = MODEL(config)
trainer = TRAINER(model, dataset, tokenizer)
test_output = trainer.run()

Examples

Two runnable examples ship with the repository. Together they cover one use case end to end — preprocessing and decoder-only PEFT fine-tuning on an FTP-reframed multilingual dataset from the HuggingFace Hub.

Script Config What it does
examples/preprocess_dataset.py examples/configs/xsc_preprocess.yml Loads FTP-reframed XStoryCloze (English) from the Hub, tokenizes it for BLOOM-560M, saves the result locally.
examples/run_model.py examples/configs/xsc_finetune.yml Fine-tunes BLOOM-560M with Cross-Prompt Encoder PEFT on the Arabic split, then evaluates.

The toolkit's surface is broader than these two demonstrate. Examples for encoder-only text classification, encoder-decoder seq2seq and MLM pretraining are planned.

Supported architectures

Architecture Toolkit support Covered by a shipped example
Decoder-only (BLOOM, Aya) yes yes
Encoder-only (BERT, XLM-R, mDeBERTa) yes planned
Encoder-decoder (T5) yes planned

PEFT methods: LoRA, Prefix Tuning, P-Tuning / soft prompt tuning, and the Cross-Prompt Encoder. The shipped examples demonstrate the Cross-Prompt Encoder only.

Development

pip install -e ".[dev]"
ruff check src/
ruff format src/
pytest

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.

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 toolkit'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: NLP research toolkit for multilingual fine-tuning and PEFT},
  url = {https://github.com/bmikaberidze/micm-nlp},
  version = {0.3.0},
  year = {2026},
}

@misc{mikaberidze2025crosspromptencoderlowperforminglanguages,
  title         = {Cross-Prompt Encoder for Low-Performing Languages},
  author        = {Beso Mikaberidze and Teimuraz Saghinadze and Simon Ostermann and Philipp Muller},
  year          = {2026},
  eprint        = {2508.10352},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CL},
  url           = {https://arxiv.org/abs/2508.10352},
}

Contact

beso.mikaberidze@gmail.com

Metadata

Release files for micm-nlp 0.3.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.3.0
File Size Uploaded Provenance Actions
micm_nlp-0.3.0.tar.gz 185.2 kB Without provenance Details for micm_nlp-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 318.7 kB

Release files / micm_nlp-0.3.0.tar.gz

Download URL micm_nlp-0.3.0.tar.gz
Size 185.2 kB
Tags Source
SHA-256 checksum
How to use checksums
172b1e3043df8a378085a9c7b14554069e523fdbd6ff11e3c5c3b8b35432f1b8
BLAKE2b-256 checksum
How to use checksums
8e38cbdd3c22c941d5d66a3d8d270744eb33d50acd46022959b5f5b016bd7128
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.3.0-py3-none-any.whl

Download URL micm_nlp-0.3.0-py3-none-any.whl
Size 133.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
affaa93a5af1b3c138282e5e9e10fe9752338703e27e3ed2d38e3005731a20dc
BLAKE2b-256 checksum
How to use checksums
9e1174b34a037b96fdfb6e45e5a9b7fc20b741fa3ddfc42a073f8bd7f807433e
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.3.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