Inspiration

Millions of smallholder farmers across Nigeria and Africa lack reliable access to agricultural extension services. Many farming communities have limited or no internet connectivity, making it difficult to access expert advice on crop production, pest management, fertilizer application, and post-harvest handling.

As an individual passionate about solving real world problems with technology, we wanted to build an AI assistant that works even without internet access. My goal was to provide farmers with instant, trustworthy agricultural guidance in both English and Hausa, making agricultural knowledge accessible to everyone regardless of literacy level or connectivity.

What it does

AgriSec is an offline AI-powered agricultural assistant designed for farmers, extension officers, and agricultural students.

The system allows users to ask natural language questions such as: How do I start maize farming? Which fertilizer is best for rice? How can I control Fall Armyworm? How should I store maize after harvest? Yaya zan shuka masara? Ya zan yi noman shinkafa?

AgriSec retrieves verified agricultural information from its local knowledge base and generates practical, easy to understand answers.

Key features include: Offline operation with no internet required. English and Hausa language support. Retrieval Augmented Generation (RAG). Local AI inference using Ollama. Fast semantic document search. Context-aware follow-up questions. Agricultural knowledge covering crops, fertilizer, pests, soil management, storage, and livestock. Source transparency for every answer.

How we built it

The project combines several AI and software engineering components into one lightweight offline system.

We first collected agricultural extension guides from trusted sources and converted them into structured Markdown documents. The documents were divided into semantic chunks and indexed using multilingual sentence embeddings.

Each user question is embedded and searched using FAISS to retrieve the most relevant agricultural knowledge. The retrieved context is then passed to a locally running Qwen 2.5 language model through Ollama, ensuring every answer remains grounded in verified information instead of hallucinating.

For Hausa support, we implemented a retrieval-first pipeline that returns verified Hausa agricultural guides directly when available, avoiding unreliable low resource language generation while maintaining fast response times.

The application includes both a command line interface and a modern web interface for interactive conversations.

Challenges we ran into

Building a completely offline AI assistant presented several technical challenges.

Initially, small language models produced inaccurate or broken Hausa responses. We solved this by redesigning the pipeline to prioritize retrieval of verified Hausa agricultural guides instead of relying solely on language generation.

Another challenge was preventing hallucinations. We implemented relevance scoring, topic detection, duplicate filtering, language routing, and confidence thresholds so the assistant refuses to answer when reliable information is unavailable.

Performance was also a challenge because the target hardware was an ordinary laptop with limited memory. Through prompt optimization, efficient chunking, multilingual embeddings, and Ollama tuning, we reduced response times from more than 30 seconds to under one second for retrieval-based Hausa answers while keeping English responses practical on CPU-only hardware.

Accomplishments that we're proud of

Built a fully offline AI agricultural assistant. Implemented multilingual English and Hausa support. Developed a Retrieval Augmented Generation pipeline. Created a searchable agricultural knowledge base. Achieved fast local inference using Ollama. Reduced hallucinations through grounded retrieval. Designed the system to work on affordable laptops without cloud services. Built a scalable architecture that can easily support additional crops, livestock, and local languages.

What we learned

Throughout this project, we gained practical experience with Retrieval Augmented Generation, semantic search, multilingual embeddings, prompt engineering, local LLM deployment, FAISS indexing, and offline AI optimization.

We also learned that for low resource languages such as Hausa, carefully curated retrieval can often provide more reliable results than relying entirely on language generation.

What's next for AgriSec Local Assistant

Our vision is to transform AgriSec into a complete agricultural intelligence platform for Africa.

Future plans include:

Voice interaction in Hausa and English. AI-powered crop disease diagnosis using phone cameras. Offline image recognition for pests and nutrient deficiencies. Drone integration for farm monitoring. Satellite imagery analysis. Weather aware farming recommendations. Seasonal planting calendars. Livestock health advisory. GPS farm mapping. Farmer record management. Government and extension officer dashboards. Mobile application for Android devices.

Ultimately, we want AgriSec to become an intelligent offline farming companion that empowers millions of African farmers with accessible, trustworthy, and practical agricultural knowledge.

Built With

Share this project:

Updates

Submission history