Skip to main content

JengaNLP

Config-driven multi-task NLP. Train one shared transformer encoder with many task heads — classification, sentiment, NER, regression and checklist-style QA scoring — from a single YAML file, then serve it with a load-once inference pipeline.

Status: alpha (2.0.0). The core text workflow — config → train → evaluate → predict → InferencePipeline — is tested and is the supported path. Everything else is marked experimental below.

What JengaNLP is, honestly

JengaNLP is built on PyTorch and Hugging Face Transformers. For a single classifier, the Hugging Face Trainer is a fine choice, and JengaNLP is mostly a convenience layer on top of the same ideas.

Where JengaNLP does more than a training wrapper:

  • Multi-task models are the default, not a research project. One encoder, several tasks, several heads per task, per-head loss weights, and task sampling strategies (round_robin, proportional, temperature) — all declared in YAML.
  • Checklist QA scoring (qa_scoring). Score call-centre transcripts against weighted rubric sections (opening, listening, resolution, …) as multi-head binary checklists — a task type you would otherwise hand-build.
  • Production inference included. InferencePipeline loads once, predicts single or batch, returns structured per-head results with confidences, and flags PII in inputs.
  • One artefact layout. Training, evaluation, resume, checkpoints and inference all read the same saved config and model directory.

What is not here yet: pretrained JengaNLP checkpoints, published benchmarks, and African-language base models and datasets. Those are the roadmap, not current features — see Roadmap.

Install

pip install jenga-nlp

Requires Python 3.10+. Optional extras:

Extra Installs When you need it
jenga-nlp[asr] accelerate, peft, librosa, soundfile Whisper ASR workflows (experimental)
jenga-nlp[wandb] wandb Weights & Biases experiment tracking
jenga-nlp[dev] pytest, ruff, mypy Working on JengaNLP itself

From source:

git clone https://github.com/Rogendo/JengaNLP.git
cd JengaNLP
pip install -e ".[dev]"

Quickstart (5 minutes, CPU)

1. Data — JSONL, JSON or CSV with a text column and a label column:

mkdir -p jenganlp_demo
cat > jenganlp_demo/messages.jsonl <<'JSONL'
{"text":"Urgent M-PESA reversal request. Share your PIN now.","label":1}
{"text":"Your payment has been received successfully.","label":0}
{"text":"Congratulations, send your PIN to claim the prize.","label":1}
{"text":"Please visit the nearest branch for help.","label":0}
{"text":"Account blocked. Reply with your secret code.","label":1}
{"text":"Your statement is ready for download.","label":0}
JSONL

2. Config — run every command from the folder that contains jenganlp_demo/:

cat > jenganlp_demo/config.yaml <<'YAML'
project_name: demo_mpesa_fraud
model:
  base_model: distilbert-base-uncased
tokenizer:
  max_length: 64
tasks:
  - name: mpesa_fraud_detection
    type: single_label_classification
    data_path: jenganlp_demo/messages.jsonl
    text_column: text
    label_column: label
    heads:
      - name: fraud_head
        num_labels: 2
training:
  output_dir: jenganlp_demo/model
  batch_size: 2
  num_epochs: 3
  device: cpu
  logging:
    service: none
  data:
    test_size: 0.33
YAML

3. Train, evaluate, predict:

jenga-nlp train    --config jenganlp_demo/config.yaml
jenga-nlp evaluate --config jenganlp_demo/config.yaml --model-dir jenganlp_demo/model
jenga-nlp predict  --config jenganlp_demo/config.yaml --model-dir jenganlp_demo/model \
  --task-name mpesa_fraud_detection --text "Urgent M-PESA reversal request asking for PIN"

4. Load once in Python (notebooks, batch jobs, services):

from jenga_nlp.inference.pipeline import InferencePipeline

pipeline = InferencePipeline.from_checkpoint(
    model_dir="jenganlp_demo/model",
    config_path="jenganlp_demo/config.yaml",
    device="cpu",
)
print(pipeline.predict(text="Urgent M-PESA reversal request asking for PIN",
                       task_name="mpesa_fraud_detection").to_dict())

Six examples prove the pipeline works, not that the model is good. A perfect score on a handful of eval samples is meaningless — use hundreds of labelled examples per class before trusting predictions.

Task types

type Labels look like Example use
single_label_classification 1 Fraud vs legitimate message
multi_label_classification {"risk_tags": [1, 1, 0, 1]} Several risk tags per message
sentiment 2 Negative / neutral / positive
ner entity spans Names, amounts, phone numbers
regression 0.73 Risk or quality score
qa_scoring {"opening": [1], "resolution": [1, 0, 1, 1, 0]} Call-centre QA checklists

Multi-task: list several tasks under tasks: — they share the encoder. See examples/configs/fixture_multitask_cpu.yaml.

Stable vs experimental

Area Status
YAML config, text training, evaluation, resume, checkpoints Stable — covered by tests
InferencePipeline (single + batch), CLI predict Stable — covered by tests
MLflow / TensorBoard logging Stable
Hugging Face Hub export Experimental
Whisper ASR fine-tuning and serving Experimental — not yet validated on real audio/GPU; needs ffmpeg installed to read audio files
Weights & Biases, Label Studio adapters Experimental
Explainability, human-in-the-loop routing, audit logging Experimental

Experimental features may change or move out of the core package.

Documentation

Roadmap

  1. African-language base models — adapt an African-language encoder (AfriBERTa / AfroXLMR) to Swahili, Sheng and Swahili–English code-switched text.
  2. Benchmarks — public results on African-language datasets, including multi-task vs single-task baselines.
  3. Ready-made templates with pretrained checkpoints — mobile-money fraud, call-centre QA, Swahili sentiment, on the Hugging Face Hub.

License

MIT — see LICENSE.

Metadata

Release files for jenga-nlp 2.0.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 jenga-nlp 2.0.0
File Size Uploaded Provenance Actions
jenga_nlp-2.0.0.tar.gz 134.3 kB With provenance Details for jenga_nlp-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jenga-nlp 2.0.0
File Interpreter ABI Platform Actions
jenga_nlp-2.0.0-py3-none-any.whl Python 3 none any Details for jenga_nlp-2.0.0-py3-none-any.whl

Total release size: 245.0 kB

Release files / jenga_nlp-2.0.0.tar.gz

Download URL jenga_nlp-2.0.0.tar.gz
Size 134.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f2ebb6b11077d7ccb854fe484231db3edd9093ad66131af9a17276ae4c30d2f8
BLAKE2b-256 checksum
How to use checksums
afc4978a1ba3dac3767d99641a955776bed4f82987ec0d5dc053351643059807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / jenga_nlp-2.0.0-py3-none-any.whl

Download URL jenga_nlp-2.0.0-py3-none-any.whl
Size 110.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b895c8f2ccd567b218a96025e18be8d70db1909d97019dad2df9f822f60b14d
BLAKE2b-256 checksum
How to use checksums
37036508272045caeb21df1148d5f260750755899f3ebfb5530cd2b44f12184b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for jenga-nlp 2.0.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jenga_nlp-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files Full provenance

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