Inspiration
In 2023, more than one in five Nigerian farm plots suffered partial crop losses. Two-thirds of those losses came from weather and environmental shocks. Meanwhile, Nigeria's agricultural extension system serves roughly one agent per 6,000 farmers, meaning a farmer with a specific question about their specific field this week has almost no realistic path to expert advice in time to act.
Agricultural knowledge is not missing. Weather forecasts exist. Crop guides exist. Extension bulletins exist. What's missing is the ability to combine that knowledge with the specifics of one farmer's field, at the moment the decision needs to be made, without depending on internet connectivity that many rural areas don't have.
That is the gap FarmTwin fills.
What it does
FarmTwin creates a digital representation of an individual farm, its location, fields, crop, growth stage, observation history, weather context, active risks and lets the farmer ask questions in natural language. It answers by combining farm-specific state with a curated local corpus of agricultural knowledge, all running on the laptop with no internet required.
A generic AI knows about maize. FarmTwin knows that this farmer's maize was planted July 5th in Kaduna, is currently in the vegetative stage, and just received 65mm of rainfall and reasons accordingly.
The full user flow:
- Create a farm (name, location, field, crop, planting date)
- Log observations as things happen (rainfall, humidity, pests, disease)
- Ask questions by typing or by voice (Nigerian English)
- Get a grounded, cited, structured recommendation with clear priority levels
Every response cites specific sources from the local knowledge corpus. Every recommendation includes what to do, why, when, and the risk of ignoring it.
How we built it
The stack is deliberately offline-first:
- Local LLM: Qwen2.5-3B-Instruct at Q4_K_M quantization, served via llama.cpp on 127.0.0.1
- RAG pipeline: 45-chunk curated agricultural corpus (NAERLS, IITA, CIMMYT, FAO sources) embedded with sentence-transformers/all-MiniLM-L6-v2, stored in SQLite with the sqlite-vec extension for KNN retrieval
- Deterministic engines: Growth stage computation and rule-based risk evaluation separated from the LLM — the model handles reasoning and articulation, not arithmetic
- Backend: FastAPI + SQLAlchemy + SQLite, with a Server-Sent Events streaming endpoint so responses arrive token by token in the browser
- Frontend: Vite + React + TypeScript + Tailwind, three focused screens (landing, farm setup, dashboard) with a docked Ask panel
- Speech input: HuggingFace Whisper-small fine-tuned on Nigerian-accented English (rishabbahal/whisper-small-nigerian-accent) evaluated against Nigerian Pidgin but that shipped as English-only after honest WER measurement
The full loop from user question to grounded, cited response runs entirely locally on a 2014 MacBook Pro with 8GB RAM deliberately weaker hardware than the ADTC Standard Laptop target.
Challenges we ran into
The 8GB memory ceiling on a real 2014 machine. Not theoretical. Every architectural decision was pressure-tested against actual memory measurements.
The Nigerian Pidgin gate. We accepted bilingual STT into scope with a Day 5.5 evaluation gate: Pidgin WER had to be ≤40% on native-speaker recordings. Whisper base scored 56%. A Nigerian-accented English fine-tune scored 58% on Pidgin (but halved English WER to 18%). NCAIR1's Nigerian model is gated on HuggingFace. Orinode's purpose-built Pidgin ASR wasn't openly available in time. We shipped English-only STT and documented the gap honestly , a real limitation of the open ASR ecosystem, not a project failure.
Model selection under real constraints. Two 3B models benchmarked (Qwen2.5 vs Llama-3.2) on 10 gold prompts with manual rubric grading. Llama produced smoother prose but hallucinated citations (2.6/5 vs Qwen's 4.2/5 on retrieval grounding). For a system whose value depends on grounded reasoning, faithful citation beats smooth writing. Qwen shipped.
Making 3-minute inference feel watchable. CPU inference on a 3B model is slow. SSE streaming meant tokens arrived live in the browser instead of 3 minutes of dead silence, the difference between a demo you can show and one you can't.
Accomplishments that we're proud of
- A real, working system. Not a mockup. Not a slide deck. A running application where a farmer can type or speak a question in Nigerian English and get a grounded, cited, farm-specific recommendation, all offline.
- Honest evaluation with real numbers. No fabricated benchmarks. Qwen wins with 87.6/100 accuracy score, 5.4 tok/s generation, 3.06 GB peak RSS, 44% of the 7GB ceiling.
- A knowledge corpus curated for the demo scenario. 45 chunks concentrated on maize + vegetative stage + fungal disease pressure driven by humidity and rainfall in Northern Nigeria. Every claim traceable to NAERLS, IITA, CIMMYT, or FAO.
- Shipped on hardware harder than the target. A 2014 Intel MacBook with 8GB RAM. Every constraint the judges will face on the ADTC Standard Laptop, we faced on weaker hardware first.
What we learned
- Small models are underrated when paired with good retrieval. A 3B model with a well-curated 45-chunk corpus outperforms a bigger model with a bigger corpus, in our tests, because retrieval quality matters more than parameter count for grounded reasoning.
- Honesty > polish, for RAG systems. Llama-3.2 wrote nicer prose but made up citations. Qwen wrote rougher prose but cited correctly. The user is better served by the honest one.
- Deterministic code should do deterministic work. Growth stages, day counts, rule evaluation — none of these belong in the LLM. Separating them out made the LLM's job easier and the system's behavior more predictable.
- The Nigerian ASR ecosystem has real open-source gaps. The best Nigerian ASR models are gated or product-only. That's a challenge for African-language AI that no single hackathon can fix — but it's worth naming clearly.
What's next for Africa
- Nigerian Pidgin ASR via Orinode integration when openly available, or a custom Whisper fine-tune on the AfriSpeech Pidgin subset
- Vision-based crop disease diagnosis — snap a photo of a leaf, get a diagnosis
- Hausa, Yoruba, and Igbo input and output
- Multi-crop reasoning within one farm (currently one active crop per field)
- Yield estimation from observation history + reference agronomic data
- Push alerts for time-sensitive risks — proactive instead of reactive
- Farmer-to-farmer knowledge sharing — pseudonymized observations across nearby farms
Built With
- fastapi
- gguf
- huggingface
- llama.cpp
- offline-ai
- python
- pytorch
- qwen
- rag
- react
- sentence-transformers
- sqlite
- sqlite-vec
- sse
- tailwind
- typescript
- whisper


Log in or sign up for Devpost to join the conversation.