{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/kinyabert-a-morphology-aware-kinyarwanda-1","title":"KinyaBERT: a Morphology-aware Kinyarwanda Language Model","arxiv_id":"2203.08459","date":"2022-03-16","proceeding":"ACL 2022 5","authors":["Antoine Nzeyimana","Andre Niyongabo Rubungo"],"abstract":"Pre-trained language models such as BERT have been successful at tackling many natural language processing tasks. However, the unsupervised sub-word tokenization methods commonly used in these models (e.g., byte-pair encoding - BPE) are sub-optimal at handling morphologically rich languages. Even given a morphological analyzer, naive sequencing of morphemes into a standard BERT architecture is inefficient at capturing morphological compositionality and expressing word-relative syntactic regularities. We address these challenges by proposing a simple yet effective two-tier BERT architecture that leverages a morphological analyzer and explicitly represents morphological compositionality. Despite the success of BERT, most of its evaluations have been conducted on high-resource languages, obscuring its applicability on low-resource languages. We evaluate our proposed method on the low-resource morphologically rich Kinyarwanda language, naming the proposed model architecture KinyaBERT. A robust set of experimental results reveal that KinyaBERT outperforms solid baselines by 2% in F1 score on a named entity recognition task and by 4.3% in average score of a machine-translated GLUE benchmark. KinyaBERT fine-tuning has better convergence and achieves more robust results on multiple tasks even in the presence of translation noise.","url_abs":"https://arxiv.org/abs/2203.08459v2","url_pdf":"https://arxiv.org/pdf/2203.08459v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"kinyabert-a-morphology-aware-kinyarwanda-1","repo_url":"https://github.com/anzeyimana/kinyabert-acl2022","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"named-entity-recognition-1","task_name":"Named Entity Recognition"},{"task_slug":"named-entity-recognition-ner","task_name":"Named Entity Recognition (NER)"},{"task_slug":"model","task_name":"model"},{"task_slug":"named-entity-recognition","task_name":"named-entity-recognition"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2203.08459","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.08459"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/anzeyimana/kinyabert-acl2022","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/pytorch/xla","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran":2,"ran_draft_wrong":3,"ran_fixture":1,"unverified":6},"by_repo_kind":{"official":{"samples":12,"ran":6,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"569684d0b33a366a","entry":"BertHeadTransform","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"569684d0b33a366a"}},{"code_sha256_prefix":"2a17165c2e7e0311","entry":"TransformerEncoder","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2a17165c2e7e0311"}},{"code_sha256_prefix":"b97233bc0d62d1ca","entry":"_get_activation_fn","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b97233bc0d62d1ca"}},{"code_sha256_prefix":"6f8db6b6c8658306","entry":"_get_clones","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6f8db6b6c8658306"}},{"code_sha256_prefix":"6b3df8438d1f1eb3","entry":"multi_head_attention_forward","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6b3df8438d1f1eb3"}},{"code_sha256_prefix":"514537bcd2ff58d8","entry":"tupe_relative_position_bucket","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"514537bcd2ff58d8"}},{"code_sha256_prefix":"f5ddc36bd8862619","entry":"KinyaBERT","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f5ddc36bd8862619"}},{"code_sha256_prefix":"e68dff82485137db","entry":"KinyaBERT_MorphoEncoder","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e68dff82485137db"}},{"code_sha256_prefix":"5f012bd177034410","entry":"MorphoHeadPredictor","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5f012bd177034410"}},{"code_sha256_prefix":"4639b692ef625093","entry":"MultiheadAttention","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4639b692ef625093"}},{"code_sha256_prefix":"820fca5082f9435e","entry":"TransformerEncoderLayer","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"820fca5082f9435e"}},{"code_sha256_prefix":"3d27c291c5dad777","entry":"init_bert_params","repo":"anzeyimana/kinyabert-acl2022","repo_kind":"official","path":"code/morpho_model.py","file_url":"https://github.com/anzeyimana/kinyabert-acl2022/blob/HEAD/code/morpho_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3d27c291c5dad777"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}