Lilavati · Udgam Labs

UDGAM LABS · Maths model · 95M parameters, with a 95M checker · GGUF

Lilavati-GGUF

Lilavati solves maths word problems by writing a short Python program and running it. Lilavati-Checker rates each program, so that several tries can vote. Both are 95M-parameter models trained from scratch. This repository holds both as GGUF files, for llama.cpp and for running in a web browser. Results, data and limits are on the Lilavati model card.

File Size Use
Lilavati-Q8_0.gguf 102 MB writes the programs
Lilavati-Checker-Q8_0.gguf 102 MB gives each program a probability of being correct

Quick start

Try it in your browser: udgamlabs.com/models/lilavati. Everything runs on your device.

llama.cpp: Lilavati continues this prompt with a Python function and closes it with three backticks.

llama-completion --hf-repo udgamlabs/Lilavati-GGUF --hf-file Lilavati-Q8_0.gguf -no-cnv --temp 0 -n 320 -r '```' \
  -p $'Question: A shop sells pencils at 8 rupees each. Riya buys 6 pencils and pays with a 100 rupee note. How much change does she get?\nAnswer (Python):\n```python\n'

Run the program only inside a sandbox. The lilavati package checks and runs every program for you (lilavati/safe_exec.py).

The checker reads the question, the program and its result, and answers yes or no:

Question: {question}
Answer (Python):
```python
{program}
```
Result: {value, or "error"}
Correct:

Its probability of " yes" divided by the sum of " yes" and " no" is the program's score. Several tries vote with these scores, which is how the model card's 8-try and 48-try numbers are made.

In your own web page: use wllama, which is llama.cpp compiled to WebAssembly.

  • Load both files. wllama adds the <bos> token itself, so send the prompts above as they are.
  • Run each program in Pyodide inside a Web Worker, after the structure check from safe_exec.py, with a time limit.
  • wllama reports probabilities only for the top n_probs tokens. Ask for about 300 so that both " yes" and " no" are included.
  • The udgamlabs.com page does all of this. Its code is public: /models/lilavati/lilavati-solve.js.

How these files were made and checked

  • Converted from the released safetensors with llama.cpp's convert_hf_to_gguf.py (commit d7a695e), --outtype q8_0. The weights are only rounded to 8 bits; nothing else changed.
  • Checked against the released Python package (transformers, float32, CPU) on 28 October 2026, on the first 100 GSM8K test questions [measured by us]:
    • One greedy program per question:
      • all 100 programs written in the browser (wllama 3.6.1, Chrome) are identical to native llama.cpp on these files;
      • 86 of 100 are identical to the float32 model's, and 95 of 100 give the same answer (59 vs 60 correct). The rest come from 8-bit rounding.
    • The checker: on 96 programs sampled by the float32 model (12 questions × 8), its probabilities are within 0.036 of the float32 checker's (median difference 0.0005). The checker-weighted vote picks the same answer on 12 of 12.
  • Ollama and LM Studio were not tested.

SHA-256:

3d069ab0c3cd44c3df02dfa07a160c04468ab0c332b188753a3f5402104c4323  Lilavati-Q8_0.gguf
598b5c68de07e8438d6f746aea830a043755af2b3792158fd6ab86b0230eae2b  Lilavati-Checker-Q8_0.gguf

Where it falls short

These files are 8-bit versions of the released models, with the same strengths and weaknesses; see the model card. In short: it is good at grade-school word problems. It is weak at:

  • numbers that should be ignored;
  • working backwards;
  • unit conversions;
  • questions that have no answer (it always returns a number).

It is not a chatbot.

Licence

Apache-2.0, like the original models.

Citation

@misc{lilavati2026,
  title  = {Lilavati: a 95M pocket mathematician that solves word problems by writing Python},
  author = {Udgam Labs},
  year   = {2026},
  url    = {https://huggingface.co/udgamlabs/Lilavati}
}

About Udgam Labs. Udgam Labs is an independent AI research lab. We work from first principles: before we build, we understand why things work, whether we are training a model, fine-tuning one or applying AI to a new problem. Udgam (उद्गम) is Sanskrit for origin. udgamlabs.com

Downloads last month
118
GGUF
Model size
94.7M params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for udgamlabs/Lilavati-GGUF

Quantized
(1)
this model

Collection including udgamlabs/Lilavati-GGUF