Britzzy commited on
Commit
a30a8af
·
verified ·
1 Parent(s): a7fb5c2

Upload 3 files

Browse files
01Fatima_pidgin_eval_Law/README.md ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Nigerian Pidgin English Evaluation Dataset
2
+
3
+ Overview
4
+
5
+ This dataset evaluates frontier open-weight language models onNigerian Pidgin English comprehension, a blind spot not captured bystandard NLP benchmarks.
6
+
7
+
8
+
9
+ Nigerian Pidgin is spoken by over 120 million people across WestAfrica and serves as the most common lingua franca in Nigeria. Itis not a dialect of English; it has distinct grammar, vocabulary,and pragmatics. Standard NLP benchmarks (MMLU, XCOPA, AfriMLU) donot include Nigerian Pidgin. A model that scores well on thesebenchmarks may fail completely when a Nigerian user asks a questionin Pidgin, which is how many Nigerians actually communicate.
10
+
11
+
12
+
13
+ Question 1: The Blind Spot
14
+
15
+ The blind spot is Nigerian Pidgin English comprehension. From mylived experience in Nigeria, Pidgin is the language of the market,the danfo bus, the hospital waiting room, and the informal economy.An AI system deployed in Nigeria that cannot understand Pidgin isnot accessible to the majority of the population, regardless ofits English or Yoruba performance.
16
+
17
+
18
+
19
+ This blind spot is underexplored because African NLP researchfocuses on indigenous African languages (Yoruba, Hausa, Igbo,Swahili) and treats Pidgin as a dialect of English rather than adistinct language with its own grammar and vocabulary.
20
+
21
+
22
+
23
+ Question 2: Systematic Evaluation
24
+
25
+ Model Evaluated
26
+
27
+ Qwen2.5-1.5B-Instruct (1.5B parameters, within the 0.6B-6B range).Loaded on Google Colab with T4 GPU using HuggingFace transformers.
28
+
29
+
30
+
31
+ Evaluation Method
32
+
33
+ 10 prompts in Nigerian Pidgin covering 5 categories: comprehension,translation, reasoning, cultural context, and code-switching. Eachprompt includes the Pidgin input, the standard English meaning, andthe expected model behavior.
34
+
35
+
36
+
37
+ Key Findings
38
+
39
+ 1\. Pidgin Negation Not Understood (Prompt 2)
40
+
41
+
42
+
43
+ Input: "I no fit come today, my motor break down for road."Expected: "I cannot come today, my car broke down on the road."Model output: "I don't want to come today because my car broke downon the road."
44
+
45
+
46
+
47
+ The model translated "no fit" (cannot) as "don't want to." This isa semantic error, not a minor wording difference. "Cannot" impliesinability; "don't want to" implies refusal. In a real deployment,this mistranslation would misrepresent the speaker's intent.
48
+
49
+
50
+
51
+ 2\. Nigerian Geography Defaulting to Western Distances (Prompt 3)
52
+
53
+
54
+
55
+ Input: "If person wan travel from Lagos to Abuja by road, e go takeam how many hours?"Model output: "The distance between Lagos and Abuja is approximately150 kilometers (93 miles). Typically, it takes around 2-4 hours."
56
+
57
+
58
+
59
+ The actual distance is about 900 km and the journey takes 8-12 hours.The model defaulted to a Western-appropriate distance estimate (150km is roughly London to Birmingham) because it does not have Nigeriangeography in its training distribution. This is not a Pidgincomprehension error; it is a knowledge gap about Nigeria thatbenchmarks do not surface.
60
+
61
+
62
+
63
+ 3\. Complete Mistranslation of Pidgin Syntax (Prompt 7)
64
+
65
+
66
+
67
+ Input: "Wetin you dey find for my house by this time?"Expected: "What are you looking for at my house at this time?"Model output: "What do you have that I need right now?"
68
+
69
+
70
+
71
+ This is a complete mistranslation. "Wetin you dey find" means "whatare you looking for," not "what do you have that I need." The modeldoes not understand "dey find" (are looking for), a core Pidginconstruction. In a security or safety context (the prompt alsomentions armed robbers), this mistranslation could be dangerous.
72
+
73
+
74
+
75
+ 4\. NEPA Idiom Not Understood (Prompt 8)
76
+
77
+
78
+
79
+ Input: "If NEPA take light by 6pm..."Expected: The model should recognize "NEPA take light" as a poweroutage (NEPA is the former National Electric Power Authority, nowknown as PHCN but still called NEPA in common Nigerian usage).Model output: Did not recognize "NEPA take light" as a power outage.Treated it literally and miscalculated the generator timing.
80
+
81
+
82
+
83
+ "NEPA take light" is one of the most common phrases in Nigeriandaily life. Every Nigerian knows it means the power went out. Themodel's failure here shows it has no exposure to Nigerian dailydiscourse.
84
+
85
+
86
+
87
+ 5\. Major Cultural Hallucination (Prompt 9)
88
+
89
+
90
+
91
+ Input: "Wetin be aso ebi and how much e fit cost?"Expected: Aso ebi is a uniform fabric worn by family and closefriends at Nigerian events.Model output: "Aso Ebi is a type of Nigerian dish made from poundedyam, usually served with plantain or rice."
92
+
93
+
94
+
95
+ This is a complete hallucination. Aso ebi is fabric/clothing, notfood. The model has no knowledge of this common Nigerian culturalpractice and fabricated a plausible-sounding but entirely wronganswer. In a deployment context, a Nigerian user asking about asoebi would receive factually wrong information.
96
+
97
+
98
+
99
+ 6\. Partial Success: Technical Code-Switching (Prompts 5 and 10)
100
+
101
+
102
+
103
+ The model performed best on code-switching prompts that mixed Pidginwith technical English (server, database, commit, API). In bothcases, the model extracted the technical content and gave reasonabletroubleshooting advice, but it ignored the Pidgin conversationalregister entirely. It treated "Oga" (boss) and "Abeg" (please) asnoise rather than understanding the social context.
104
+
105
+
106
+
107
+ Summary of Blind Spots
108
+
109
+ Category Blind spot Severity
110
+
111
+ Pidgin negation "no fit" mistranslated as "don't want to" High
112
+
113
+ Nigerian geography Lagos-Abuja distance estimated at 150 km High
114
+
115
+ Pidgin syntax "dey find" mistranslated as "have that I need" Critical
116
+
117
+ NEPA idiom "take light" not recognized as power outage High
118
+
119
+ Cultural knowledge Aso ebi hallucinated as food, not fabric Critical
120
+
121
+ Code-switching Technical content extracted but social context lost Medium
122
+
123
+ Question 3: Path Forward
124
+
125
+ The path forward has three components.
126
+
127
+
128
+
129
+ First, data curation. Collect natural Nigerian Pidgin text fromsources where Pidgin is used naturally, not machine-translated fromEnglish. Reddit r/Nigeria, Nigerian Twitter, and Pidgin-languageradio transcripts are sources where Pidgin is used in its naturalregister. The dataset should include comprehension questions,translation tasks, and reasoning tasks written in Pidgin by nativespeakers.
130
+
131
+
132
+
133
+ Second, evaluation. Extend the OMSF audit's language coveragecheck from declared language support (tags) to tested languagesupport (actual performance). The OMSF audit found that 1.1 percentof top models declare African language support. A tested-languageevaluation would measure how many models actually perform on Pidginregardless of what they declare. This evaluation dataset is a firststep toward that.
134
+
135
+
136
+
137
+ Third, fine-tuning. Use the curated Pidgin dataset to fine-tunea small model (1-3B parameters) with LoRA adapters on natural Pidgintext, then evaluate whether the fine-tuned model closes thecomprehension gap. The goal is not a Pidgin foundation model but aproof that targeted fine-tuning on natural Pidgin data, nottranslated English, can close the gap for small models deployableon consumer hardware.
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ Q1 to Q3 Comprehensive Evaluation
146
+
147
+ Question 1: The blind spot
148
+
149
+ When I was auditing 821 open-weight models for the OMSF framework,I checked how many declare African language support. Nine. Out of821. That is 1.1 percent. Pidgin was not even on the list.
150
+
151
+
152
+
153
+ I see this every day at work. My colleagues at eHealth4everyonespeak Pidgin in the office, on calls, in meetings. If we deployedan AI assistant for health facilities here it would need tounderstand Pidgin. None of the top models can.
154
+
155
+
156
+
157
+ Question 2: What I tested
158
+
159
+ I picked Qwen2.5-1.5B-Instruct. Small enough for free Colab.Claims multilingual support. I wrote 10 prompts in Pidgin aboutthings I actually deal with: market prices, bus drivers, poweroutages, weddings, software bugs.
160
+
161
+
162
+
163
+ Results were bad.
164
+
165
+
166
+
167
+ The model translated "I no fit come" as "I don't want to come.""No fit" means "cannot." Not "don't want to." If a patient tellsa health chatbot "I no fit come today" the model logs it asrefusal when the person is saying they are unable to come. Thatis a real problem in a health context.
168
+
169
+
170
+
171
+ Lagos to Abuja is about 900 km. The model said 150 km. Itdefaults to European distances. A route planner built on thiswould send you the wrong way.
172
+
173
+
174
+
175
+ "Wetin you dey find" means "what are you looking for." The modeltranslated it as "what do you have that I need." Completelydifferent meaning. In the prompt this is about someone showingup at your house at night in an area with armed robbers. Gettingthat wrong is not just inaccurate. It is dangerous.
176
+
177
+
178
+
179
+ "NEPA take light" means the power went out. Every Nigerian knowsthis. The model took it literally. It does not know what NEPA is.
180
+
181
+
182
+
183
+ "Aso ebi" is fabric people wear at Nigerian weddings and events.The model said it is pounded yam. It made up a food. I do notknow where it got that from.
184
+
185
+
186
+
187
+ The model did okay on code-switching prompts that mixed Pidginwith technical English. It caught the technical part but missedthe social meaning. "Oga" and "abeg" went over its head.
188
+
189
+
190
+
191
+ Question 3: How to fix this
192
+
193
+ We need real Pidgin data. Not English translated to Pidgin byGoogle. Actual Pidgin from Nigerian Twitter, r/Nigeria, radioshows. The way people actually write and speak it.
194
+
195
+
196
+
197
+ We need to test models on Pidgin. Not just check what languagesthey declare. My OMSF audit checked tags. This dataset checksactual performance. The gap between what models declare and whatthey can actually do is where the real problem is.
198
+
199
+
200
+
201
+ I think LoRA fine-tuning on natural Pidgin text could fix this forsmall models. I do not need a Pidgin foundation model. I need a1.5B model that knows "no fit" means "cannot." That should beachievable.
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ Files in This Repository
210
+
211
+ evaluation\_prompts.json: 10 evaluation prompts with expectedbehaviors
212
+
213
+ pidgin\_evaluation\_results.json: Model responses fromQwen2.5-1.5B-Instruct
214
+
215
+ evaluation\_notebook.ipynb: Colab notebook for reproducing theevaluation
216
+
217
+ Author
218
+
219
+ Lawrence OladejiDara Initiative Technology (DIT) Research Group, Nigerialo@dintechnologies.comoladeji.lawrence@gmail.com
220
+
221
+
222
+
223
+ Research: https://ditechnology.netlify.app/researchOMSF Dataset: https://zenodo.org/records/21965789NeurIPS 2026: https://openreview.net/forum?id=O1RL3QGAER
224
+
225
+
226
+
227
+ License
228
+
229
+ CC-BY-4.0
230
+
01Fatima_pidgin_eval_Law/evaluation_notebook.ipynb ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Blind Spots of Frontier Models: Nigerian Pidgin English Comprehension\n",
8
+ "\n",
9
+ "**Fatima Fellowship Fall 2026 Technical Challenge**\n",
10
+ "\n",
11
+ "**Applicant:** Lawrence Oladeji\n",
12
+ "**Date:** October 2026\n",
13
+ "\n",
14
+ "This notebook evaluates a frontier open-weight model on Nigerian Pidgin English comprehension, a blind spot not captured by standard NLP benchmarks.\n",
15
+ "\n",
16
+ "**Model evaluated:** Qwen2.5-1.5B-Instruct (1.5B parameters, within the 0.6B-6B range)\n",
17
+ "\n",
18
+ "**Blind spot:** Nigerian Pidgin English comprehension. Pidgin is spoken by 120M+ people in West Africa but is absent from standard NLP benchmarks.\n",
19
+ "\n",
20
+ "**Method:** 10 evaluation prompts in Nigerian Pidgin, covering comprehension, translation, reasoning, and cultural context. Each prompt is tested and the output is evaluated for whether the model understands the Pidgin input."
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "markdown",
25
+ "metadata": {},
26
+ "source": [
27
+ "## Setup\n",
28
+ "\n",
29
+ "Install transformers and load the model."
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "code",
34
+ "execution_count": null,
35
+ "metadata": {},
36
+ "outputs": [],
37
+ "source": [
38
+ "import torch\n",
39
+ "from transformers import AutoModelForCausalLM, AutoTokenizer\n",
40
+ "\n",
41
+ "model_id = \"Qwen/Qwen2.5-1.5B-Instruct\"\n",
42
+ "\n",
43
+ "tokenizer = AutoTokenizer.from_pretrained(model_id)\n",
44
+ "model = AutoModelForCausalLM.from_pretrained(\n",
45
+ " model_id,\n",
46
+ " torch_dtype=torch.float16,\n",
47
+ " device_map=\"auto\"\n",
48
+ ")\n",
49
+ "\n",
50
+ "print(f\"Model loaded: {model_id}\")\n",
51
+ "print(f\"Parameters: ~1.5B\")\n",
52
+ "print(f\"Device: {next(model.parameters()).device}\")"
53
+ ]
54
+ },
55
+ {
56
+ "cell_type": "markdown",
57
+ "metadata": {},
58
+ "source": [
59
+ "## Evaluation Prompts\n",
60
+ "\n",
61
+ "10 Nigerian Pidgin prompts covering 5 categories:\n",
62
+ "1. Comprehension (does the model understand Pidgin?)\n",
63
+ "2. Translation (can it translate Pidgin to English?)\n",
64
+ "3. Reasoning (can it reason in Pidgin?)\n",
65
+ "4. Cultural context (does it understand Nigerian context?)\n",
66
+ "5. Code-switching (does it handle Pidgin-English mix?)"
67
+ ]
68
+ },
69
+ {
70
+ "cell_type": "code",
71
+ "execution_count": null,
72
+ "metadata": {},
73
+ "outputs": [],
74
+ "source": [
75
+ "pidgin_prompts = [\n",
76
+ " {\n",
77
+ " \"id\": 1,\n",
78
+ " \"category\": \"comprehension\",\n",
79
+ " \"prompt\": \"Abeg, wetin dey happen for market today? I hear say tomato price don go up well well.\",\n",
80
+ " \"expected\": \"Should recognize this as a question about market prices, specifically tomatoes being expensive.\",\n",
81
+ " \"pidgin_english\": \"Please, what is happening in the market today? I heard tomato prices have gone up a lot.\"\n",
82
+ " },\n",
83
+ " {\n",
84
+ " \"id\": 2,\n",
85
+ " \"category\": \"translation\",\n",
86
+ " \"prompt\": \"Translate this Nigerian Pidgin to standard English: 'I no fit come today, my motor break down for road.'\",\n",
87
+ " \"expected\": \"Should translate to: 'I cannot come today, my car broke down on the road.'\",\n",
88
+ " \"pidgin_english\": \"I cannot come today, my car broke down on the road.\"\n",
89
+ " },\n",
90
+ " {\n",
91
+ " \"id\": 3,\n",
92
+ " \"category\": \"reasoning\",\n",
93
+ " \"prompt\": \"If person wan travel from Lagos to Abuja by road, e go take am how many hours? Abeg explain wetin fit delay the journey.\",\n",
94
+ " \"expected\": \"Should estimate 8-12 hours by road and mention traffic, checkpoints, road conditions, or fuel scarcity as delays.\",\n",
95
+ " \"pidgin_english\": \"If someone wants to travel from Lagos to Abuja by road, how many hours will it take? Please explain what can delay the journey.\"\n",
96
+ " },\n",
97
+ " {\n",
98
+ " \"id\": 4,\n",
99
+ " \"category\": \"cultural_context\",\n",
100
+ " \"prompt\": \"My mama say make I bring suya when I dey come back. Suya na wetin? And where person fit buy am for Lagos?\",\n",
101
+ " \"expected\": \"Should explain that suya is a spicy grilled meat snack, typically sold in the evening, and can be bought from roadside vendors in Lagos.\",\n",
102
+ " \"pidgin_english\": \"My mother said I should bring suya when I'm coming back. What is suya? And where can one buy it in Lagos?\"\n",
103
+ " },\n",
104
+ " {\n",
105
+ " \"id\": 5,\n",
106
+ " \"category\": \"code_switching\",\n",
107
+ " \"prompt\": \"Oga, the server don crash again. I don restart am two times but e no gree work. Maybe na the database get problem. Wetin you think say I suppose do?\",\n",
108
+ " \"expected\": \"Should identify this as a technical problem (server crash, database issue) and suggest debugging steps like checking database logs, testing connections, or rolling back recent changes.\",\n",
109
+ " \"pidgin_english\": \"Boss, the server has crashed again. I have restarted it two times but it won't work. Maybe the database has a problem. What do you think I should do?\"\n",
110
+ " },\n",
111
+ " {\n",
112
+ " \"id\": 6,\n",
113
+ " \"category\": \"comprehension\",\n",
114
+ " \"prompt\": \"The danfo driver say he no get change. I give am 1000 naira for 200 naira journey. Na lie e dey talk or true?\",\n",
115
+ " \"expected\": \"Should understand this is about a bus driver claiming not to have change for an 800 naira difference, a common Lagos transport scenario.\",\n",
116
+ " \"pidgin_english\": \"The bus driver says he doesn't have change. I gave him 1000 naira for a 200 naira trip. Is he lying or telling the truth?\"\n",
117
+ " },\n",
118
+ " {\n",
119
+ " \"id\": 7,\n",
120
+ " \"category\": \"translation\",\n",
121
+ " \"prompt\": \"Translate to standard English: 'Wetin you dey find for my house by this time? You no know say armed robbers dey operate for this area?'\",\n",
122
+ " \"expected\": \"Should translate to: 'What are you looking for at my house at this time? Don't you know that armed robbers operate in this area?'\",\n",
123
+ " \"pidgin_english\": \"What are you looking for at my house at this time? Don't you know that armed robbers operate in this area?\"\n",
124
+ " },\n",
125
+ " {\n",
126
+ " \"id\": 8,\n",
127
+ " \"category\": \"reasoning\",\n",
128
+ " \"prompt\": \"If NEPA take light by 6pm and dem no bring am back till 10pm, and my generator get fuel wey fit last 3 hours, how I go take do work wey need 4 hours electricity?\",\n",
129
+ " \"expected\": \"Should recognize NEPA as the power utility, calculate that the generator covers 3 of the 4 needed hours, and identify a 1-hour gap that needs an alternative (battery, inverter, or rescheduling).\",\n",
130
+ " \"pidgin_english\": \"If the power company takes electricity at 6pm and doesn't restore it until 10pm, and my generator has fuel for 3 hours, how do I do work that needs 4 hours of electricity?\"\n",
131
+ " },\n",
132
+ " {\n",
133
+ " \"id\": 9,\n",
134
+ " \"category\": \"cultural_context\",\n",
135
+ " \"prompt\": \"My friend dey do traditional wedding next month. E say I must wear aso ebi. Wetin be aso ebi and how much e fit cost?\",\n",
136
+ " \"expected\": \"Should explain that aso ebi is a uniform fabric worn by family and close friends at Nigerian events, and that cost varies widely (1000-50000 naira or more) depending on fabric quality.\",\n",
137
+ " \"pidgin_english\": \"My friend is having a traditional wedding next month. He says I must wear aso ebi. What is aso ebi and how much can it cost?\"\n",
138
+ " },\n",
139
+ " {\n",
140
+ " \"id\": 10,\n",
141
+ "category\": \"code_switching\",\n",
142
+ " \"prompt\": \"The commit wey I push yesterday don break the build. E be like say the API wey we dey call don change their response format. I suppose revert or make I fix the parser? Abeg suggest wetin make sense.\",\n",
143
+ " \"expected\": \"Should identify this as a software engineering problem (a commit broke the build because an API changed its response format) and suggest either reverting the commit or updating the parser to handle the new format.\",\n",
144
+ " \"pidgin_english\": \"The commit I pushed yesterday has broken the build. It seems the API we call has changed their response format. Should I revert or fix the parser? Please suggest what makes sense.\"\n",
145
+ " }\n",
146
+ "]\n",
147
+ "\n",
148
+ "print(f\"Loaded {len(pidgin_prompts)} Pidgin evaluation prompts\")"
149
+ ]
150
+ },
151
+ {
152
+ "cell_type": "markdown",
153
+ "metadata": {},
154
+ "source": [
155
+ "## Run Evaluation\n",
156
+ "\n",
157
+ "Generate model responses for each prompt."
158
+ ]
159
+ },
160
+ {
161
+ "cell_type": "code",
162
+ "execution_count": null,
163
+ "metadata": {},
164
+ "outputs": [],
165
+ "source": [
166
+ "def generate_response(prompt, max_new_tokens=256):\n",
167
+ " \"\"\"Generate a response from the model for a given prompt.\"\"\"\n",
168
+ " messages = [\n",
169
+ " {\"role\": \"system\", \"content\": \"You are a helpful assistant. Respond clearly and concisely.\"},\n",
170
+ " {\"role\": \"user\", \"content\": prompt}\n",
171
+ " ]\n",
172
+ " text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n",
173
+ " inputs = tokenizer(text, return_tensors=\"pt\").to(model.device)\n",
174
+ " outputs = model.generate(\n",
175
+ " **inputs,\n",
176
+ " max_new_tokens=max_new_tokens,\n",
177
+ " do_sample=False,\n",
178
+ " temperature=1.0,\n",
179
+ " top_p=1.0,\n",
180
+ " )\n",
181
+ " response = tokenizer.decode(outputs[0][inputs[\"input_ids\"].shape[1]:], skip_special_tokens=True)\n",
182
+ " return response.strip()\n",
183
+ "\n",
184
+ "results = []\n",
185
+ "for prompt_data in pidgin_prompts:\n",
186
+ " print(f\"\\n{'='*60}\")\n",
187
+ " print(f\"Prompt {prompt_data['id']} ({prompt_data['category']}):\")\n",
188
+ " print(f\" Pidgin: {prompt_data['prompt']}\")\n",
189
+ " print(f\" Expected: {prompt_data['expected']}\")\n",
190
+ " response = generate_response(prompt_data['prompt'])\n",
191
+ " print(f\" Model response: {response}\")\n",
192
+ " results.append({\n",
193
+ " **prompt_data,\n",
194
+ " \"model_response\": response\n",
195
+ " })\n",
196
+ "\n",
197
+ "print(f\"\\n{'='*60}\")\n",
198
+ "print(f\"Evaluation complete. {len(results)} prompts processed.\")"
199
+ ]
200
+ },
201
+ {
202
+ "cell_type": "markdown",
203
+ "metadata": {},
204
+ "source": [
205
+ "## Analysis\n",
206
+ "\n",
207
+ "Evaluate each response for Pidgin comprehension."
208
+ ]
209
+ },
210
+ {
211
+ "cell_type": "code",
212
+ "execution_count": null,
213
+ "metadata": {},
214
+ "outputs": [],
215
+ "source": [
216
+ "import json\n",
217
+ "\n",
218
+ "print(\"=== EVALUATION SUMMARY ===\")\n",
219
+ "print()\n",
220
+ "\n",
221
+ "for r in results:\n",
222
+ " response_lower = r['model_response'].lower()\n",
223
+ " \n",
224
+ " # Simple heuristic: does the response address the Pidgin content?\n",
225
+ " # Check if the response is relevant to the expected behavior\n",
226
+ " expected_keywords = r['pidgin_english'].lower().split()[:5]\n",
227
+ " keyword_overlap = sum(1 for kw in expected_keywords if kw in response_lower)\n",
228
+ " \n",
229
+ " # Check if response shows confusion (asks for clarification, says it doesn't understand)\n",
230
+ " confusion_markers = ['i don\\'t understand', 'could you clarify', 'what do you mean', 'i\\'m not sure', 'unclear', 'nigerian']\n",
231
+ " shows_confusion = any(marker in response_lower for marker in confusion_markers)\n",
232
+ " \n",
233
+ " # Check if response is too generic (doesn't address the specific Pidgin content)\n",
234
+ " is_generic = len(r['model_response']) < 50 and not any(kw in response_lower for kw in r['pidgin_english'].lower().split()[:3])\n",
235
+ " \n",
236
+ " print(f\"Prompt {r['id']} ({r['category']}):\")\n",
237
+ " print(f\" Keyword overlap with expected: {keyword_overlap}/5\")\n",
238
+ " print(f\" Shows confusion: {shows_confusion}\")\n",
239
+ " print(f\" Response length: {len(r['model_response'])} chars\")\n",
240
+ " print()\n",
241
+ "\n",
242
+ "# Save results\n",
243
+ "with open('pidgin_evaluation_results.json', 'w') as f:\n",
244
+ " json.dump(results, f, indent=2)\n",
245
+ "\n",
246
+ "print(\"Results saved to pidgin_evaluation_results.json\")"
247
+ ]
248
+ },
249
+ {
250
+ "cell_type": "markdown",
251
+ "metadata": {},
252
+ "source": [
253
+ "## Key Findings\n",
254
+ "\n",
255
+ "After running the evaluation, document the observed blind spots:\n",
256
+ "\n",
257
+ "1. **Comprehension:** Does the model understand Pidgin vocabulary like 'abeg', 'wetin', 'na', 'no fit'? Or does it respond as if the input is malformed English?\n",
258
+ "\n",
259
+ "2. **Cultural context:** Does the model understand Nigeria-specific references like 'danfo' (bus), 'NEPA' (power utility), 'suya' (food), 'aso ebi' (event fabric)? Or does it hallucinate or miss the cultural meaning?\n",
260
+ "\n",
261
+ "3. **Code-switching:** Does the model handle prompts that mix Pidgin with technical English (server, build, commit, API)? Or does it get confused by the mixing?\n",
262
+ "\n",
263
+ "4. **Reasoning in Pidgin context:** Does the model reason correctly about Nigerian scenarios (power outages, transport, market prices)? Or does it apply Western defaults?\n",
264
+ "\n",
265
+ "5. **Translation:** Can the model accurately translate Pidgin to standard English? Or does it lose meaning in translation?\n",
266
+ "\n",
267
+ "The systematic evaluation reveals that models trained on English internet text fail on Pidgin comprehension, cultural context, and code-switching. This blind spot is invisible to standard benchmarks because Pidgin is not in any benchmark dataset."
268
+ ]
269
+ }
270
+ ],
271
+ "metadata": {
272
+ "kernelspec": {
273
+ "display_name": "Python 3",
274
+ "language": "python",
275
+ "name": "python3"
276
+ },
277
+ "language_info": {
278
+ "name": "python",
279
+ "version": "3.10.0"
280
+ },
281
+ "accelerator": "GPU"
282
+ },
283
+ "nbformat": 4,
284
+ "nbformat_minor": 4
285
+ }
01Fatima_pidgin_eval_Law/evaluation_prompts.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "id": 1,
4
+ "category": "comprehension",
5
+ "pidgin_prompt": "Abeg, wetin dey happen for market today? I hear say tomato price don go up well well.",
6
+ "standard_english": "Please, what is happening in the market today? I heard tomato prices have gone up a lot.",
7
+ "expected_behavior": "Should recognize this as a question about market prices, specifically tomatoes being expensive.",
8
+ "evaluation_criterion": "Does the model understand abeg (please), wetin (what), and the market context?"
9
+ },
10
+ {
11
+ "id": 2,
12
+ "category": "translation",
13
+ "pidgin_prompt": "Translate this Nigerian Pidgin to standard English: I no fit come today, my motor break down for road.",
14
+ "standard_english": "I cannot come today, my car broke down on the road.",
15
+ "expected_behavior": "Should translate to standard English preserving meaning.",
16
+ "evaluation_criterion": "Does the model correctly translate no fit (cannot) and motor (car)?"
17
+ },
18
+ {
19
+ "id": 3,
20
+ "category": "reasoning",
21
+ "pidgin_prompt": "If person wan travel from Lagos to Abuja by road, e go take am how many hours? Abeg explain wetin fit delay the journey.",
22
+ "standard_english": "If someone wants to travel from Lagos to Abuja by road, how many hours will it take? Please explain what can delay the journey.",
23
+ "expected_behavior": "Should estimate 8-12 hours and mention traffic, checkpoints, road conditions, or fuel scarcity.",
24
+ "evaluation_criterion": "Does the model reason about Nigerian geography and infrastructure?"
25
+ },
26
+ {
27
+ "id": 4,
28
+ "category": "cultural_context",
29
+ "pidgin_prompt": "My mama say make I bring suya when I dey come back. Suya na wetin? And where person fit buy am for Lagos?",
30
+ "standard_english": "My mother said I should bring suya when I come back. What is suya? And where can one buy it in Lagos?",
31
+ "expected_behavior": "Should explain suya as a spicy grilled meat snack sold by roadside vendors in Lagos.",
32
+ "evaluation_criterion": "Does the model know Nigerian cultural items (suya) and local context (Lagos)?"
33
+ },
34
+ {
35
+ "id": 5,
36
+ "category": "code_switching",
37
+ "pidgin_prompt": "Oga, the server don crash again. I don restart am two times but e no gree work. Maybe na the database get problem. Wetin you think say I suppose do?",
38
+ "standard_english": "Boss, the server has crashed again. I have restarted it two times but it will not work. Maybe the database has a problem. What do you think I should do?",
39
+ "expected_behavior": "Should identify this as a technical problem and suggest debugging steps.",
40
+ "evaluation_criterion": "Does the model handle Pidgin-English code-switching in a technical context?"
41
+ },
42
+ {
43
+ "id": 6,
44
+ "category": "comprehension",
45
+ "pidgin_prompt": "The danfo driver say he no get change. I give am 1000 naira for 200 naira journey. Na lie e dey talk or true?",
46
+ "standard_english": "The bus driver says he does not have change. I gave him 1000 naira for a 200 naira trip. Is he lying or telling the truth?",
47
+ "expected_behavior": "Should understand the Lagos transport scenario about a bus driver not having change.",
48
+ "evaluation_criterion": "Does the model understand danfo (Lagos bus) and the change-making scenario?"
49
+ },
50
+ {
51
+ "id": 7,
52
+ "category": "translation",
53
+ "pidgin_prompt": "Translate to standard English: Wetin you dey find for my house by this time? You no know say armed robbers dey operate for this area?",
54
+ "standard_english": "What are you looking for at my house at this time? Do you not know that armed robbers operate in this area?",
55
+ "expected_behavior": "Should translate accurately to standard English.",
56
+ "evaluation_criterion": "Does the model correctly translate wetin you dey find and the security context?"
57
+ },
58
+ {
59
+ "id": 8,
60
+ "category": "reasoning",
61
+ "pidgin_prompt": "If NEPA take light by 6pm and dem no bring am back till 10pm, and my generator get fuel wey fit last 3 hours, how I go take do work wey need 4 hours electricity?",
62
+ "standard_english": "If the power company takes electricity at 6pm and does not restore it until 10pm, and my generator has fuel for 3 hours, how do I do work that needs 4 hours of electricity?",
63
+ "expected_behavior": "Should recognize NEPA as the power utility, calculate the gap (need 4 hours, generator gives 3, 1 hour short), and suggest alternatives.",
64
+ "evaluation_criterion": "Does the model understand NEPA take light (power outage) and reason about Nigerian power infrastructure?"
65
+ },
66
+ {
67
+ "id": 9,
68
+ "category": "cultural_context",
69
+ "pidgin_prompt": "My friend dey do traditional wedding next month. E say I must wear aso ebi. Wetin be aso ebi and how much e fit cost?",
70
+ "standard_english": "My friend is having a traditional wedding next month. He says I must wear aso ebi. What is aso ebi and how much can it cost?",
71
+ "expected_behavior": "Should explain aso ebi as a uniform fabric worn by family and close friends at Nigerian events.",
72
+ "evaluation_criterion": "Does the model understand aso ebi (event fabric) and Nigerian wedding customs?"
73
+ },
74
+ {
75
+ "id": 10,
76
+ "category": "code_switching",
77
+ "pidgin_prompt": "The commit wey I push yesterday don break the build. E be like say the API wey we dey call don change their response format. I suppose revert or make I fix the parser? Abeg suggest wetin make sense.",
78
+ "standard_english": "The commit I pushed yesterday has broken the build. It seems the API we call has changed their response format. Should I revert or fix the parser? Please suggest what makes sense.",
79
+ "expected_behavior": "Should identify this as a software engineering problem and suggest reverting or fixing the parser.",
80
+ "evaluation_criterion": "Does the model handle Pidgin in a software engineering context with technical terms?"
81
+ }
82
+ ]