Skip to content

server: fix /infill prompt placement after FIM_MID#22761

Open
Aayush7g wants to merge 1 commit intoggml-org:masterfrom
Aayush7g:fix/issue-22678
Open

server: fix /infill prompt placement after FIM_MID#22761
Aayush7g wants to merge 1 commit intoggml-org:masterfrom
Aayush7g:fix/issue-22678

Conversation

@Aayush7g
Copy link
Copy Markdown

@Aayush7g Aayush7g commented May 6, 2026

The 'prompt' field was incorrectly appended to tokens_prefix, placing it before FIM_SUF and FIM_MID. This caused the model to treat it as part of the prefix (code above cursor) instead of a generation primer after FIM_MID.

Fix: move tokens_prompt insertion to after embd_inp.push_back(FIM_MID).

Fixes #22678

Overview

  • Corrects the token assembly logic in the server's infill endpoint.

Additional information

  • Tested with Qwen2.5-Coder via the /infill endpoint.

Requirements

The 'prompt' field was incorrectly appended to tokens_prefix,
placing it before FIM_SUF and FIM_MID. This caused the model
to treat it as part of the prefix (code above cursor) instead
of a generation primer after FIM_MID.

Fix: move tokens_prompt insertion to after embd_inp.push_back(FIM_MID).

Fixes ggml-org#22678
@Aayush7g Aayush7g requested a review from a team as a code owner May 6, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] /infill endpoint logic contradicts README: 'prompt' field placed in prefix instead of after FIM_MID

1 participant