Inspiration

Across rural Africa, smallholder farmers and extension officers make crop and livestock decisions where a cloud AI simply isn't an option — blocked by API cost, patchy connectivity, and unreliable power, not by preference. An advisor that only works online doesn't work for them at all. We wanted a careful, trustworthy farm advisor that runs entirely on a commodity laptop, fully offline — the kind of machine a co-op or an extension officer already owns.

What it does

AgriDoc is an offline, on-device agriculture advisor for the ADTC Standard Laptop (8 GB RAM, integrated graphics, no GPU). A farmer describes a problem in plain language — a sick crop or bird, a lame cow, whether to plant on the first rains, when to sell the maize — and gets a careful, reasoned first opinion: the likely cause, what to check, and when to escalate to a vet or extension service.

  • The whole track, one model — crop, livestock, weather, and market, not just crop disease.
  • Grounded, and honest — answers are reinforced by offline retrieval over a local agronomy/livestock corpus and the farmer's own records, and it never invents a pesticide dose, a market price, or a weather forecast; it points to the product label, local buyers, or an agro-met officer.
  • Their language, by voice — English, Kiswahili, Setswana and Kinyarwanda, typed or spoken, with answers read aloud.
  • A living record — herds, crops, water points and events, with a printable season record and a weekly plan the app builds from that data.

Everything runs on-device. No internet, ever.

How we built it

The model. We benchmarked Llama-3.2-1B, Qwen2.5-1.5B and Qwen3-1.7B — each gated the same way — and settled on a LoRA fine-tune of Qwen3-1.7B, quantized to a Q4_0 GGUF for llama.cpp (fastest on the scalar profiler the audit uses). The bare model is judged conversationally, so we trained the behaviour, not trivia: ask a discriminating question when the description is thin, commit when the pattern is clear, give a safe first opinion for livestock, and refuse to fabricate a dose, price or forecast.

The cross-disciplinary core: RAG over corpus and records. Answers are grounded by hybrid retrieval — dense embeddings plus keyword search — over a license-vetted FAO/extension corpus and the farm's own SQLite records. That pairing is the load-bearing cross-disciplinary integration ADTC asks for.

The app. A Tauri (Rust) desktop shell with a React UI, the on-device model, and four small offline Python services around it — retrieval, records, translation (NLLB), and voice (Omnilingual ASR in, MMS TTS out). It ships with an embedded Python runtime, so it runs on a clean machine with nothing installed.

Challenges we ran into

  • A sub-2B model that's both broad and safe. Covering four sub-domains and never fabricating a number is hard at 1.7B. We ran a controlled A/B — the same training data on two base models — to prove Qwen3 held disease accuracy while adding breadth, and we gated every run by chatting the bare model adversarially, because an earlier "zero failures" gate had flattered a model that actually looped and leaked.
  • Fixing the model, not shipping the base. An EOS-not-in-loss bug made it loop forever; identity leaked ("I am Qwen"); multi-turn pressure leaked doses. Each was fixed across gated fine-tuning runs.
  • Packaging fully-offline on 8 GB. Embedded Python plus native ONNX/CTranslate2 wheels, a Windows verbatim-path quirk that broke one library, and a 2 GB installer limit — so we ship both a tiny installer that fetches models once and a full offline portable. Peak RAM stays well under the 7 GB line (OOM = instant disqualification).

What we learned

  • Gate like a judge or you fool yourself — chat the bare GGUF, adversarially, or your metrics lie to you.
  • RAG owns the facts; the model owns the reasoning and the safety. Don't chase trivia into the weights.
  • Offline-first is a distribution model, not just a runtime — install once where there's signal, use it forever where there isn't.

What's next

Speech recognition for Setswana and Kinyarwanda via MMS-ASR; one-step pairing with SaharaSprout's solar field controller to pull live sensor history; and a projected-harvest record that crosses to the market tier when a connection appears.

Built With

Share this project:

Updates

Submission history