A Hausa-only decoder-only Transformer language model built from scratch with PyTorch to support agricultural knowledge for Hausa-speaking communities. The project includes custom Hausa tokenization, causal language model pretraining, inference, RAG integration, and FastAPI deployment.
# Dikko AI Noma
**Dikko AI Noma** is a Hausa-language agricultural AI assistant designed to provide practical knowledge and guidance on **Noma (crop farming and agriculture)**.
The system combines a custom lightweight **decoder-only Transformer language model** with **Retrieval-Augmented Generation (RAG)** to improve the accuracy and relevance of Hausa agricultural responses.
## Features
* Hausa-focused agricultural AI assistant
* Custom decoder-only Transformer language model
* Custom SentencePiece tokenizer
* Fine-tuned on Hausa agricultural instruction-response data
* Retrieval-Augmented Generation using agricultural knowledge
* ChromaDB vector database
* LangChain-based RAG pipeline
* FastAPI backend
* Next.js frontend
* Persistent local vector database
* GPU/CPU-compatible inference
* Support for Hausa characters such as `Ƙ`, `ƙ`, `Ɗ`, and `ɗ`
## System Architecture
```text
Dikko AI Noma
│
▼
Next.js UI
│
▼
FastAPI Backend
│
▼
User Query
│
▼
LangChain RAG System
│
▼
ChromaDB Search
│
▼
data/rag/noma.txt
│
▼
Relevant Agricultural Context
│
▼
Custom Dikko AI Noma Model
│
▼
Hausa AI Response
│
▼
Next.js UI
```
## Technology Stack
### AI / Machine Learning
* Python
* PyTorch
* Custom Decoder-only Transformer
* SentencePiece
* Hugging Face
* LangChain
* ChromaDB
* Hugging Face Sentence Transformers
### Backend
* FastAPI
* Uvicorn
### Frontend
* Next.js
* React
* TypeScript
### Data
* Hausa agricultural text
* Hausa instruction-response fine-tuning data
* `noma.txt` knowledge base
* ChromaDB vector index
## Model
Dikko AI Noma uses a lightweight custom decoder-only Transformer designed for experimentation and deployment with limited computational resources.
Current model configuration:
```text
Vocabulary Size: 8,000
Hidden Size: 256
Transformer Layers: 2
Attention Heads: 4
Context Length: Configurable
Tokenizer: SentencePiece
Language: Hausa
Domain: Noma / Agriculture
```
The model is trained using causal language modeling and fine-tuned using Haus …