LFM3-1.7B-sheetft
A LoRA fine-tune of LiquidAI/LFM3-1.7B that turns spreadsheet instructions into executable cell patches: it reads a sheet serialised as address→value lines and replies with one JSON object holding the exact cells to change, or declines when the sheet cannot support the edit.
It is trained in the style of Decide's DAX-1: single-turn, structured patch output, execution-based verification (never an LLM judge), and no guessing.
Response contract
{
"status": "edited" | "declined",
"edits": {"B7": 43, "C2": "A"},
"reason": "<why, only when declined>"
}
Rules the model was trained on:
editedonly when every edit is supported by the sheet.declinedwhen information is missing (missing key, empty or gapped range, unparseable value, missing score), with the explanation inreason.editsholds only the cells the task asked to change; no collateral writes.- Plain values by default; formulas only when asked to repair one, in canonical
form (
=SUM(B2:B6)).
Prompt shape: "You are editing a spreadsheet. Here is the sheet:\n\nA1: Item\nB1: Amount\n..."
followed by Task: ..., the contract, and the decision rule. Addresses are
canonical uppercase; blank cells are omitted; sheets are serialised row-major;
multi-sheet workbooks use SheetName!A1 keys. A full prompt is included in
prompt_template.txt.
Training
| item | value |
|---|---|
| base | LiquidAI/LFM3-1.7B (instruct) |
| method | LoRA (r=32, α=64, dropout 0.05, all-linear), merged to bf16 |
| schedule | 2 epochs, lr 5e-5 cosine, effective batch 16, max length 2560 |
| calibration | 1 extra epoch on a 50/50 decline/edit mix, lr 3e-5 |
| losses | completion-only (prompt masked) |
Data mix (declines ≈ 22.6% of the weighted mix):
| source | tasks | notes |
|---|---|---|
| synthetic sheetft families | 3,315 | lookup (single table + join), formula repair, aggregation, classification rules, date normalisation, plus decline cases |
| SpreadsheetBench 912 | 761 | real .xlsx workbooks, real instructions; supervised on the input→answer cell diff |
| FinQA train | 311 | real financial tables, program-verified addition; includes QA-shaped decline twins |
| TAT-QA train | 2,149 | real financial tables with large magnitudes, $ and thousands separators; includes decline twins |
Public data was used for training only; evaluation below includes official held-out splits of those sources. Dataset licences are the responsibility of their publishers; check them before redistributing converted data.
Evaluation
All numbers are greedy decoding (temperature 0), one attempt, exact-match verification by applying edits to the workbook and comparing every cell.
Spreadsheet editing (in-distribution, 585 tasks)
| metric | base LFM3-1.7B | this model |
|---|---|---|
| strict pass | 30.9% | 75.9% |
| parse success | 95.0% | 100% |
| status accuracy | 84.9% | 100% |
| collateral writes | 5.5% | 0.0% |
| lookup / formula / date | 54.4 / 52.2 / 86.7% | 100 / 100 / 100% |
| classification / aggregation | 3.0 / 1.7% | 80.0 / 36.7% |
Hand-written held-out set (20 tasks, novel layouts and wording)
| base | this model |
|---|---|
| 56.2% | 70.0% |
Fresh held-out data (815 tasks, never trained on)
| subset | n | base | this model |
|---|---|---|---|
| TAT-QA dev | 211 | 0.0% | 34.1% |
| TAT-QA test-gold | 195 | 0.0% | 36.9% |
| FinQA dev (pure addition) | 18 | 0.0% | 11.1% |
| FinQA dev (any operation) | 91 | 0.0% | 19.8% |
| synthetic, unseen seed | 300 | 39.7% | 84.7% |
| overall | 815 | 14.6% | 51.3% |
Collateral writes on fresh data: 0% for this model vs 22–43% for the base.
PLUMB grounding benchmark (96 tasks, greedy decoding)
| metric | base | this model |
|---|---|---|
| fabrication rate ↓ | 0.0% | 31.2% |
| silent-guess rate ↓ | 0.0% | 0.0% |
| collateral write rate ↓ | 12.5% | 6.2% |
| over-refusal rate ↓ | 50.0% | 14.1% |
| completion rate ↑ | 35.9% | 39.1% |
| parse success ↑ | 96.9% | 100.0% |
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "EbukaGaus/LFM3-1.7B-sheetft"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
model.eval()
messages = [{"role": "user", "content": prompt}] # see prompt_template.txt
ids = tok.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True,
enable_thinking=False, return_tensors="pt",
).to(model.device)
with torch.no_grad():
out = model.generate(ids, max_new_tokens=256, do_sample=False,
pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True))
The chat template ships as chat_template.jinja; load it explicitly if your
transformers build does not pick it up:
tok.chat_template = open("chat_template.jinja").read()
For production serving, constrained JSON decoding raises parse success to 100% (this is how the evaluations above were served). A permissive schema that fits both the sheetft and PLUMB contracts:
schema = {
"type": "object",
"properties": {
"status": {"type": "string"},
"answer": {"type": ["string", "number", "null"]},
"edits": {"type": "object",
"additionalProperties": {"type": ["string", "number", "null"]}},
"reason": {"type": ["string", "null"]},
},
"required": ["status"],
"additionalProperties": False,
}
Limitations
- Arithmetic at scale. Exact sums of 4–7 operands at 5–7 digits are the main residual error source (aggregation 36.7% strict pass). This is a 1.7B capacity limit, not a format issue; DAX-1 used a 14B base.
- Fabrication trade-off. Training on real question-answering tables raised real-table capability (0% → ~31% on held-out real edits) but also raised fabrication on unanswerable questions (PLUMB 0% → 31.2%). A synthetic-only variant with no public QA data trades ~20 points of real-table capability for 0% fabrication.
- English only, single-turn, text protocols. The model does not read or write
.xlsxfiles itself; the host serialises the sheet and applies the patch. - Not a general chat model; it is tuned for the patch contract.
Licence
Derivative of LiquidAI/LFM3-1.7B, distributed under the LFM Open License
v1.0 (see LICENSE). The base model's terms apply to this model
and its outputs; review them before commercial use. Training included public
research datasets (SpreadsheetBench, FinQA, TAT-QA); their terms apply to those
portions of the training data.
Files
model.safetensors— merged bf16 weightsadapter/— the LoRA adapter (r=32, α=64)train_metrics.json— loss history and calibration summaryprompt_template.txt— the exact prompt the model was trained on