Run this model with HF Jobs

Run programmersingh/hisaab-functiongemma on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/programmersingh/hisaab-functiongemma. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/programmersingh/hisaab-functiongemma on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/programmersingh/hisaab-functiongemma. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Hisaab FunctionGemma 270M

A fine-tune of google/functiongemma-270m-it that acts as the brain of an expense tracker. It turns requests like "spent 800 on cold coffee yesterday" into function calls (add, list, delete, summarise and share expenses), asks when the amount or item is missing, and answers small talk in a sentence.

It was trained for Hisaab, a teaching app for DevFest Nepal 2026, but not only for it. The training chats vary the app name, the currency (12 of them, with cents where they are used), the category list, the tool names and argument names, and the tool descriptions. Any expense app that declares similar tools in FunctionGemma's chat format can use it.

  • English only. It reads and writes English.
  • Dates are passed as the user's words ("yesterday", "28 nov", "last friday"). The app turns them into real dates.
  • Runs in the browser. onnx/model_q4f16.onnx (4-bit weights, about 430 MB) works with Transformers.js on WebGPU and on the CPU (WASM).

Files

Path What it is
onnx/model_q4f16.onnx (+ _data) Browser model for Transformers.js, WebGPU or WASM
config.json, generation_config.json, tokenizer*.json Tokenizer and settings for Transformers.js
pytorch/ Full-precision fine-tuned weights, for further training or other conversions

Use with Transformers.js

This version was trained with Hisaab's system prompt and tool declarations (varied, but close to them), and it works best with them. They are in training/tools.json: rename the app, change the currency word, the categories and the tool names to fit your app. With a much shorter prompt or bare tool descriptions it often answers in words instead of calling a tool.

import { AutoModelForCausalLM, AutoTokenizer } from '@huggingface/transformers';

const id = 'programmersingh/hisaab-functiongemma';
const tokenizer = await AutoTokenizer.from_pretrained(id);
const model = await AutoModelForCausalLM.from_pretrained(id, { dtype: 'q4f16', device: 'webgpu' });

const url = 'https://raw.githubusercontent.com/theprogrammersingh/hisaab/solution/training/tools.json';
const spec = await (await fetch(url)).json();
const today = new Date();
const system = spec.system.replace('{DATE}', today.toISOString().slice(0, 10))
  .replace('{WEEKDAY}', today.toLocaleDateString('en', { weekday: 'long' }));

const messages = [{ role: 'system', content: system }, { role: 'user', content: 'taxi 12 dollars yesterday' }];
const inputs = tokenizer.apply_chat_template(messages, { tools: spec.tools, add_generation_prompt: true, return_dict: true });
const out = await model.generate({ ...inputs, max_new_tokens: 96, do_sample: false, eos_token_id: [1, 50, 106] });
const reply = out.slice(null, [inputs.input_ids.dims[1], null]);
console.log(tokenizer.batch_decode(reply, { skip_special_tokens: false })[0]);
// <start_function_call>call:addExpense{amount:12,category:<escape>travel<escape>,date:<escape>yesterday<escape>,note:<escape>Taxi<escape>}<end_function_call><start_function_response>

Keep special tokens when decoding: the calls are written with them. Stop at <start_function_response> (id 50), run the tool, and send its result back as a tool message.

Training

  • Data: 6,000 generated chats, plus 300 for validation and 500 for testing. The chats vary the wording, the system prompt, the tool names and descriptions, and the category scheme, so the model learns to read the tools it is given rather than memorise one app. The generator, notebook and converter are in training/.
  • Method: full fine-tune, 1 epoch, learning rate 5e-5, loss on the model's own turns only. The checkpoint with the lowest validation loss (step 300 of 516) is the one kept.
  • ONNX: the fine-tuned weights are written into onnx-community/functiongemma-270m-it-ONNX's q4f16 graph with the same 4-bit settings.

Results

The test set uses only wordings, items, system prompts, tool names and category schemes that training never shows, so it measures how well the model handles new ways of asking and new apps. A turn counts as right only when the tool names and every argument match.

Model Right turns
FunctionGemma 270M, before fine-tuning 36.0% (150 turns)
Previous version (v1), browser file 47.1% (679 turns)
This fine-tune (PyTorch) 64.9% (679 turns)
This fine-tune, browser file (onnx/model_q4f16.onnx, Transformers.js on CPU) 58.5% (679 turns), 1.4 s per turn on an M1

By kind of request (browser file): single adds 47%, two adds in one message 18%, lists 81%, totals 95%, deletes 45%, asking for a missing amount 95%, plain chat 78%.

It is reliable on common phrasings and weaker on unusual ones, and its own sentences are sometimes garbled. Write confirmations and totals in your app's code from the tool results, and check its calls before acting on anything that can't be undone.

Licence

Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms. This model is a Model Derivative of Gemma, and its use is subject to those terms, including the Gemma Prohibited Use Policy.

Downloads last month
660
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for programmersingh/hisaab-functiongemma

Quantized
(75)
this model