Running LFM2-2.6B Q4_K_M on an iPhone 15: numbers and tips for structured output

#3
by theyplaygames - opened

Sharing results in case they help others running LFM2 on phones.

Setup: LFM2-2.6B-Q4_K_M.gguf (1.6 GB) with llama.cpp b11887 on an iPhone 15 (A16, 6 GB RAM, no Apple Intelligence), Metal, n_ctx 4096, greedy sampling with a GBNF grammar so the output is always valid JSON.

Timings on the phone:

  • first model load ~20 s, then it stays in memory
  • short text β†’ 6-field JSON: 4–6 s
  • voice-note transcript β†’ task list (nested objects): 7–9 s
  • OCR'd bill (~1,500 chars) β†’ 7 fields incl. summary and steps: 10–14 s

What worked well: extraction and summaries in 8 languages (EN, DE, FR, ES, JA, KO, ZH, AR), and reading a Japanese bill while answering in English. Compared on our transcripts it was nearly as good as Qwen3-4B at two thirds of the size and about twice the speed.

What needed help from outside the model:

  • totals on receipts (it sometimes picks a line item) β†’ we take the amount next to "Total/合計" with a rule
  • weekdays β†’ giving today plus the next 7 dates by name fixed "on Tuesday"
  • answer language β†’ repeat it after the input, not only in the system prompt
  • long prompts crash llama.cpp unless n_batch >= prompt length (we use n_batch = n_ctx)

Screen recordings (all offline on the phone): https://theyplay.games/ondevice/#real
GBNF from a Swift schema (MIT): https://github.com/theyplay-games/swift-gbnf
llama.cpp xcframework with an iOS Simulator slice (MIT, unchanged b11887): https://github.com/theyplay-games/llama-xcframework

Thanks for the model, it's the best size/quality trade-off we found for phones.

Sign up or log in to comment