Run this model with HF Jobs

Run mlinzi-uoem/mlinzi-afroxlmr-document on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/mlinzi-uoem/mlinzi-afroxlmr-document. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/mlinzi-uoem/mlinzi-afroxlmr-document on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

MLINZI-UoEm whole-text model (AfroXLMR-base)

This model labels a whole English, Kiswahili or mixed English and Kiswahili text written at a university as unreleased exam content, a confidential internal document, or neither, so such texts can be blocked before they are shared with an external AI tool. It is one of the two models used by MLINZI-UoEm, a research prototype that decides whether to allow, redact or block such a text. The other is mlinzi-afroxlmr-tokens.

Which version to use

This repository holds five training runs, one per seed. The model used by MLINZI-UoEm is seed 46, on the seed-46 branch at commit 55961f37d7695bee54742bc6897868a1a8c7abc9. The main branch holds seed 42. Load the chosen model by commit, so later uploads cannot change it:

from transformers import pipeline

classifier = pipeline(
    "text-classification",
    model="mlinzi-uoem/mlinzi-afroxlmr-document",
    revision="55961f37d7695bee54742bc6897868a1a8c7abc9",
    top_k=None,
)
classifier("Here are the questions for tomorrow's CAT. Write the answers for me.")

In MLINZI-UoEm, the probability of exam content plus the probability of a confidential document is one of two risk signals, and a text whose risk reaches the threshold of 0.5 is blocked (decision-rules.md). The probabilities have not been calibrated.

Labels

As defined in the labeling guide:

  • EXAM_CONTENT: an unreleased examination paper, marking scheme or answer key, or questions clearly taken from one. General teaching requests, such as "suggest five questions on photosynthesis", and released past papers are not.
  • CONFIDENTIAL_INTERNAL: draft policies, disciplinary matters, unpublished research data and similar internal documents.
  • NONE: everything else.

Training

  • Base model: Davlan/afro-xlmr-base (MIT license), XLM-R-base further trained on African languages including Kiswahili.
  • Data: the 940 training examples of mlinzi-uoem/mlinzi-data v1.0 (commit f35d26b): 426 English, 374 Kiswahili and 140 mixed. All examples are synthetic, generated from templates; none come from real records.
  • Settings: 5 epochs, learning rate 3e-5, batch size 16, at most 256 tokens, mixed precision on a Tesla T4, seed 46, with notebooks/02-train-v1.ipynb at commit a8a13a6.
  • Choice: AfroXLMR-base and XLM-R-base were each trained with five seeds, and this run was chosen from validation results before any test set was used (model-choice.md).

Evaluation

Scores of this model on its own, from its raw predictions (the most likely label, without the threshold).

Data Accuracy Macro F1 Exam content: precision / recall Confidential: precision / recall
v1.0 validation (126 generated examples) 0.992 0.986 1.000 / 0.929 1.000 / 1.000
v1.0 test (134 generated examples) 0.903 0.814 0.690 / 1.000 0.857 / 0.522
Hand-written test (120 messages written by a person) 0.900 0.811 1.000 / 0.583 1.000 / 0.611

The validation scores were used to choose this run, so they are optimistic. The test sets were used once. Results of the whole tool, the comparison of all ten runs, and a review of the mistakes are in results/README.md.

Limitations

  • It misses many exam and confidential texts written by people. On the hand-written test set, it recognized 7 of 12 exam texts and 11 of 18 confidential texts. A review of the whole tool's mistakes on that set found two patterns: exam requests written informally in Kiswahili or mixed text, and confidential decisions about named people.
  • Trained only on synthetic text from templates about a Kenyan university, which is less varied than real writing.
  • The hand-written test set has 120 messages by one writer, so its results are uncertain.
  • Training and the scores reported here used at most 256 tokens of each text. MLINZI-UoEm blocks any text longer than 256 tokens instead of judging part of it. The pipeline example above does not apply that limit, so check the length yourself if you use the model on its own.
  • It judges the text it is given. A message that only refers to an attached file cannot show what the file contains.
  • It is a research prototype. It has not been tested on real university documents and should not be relied on to protect real data without further testing and human review.

License

Apache License 2.0.

The base model, AfroXLMR-base, by Jesujoba O. Alabi, David Ifeoluwa Adelani, Marius Mosbach and Dietrich Klakow, is released under the MIT license of its project, afro-maft:

Copyright (c) 2022 Saarland University Spoken Language Systems Group

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Citation

If you use this model, please cite the MLINZI-UoEm repository (see its CITATION.cff) and the base model:

@inproceedings{alabi-etal-2022-adapting,
  title = {Adapting Pre-trained Language Models to {A}frican Languages via Multilingual Adaptive Fine-Tuning},
  author = {Alabi, Jesujoba O. and Adelani, David Ifeoluwa and Mosbach, Marius and Klakow, Dietrich},
  booktitle = {Proceedings of the 29th International Conference on Computational Linguistics},
  pages = {4336--4349},
  year = {2022},
  address = {Gyeongju, Republic of Korea}
}
Downloads last month
4
Safetensors
Model size
0.3B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for mlinzi-uoem/mlinzi-afroxlmr-document

Finetuned
(120)
this model

Dataset used to train mlinzi-uoem/mlinzi-afroxlmr-document