NiceK1's picture
Demo link: the demo moved to a CPU instance
274250b verified
|
Raw History Blame Contribute Delete
5.17 kB
---
license: gemma
base_model: google/functiongemma-270m-it
pipeline_tag: text-generation
tags:
- gguf
- function-calling
- gemma
- functiongemma
- construction
- quantity-takeoff
language:
- en
- fi
- de
- fr
- it
---
# Blueline interpreter (tuned Gemma)
FunctionGemma 270M, fine-tuned to turn a question about a construction drawing into one structured call.
It is the question interpreter of [Blueline](https://github.com/NiceK1/stoa-spike), a tool built at Junction 2026
for the Stoa challenge "Make Blueprints Talk": ask a quantity question about a drawing and get the answer with every
counted item marked on the drawing. The model only decides *what to compute*; geometry scripts and object detectors
compute the answer, so the numbers stay exact.
- Live demo: https://blueline.65-108-32-187.sslip.io (the default mode, "Blueline only", uses this model)
- What it does in the app, and how it was built: https://github.com/NiceK1/stoa-spike/blob/main/docs/gemma.md
- All measurements: https://github.com/NiceK1/stoa-spike/blob/main/docs/results.md
## The file
`interpreter-q8_0.gguf`: 8-bit GGUF, 292 MB, for llama.cpp and its bindings. It runs on a CPU: about 0.9 seconds
per question on a laptop (i7-11800H, 8 threads).
## What it takes and what it returns
The input is a short menu of what the drawing contains and the question; the output is one JSON call.
| Drawing | Menu the model sees | Call it returns |
|---|---|---|
| Layered DXF floor plan | the plan's room labels, apartments, room numbers, symbol counts | `operation` (`count_symbols`, `count_apartments`, `rooms`, `area_apartment`, `area_floor`, `compare`, `none`) with symbols, labels, room numbers, apartments, pick, measure |
| Raster floor plan or PDF sheet | the 13 kinds the detectors know | `operation` (`count_known`, `count_other`, `read`) with targets, whole_drawing, items |
| IFC building model | storeys, element classes with counts, room names | `operation` (`count_elements`, `rooms`, `storey_total`, `model_facts`, `none`) with elements, storey, rooms, pick, measure, quantity |
Every call also says whether the user asked to be shown things (`locate`) and the answer type.
The prompt has a developer turn (one line of instruction, a one-line summary of the schema, the drawing's menu) and
a user turn (the question, with a keyword parser's reading as a hint). It must be rendered exactly as in training:
use `renderPrompt` in
[`app/server/src/models/gemma.ts`](https://github.com/NiceK1/stoa-spike/blob/main/app/server/src/models/gemma.ts).
In the app the output is constrained by a grammar built from the request's JSON schema, so a call is always valid
and can only name labels, apartments and storeys that the drawing has.
## Use it
In the Blueline app, put the file at `models/interpreter/interpreter-q8_0.gguf`; the "Blueline only" mode then
reads every question with it (see the app's README, "A local interpreter").
## Training
- Base: FunctionGemma 270M (trained from the `unsloth/functiongemma-270m-it` copy of
`google/functiongemma-270m-it`), full fine-tune, no adapter.
- Data: 53,632 question-to-call pairs generated from the app itself: 5,835 dataset questions, 30,927 questions
constructed from each drawing's own labels, apartments and storeys, and 16,870 rewordings of those by a language
model (casual, show-me requests, terse keywords, other languages, typos). The target call is known by
construction; a reworded question keeps the call of its original.
- Three epochs, about 90 minutes on one Nvidia A100 on Verda. Converted to GGUF with llama.cpp; a parity check
confirms that the app produces the token ids used in training.
## Results
Held-out pairs come from 40 plans and 7 building models that are not in training, with question templates and
rewording styles kept for the test only.
| Interpreter | Calls right in every field the operation reads (first 200 held-out pairs) |
|---|---|
| Claude Haiku 5.5, hosted | 188 (94.0%) |
| This model | 183 (91.5%) |
| FunctionGemma before fine-tuning | 0 |
On all 1,257 held-out pairs it gets 1,093 calls right (87.0%). End to end in the app, on 556 test questions it leads
to the right answer 536 times, against 539 with Claude Haiku 5.5 as the interpreter.
## Limits
- It is tuned for this app's three menus and call formats, not for function calling in general.
- It is weak in languages it was not trained on (Polish, Danish, Norwegian, Portuguese, Dutch, Estonian, Romanian).
- It misses some show-me requests that avoid the words show, mark and where, and it can misread a one-word question.
The app guards against the cases it has met; see the repository.
## Licence and credits
Gemma is provided under and subject to the Gemma Terms of Use found at https://ai.google.dev/gemma/terms. This
model is a Model Derivative of FunctionGemma and is distributed under the same terms.
The training questions were generated from the Junction 2026 Stoa dataset, which is provided for non-commercial use
in the Junction challenge; its drawings keep their own licences (CubiCasa5k is CC BY-NC-SA 4.0, for example). Treat
this model as for non-commercial use.