Logo Lanfrica
  • Home
  • Atlas
  • Insights
  • Docs
  • Sign in

© 2026 Lanfrica. All rights reserved. All copyrights of the resources shown on the Lanfrica website belong to the original copyright holders, unless explicitly stated otherwise.

ianMuchesia/mini-llm-api

Domain:

natural language processing

Record type:

modelsoftware
Creator:
ian
Host:
Character-level GPT-style Transformer trained on Swahili Wikipedia. Implements greedy, temperature, top-k, and top-p sampling. Served via a FastAPI streaming inference API, containerized with Docker. Built from scratch over 3 weeks as a deep study of transformers, MLOps, and LLM serving # mini-llm-api A GPT-style character-level language model trained on Swahili Wikipedia, with a FastAPI streaming inference server. Built over 3 weeks as a ground-up study of transformers, sampling strategies, and MLOps deployment. --- ## What's Inside | Folder | Contents | | :--- | :--- | | `src/` | Model, tokenizer, dataset, trainer, generation scripts, Wikipedia pipeline | | `app/` | FastAPI server with `/generate` and `/generate_stream` endpoints | | `experiments/` | Sampling outputs from CPU and GPU runs | | `math-notes/` | Parameter count analysis (~418K params) and FLOP estimation (~1.71 GFLOPs) | | `checkpoints/` | Saved model weights (`best_model.pt`) and vocab | --- ## Model Architecture - **Type:** Decoder-only Transformer (GPT-style) - **Tokenization:** Character-level (`CharTokenizer`) - **Embeddings:** Learned token + learned positional (`nn.Embedding`) - **Attention:** Causal (upper-triangular mask), `nn.TransformerEncoderLayer` - **Config:** `d_model=128`, `num_heads=4`, `num_layers=2`, `max_len=75` - **Training data:** Swahili Wikipedia (~5MB clean text) ## Sampling Strategies Implemented - **Greedy** — always picks the top token (fast, but stutters) - **Temperature** — scales logits before softmax; `T 1` = creative - **Top-k** — keeps only the `k` highest-probability tokens - **Top-p (nucleus)** — keeps the smallest set of tokens covering cumulative probability ≥ `p` --- ## API Endpoints ``` POST /generate → returns full generated text POST /generate_stream → streams tokens one-by-one (Server-Sent Events) GET /health → health check ``` **Request body:** ```json { "prompt": "Habari za", "max_length": 200, "temperature": 0.8, "top_k": 40 } ``` --- ## Running Locally ```bash # Install dependencies pip install -r requirements.txt # Start API server uvicorn app.main:app --reload --port 8000 ``` ```bash # Docker (development) docker-compose up ``` --- ## Study Notes See NOTES.md for a full conceptual breakdown of ever …

Visit

github.com

Tasks

language modeling

Languages

Swahili

Similar

Reda-MALKI/LLM-Model-API-KEYianMuchesia/tiny-translation-modelMultimodal medical diagnosis: a mini review of LLM–vision fusion models in low-resource healthcare settingsafrica-api/africa-api-mcpugbewijc/Mini-NeflixMini-review Summary

Reda-MALKI/LLM-Model-API-KEY

This project leverages a Large Language Model (LLM) via an API (Gemini API Key) to perform intellige

ianMuchesia/tiny-translation-model

Minimal seq2seq Transformer for English->Swahili translation with attention-based encoder/decoder bl

Multimodal medical diagnosis: a mini review of LLM–vision fusion models in low-resource healthcare settings

Recent advances in large language models (LLMs) and vision transformers have enabled multimodal syst

africa-api/africa-api-mcp

# Africa API MCP Server An MCP server that gives Claude direct access to the Africa API — comprehen

ugbewijc/Mini-Neflix

Mini Neflix Angular web application. Google Africa Developer Scholarship Phase II, Mobile Web Specia

Mini-review Summary

This mini review brings to bear a situation that occurred in the rural areas of West Africa where th