Nesso3-0.4B-Agentic — GGUF
F16 and Q8_0 GGUF versions of Nesso3-0.4B-Agentic, a ~0.4B bilingual (Italian/English) model for function calling, for CPU inference with llama.cpp. Converted without retraining. For what the model can and cannot do, benchmarks and limitations, read the original model card.
| File | Size | Notes |
|---|---|---|
gguf/nesso3-q8.gguf |
~451 MiB | smaller and faster; matched the original model on 7/8 probes |
gguf/nesso3-f16.gguf |
~843 MiB | closer numerical fidelity; matched 8/8 |
How to use it
Nesso3 has its own tool-calling contract. Three rules matter, and getting any of them wrong degrades the output:
- Tools go inside the system message, as compact JSON between
<tools>tags. A runtime's separatetools=parameter is ignored by this model's chat template, so tools passed that way silently disappear. - Exactly one BOS token (
<|begin_of_text|>) at the start. The chat template embedded in the GGUF does not write it, and some chat APIs do not add it either: withllama-cpp-python0.3.36,create_chat_completionsends the prompt without a BOS and the model's answers change. Build the prompt yourself, as below. - Greedy decoding (temperature 0, no repetition penalty) for tool calls.
Python (llama-cpp-python)
pip install llama-cpp-python huggingface_hub, then:
import json, re
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
path = hf_hub_download("mii-llm/nesso3-0.4B-agentic-gguf", "gguf/nesso3-q8.gguf") # or gguf/nesso3-f16.gguf
llm = Llama(model_path=path, n_ctx=4096, n_threads=4, verbose=False)
def prompt(messages):
"""Nesso3's native Llama-3 format, with exactly one BOS (the embedded chat template does not write it)."""
s = "<|begin_of_text|>"
for m in messages:
s += f"<|start_header_id|>{m['role']}<|end_header_id|>\n\n{m['content'].strip()}<|eot_id|>"
return s + "<|start_header_id|>assistant<|end_header_id|>\n\n"
def chat(messages, max_tokens=256):
ids = llm.tokenize(prompt(messages).encode(), add_bos=False, special=True)
out = llm.create_completion(ids, temperature=0.0, max_tokens=max_tokens, stop=["<|eot_id|>"]) # greedy
return out["choices"][0]["text"].strip()
def parse_calls(text):
return [json.loads(c) for c in re.findall(r"<tool_call>\s*(\{.*?\})\s*</tool_call>", text, flags=re.S)]
tools = [
{"type": "function", "function": {"name": "get_weather", "description": "Meteo attuale per una città",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}},
{"type": "function", "function": {"name": "convert_currency", "description": "Converte un importo tra due valute",
"parameters": {"type": "object",
"properties": {"amount": {"type": "number"}, "from": {"type": "string"}, "to": {"type": "string"}},
"required": ["amount", "from", "to"]}}},
]
# Tools go INSIDE the system message, as compact JSON between <tools> tags
system = {"role": "system", "content": "Sei un assistente operativo. Usa gli strumenti disponibili quando serve.\n<tools>\n"
+ json.dumps(tools, separators=(",", ":"), ensure_ascii=False) + "\n</tools>"}
print(parse_calls(chat([system, {"role": "user", "content": "Quanto sono 250 euro in sterline?"}])))
# [{'name': 'convert_currency', 'arguments': {'amount': 250, 'from': 'EUR', 'to': 'GBP'}}]
print(parse_calls(chat([system, {"role": "user", "content": "Che tempo fa a Roma e a Torino?"}])))
# [{'name': 'get_weather', 'arguments': {'city': 'Roma'}}, {'name': 'get_weather', 'arguments': {'city': 'Torino'}}]
# Close the loop: run the tool yourself and return its JSON result as a `tool` turn
question = {"role": "user", "content": "Che tempo c'è a Roma adesso?"}
call = chat([system, question]) # get_weather(city="Roma")
result = {"city": "Roma", "temp_c": 24, "condition": "soleggiato"} # <- your get_weather() output
print(chat([system, question, {"role": "assistant", "content": call},
{"role": "tool", "content": json.dumps(result, ensure_ascii=False)}]))
# Ci sono 24°C e la condizione è soleggiata.
The outputs in the comments are what this exact code printed with the Q8 file (llama-cpp-python 0.3.36, CPU); they match the original model's. The model only proposes calls: your application parses and validates them, executes the authorized ones and returns the results. After parallel calls, return all results in one tool turn (a JSON list).
Reference runner (pinned llama.cpp, CPU)
A tested command-line runner that preserves the tokenization contract (saved chat template, exactly one leading BOS, greedy decoding, 4096-token context, up to 192 generated tokens) is kept in the mii-llm/nev repository. Only Nesso3 artifacts are downloaded and only Nesso3 is loaded. Requires Python 3.12 or 3.13, Git, a C/C++ compiler (Xcode command-line tools on Mac) and network access to Hugging Face and GitHub:
git clone https://github.com/mii-llm/nev.git
cd nev/experiments/cpu_gguf
./setup.sh --model nesso3 --precision q8
# Public download; no Hugging Face login is required.
.venv/bin/python generate.py --precision q8 --language both
.venv/bin/python test_standalone.py --model nesso3 --precision q8
The default example supplies bilingual sensor-tool schemas and requests a reading of S-6K3, printing the generated tool-call proposal:
English request: Read temperature sensor S-6K3.
Italian request: Leggi la temperatura del sensore S-6K3.
<tool_call>
{"name": "read_sensor", "arguments": {"sensor_id": "S-6K3"}}
</tool_call>
This generates text only: it does not execute a sensor tool or know its reading. For ordinary generation or your own conversation:
.venv/bin/python generate.py --precision q8 --language en --message 'Write a short greeting.'
.venv/bin/python generate.py --precision q8 --language it --message 'Scrivi un breve saluto.'
# messages.json is an array of role/content objects using the native chat format:
.venv/bin/python generate.py --precision q8 --messages messages.json
# Closer numerical fidelity:
./setup.sh --model nesso3 --precision f16
.venv/bin/python generate.py --precision f16 --language both
--output results/my-generation.json saves a trace and refuses to overwrite an existing file. Inference is offline after download, on four CPU threads by default, with no Metal/CUDA offload.
Other llama.cpp front ends
Nesso3 uses the ordinary Llama architecture, so any llama.cpp-based tool loads it. Compatibility with third-party chat UIs has not been tested, and the two pitfalls above apply: a UI that sends tools separately, or that does not add the BOS token, will get worse answers.
Conversion results and limitations
On eight short bilingual first-generation probes, GGUF tokenization matched the original Hugging Face tokenizer exactly. F16 matched 8/8 reference token sequences; Q8 matched 7/8. The differing Q8 case and its reference both proposed an invalid extra tool call. This is a small numerical diagnostic, not a function-calling success rate.
On an Apple M3 Pro, short-probe decoding (excluding prompt processing) ran at roughly 89 tokens/s with F16 and 129 tokens/s with Q8. These short runs are not throughput guarantees; memory use includes runtime buffers beyond the file size. Phones have not been validated.
The model can choose wrong arguments, add unwanted calls, misstate units or tool facts, and mishandle unsupported actions. These weaknesses exist before conversion too (see the original model card). Treat generated calls as proposals to validate.
Files and provenance
gguf/nesso3-f16.gguf,gguf/nesso3-q8.gguf: the complete generative model.models/nesso3/: original tokenizer, chat template and configuration.ARTIFACTS.json: exact file sizes and SHA-256 hashes.PROVENANCE.json: pinned source and conversion metadata.
Source: mii-llm/nesso3-0.4B-agentic at 56f42f1c7eb82fbd48b0c4ee46aae7b8bed203b8. Converted with unmodified llama.cpp 37d6d653e49aa73c947cc9631a5d499869a21cca, no retraining. Apache-2.0; source notices included.
Related
- Nesso3-0.4B-Agentic: the original model, its card and evaluations; recipe and experiment log on GitHub.
- Nev: a separate mii-llm decision model (it picks among options, it does not write text). It is not needed to run Nesso3; an optional Nesso3 + Nev CPU agent is described in the Nev repository.