malAI
Rasmalai is the best
The problem malAI solves
Small, fine-tuned language models are cheap to run, but they are unreliable in customer-facing commerce. A generic chat-bot will invent products, quote wrong prices, make up return policies, and happily go along with requests it should refuse. Cloud-hosted assistants fix some of this, but they add per-token costs, send customer conversations to third parties, and need constant connectivity. For a store, one confident wrong answer about a price or a policy means a frustrated customer and a dispute.
malAI addresses this by building a shopping assistant that is grounded, safe and fully local:
- Grounded answers: Dobby answers only from the store’s 28-item catalog and its policies (returns, owl-post delivery, warranties). BM25 retrieval over 63 indexed clauses backs each reply, so product details and Galleon prices come from the source, not from the model’s memory.
- Policy-safe behavior : DPO training teaches the model to refuse Dark Arts artifacts, forbidden hexes and payment fraud, instead of treating those as ordinary requests.
Challenges we ran into
Setting Up SGLang
SGLang gave us fast inference and RadixAttention prefix caching, but getting it running was the first big hurdle. It has heavy dependencies (CUDA-matched PyTorch, specific library versions), and it needed its own environment separate from the app's. We ended up with two virtual environments, .venv-sglang for serving and training and .venv-app for the backend. Tuning launch flags so the server fit on a small GPU took a lot of trial and error.
Frequent Crashes from RAM Filling Up
Loading a model, running the inference server, and running the backend at the same time repeatedly exhausted memory and crashed our sessions. We fixed this by:
- loading the model in 4-bit (NF4) quantization,
- using a paged 8-bit AdamW optimizer, gradient checkpointing, and a batch size of 1 with gradient accumulation,
- never running training and serving at the same time.
Frequent Pivots of the Project
The project changed direction several times. It started as a regulated banking compliance assistant, with AML/KYC and lending-rule corpora, and ended up as the Enchanted Emporium with Dobby, a grounded shopping assistant. Each pivot meant rebuilding the corpus, regenerating datasets, retraining the adapter, and rewriting the benchmark. We also left stale references to earlier versions in some docs, which we had to clean up late.
Collecting Data by Hand
No ready-made dataset existed for our domain, and synthetic generation alone produced inconsistent or ungrounded answers. We wrote much of the catalog and policy data by hand and verified each sample against its source, which gave us 154 verified training samples. It was slow work, but the samples were grounded, and grounding was the point of the project.
Low-End Hardware
We developed on an RTX 4050 with only 6 GB of VRAM, which rules out most standard fine-tuning setups. Fitting QLoRA training onto it meant a small 1.5B-parameter base model, a low LoRA rank, and short sequences. Slow iteration cycles made every experiment costly, so we built a mock mode with run_mock.sh and a simulated SGLang server. That let us work on the UI and logic without loading the model.
Working in WSL from Windows
Running Linux tooling through WSL2 on a Windows machine added its own friction: path differences between the two filesystems, GPU passthrough and driver setup, slow file access across the boundary, and WSL's memory limits, which contributed to the crashes above. Working fully inside the Linux filesystem and keeping the setup in scripts made the environment reproducible.
Outcome: despite these constraints, we ended up with a working, fully offline assistant that scores 88% on our compliance benchmark.
Tracks Applied (3)
Open Track - Development
Open Track - Design
Local LLM Track
RadixArk
Technologies used