← cd ~ ~/42-firenze/call-me-maybe
42 firenze · milestone 3 · python · llm

Call-Me-Maybe

Function calling with a 0.6B-parameter language model. The model turns a request in natural language into a JSON call with typed arguments. On its own a model this small doesn't reliably follow a schema. Here, at every generation step, every token that would break the JSON or the schema is masked out, so the output is valid by construction.

pythonqwen3-0.6bconstrained decodingdfanumpypydantic
decoding trace
user
output
candidates
chosen by the modelmasked: breaks the grammarinjected by the grammar, no forward pass
same model, no constraints · red = text after the object, the output is no longer valid json

A real trace recorded from the project's decoder running Qwen3-0.6B: the top-8 raw logits at each step, and which of them the grammar mask allowed.

how it works

view source on github ↗teemoteeo/quarantadue/milestone_3/call me maybe