# FIM (Fill-in-the-Middle) Format: Prefix + Suffix → Middle Token Logic

> Source: https://sukruyusufkaya.com/en/learn/fine-tuning-cookbook/ftc-fim-fill-in-the-middle-format
> Updated: 2026-05-14T14:42:55.318Z
> Category: Fine-Tuning Cookbook (Model-by-Model)
> Module: Part VIII — Code Models & Repo-Level FT
**TLDR:** Spine of code completion: FIM. Classic LLM next-token prediction insufficient for code — in real IDE cursor is in middle, prefix + suffix exist. FIM training format. Dataset prep: random split + transform existing code. Bayraghani et al. 2022 paper foundation.

