Загрузка...

Why does your LLM ignore the middle of a long prompt?

Why does an LLM ignore information stuck in the middle of a long context — even when it's right there?

Picture one giant prompt with fifty documents glued together. The answer the user needs lives in document twenty-five — right in the middle. You ask the question and the model confidently misses it. Move that same doc to the very top, or the very bottom, and suddenly the answer is perfect. This is the lost-in-the-middle effect.

Why it happens: attention — the model's spotlight that picks which words matter most — is uneven across your prompt. It leans hard on the start (because intros usually carry the topic) and on the end (because your question usually sits there). The middle gets the dimmest light, so tokens in the middle get less weight in the final answer.

The fix has a name: reranking. After you fetch fifty docs, re-score them with a tiny reranker model that sorts by true relevance, not keyword match. Keep the top three, drop the rest, then place the best chunk at the very start and the next-best at the end. Now the spotlight lands exactly where the answer is.

Long context is not free attention. Rerank — then pack the edges.

Music: Markvard - Time [NCS Release] (NoCopyrightSounds)
https://ncs.io

#ai #llm #rag #reranking #attention #shorts #programming

Видео Why does your LLM ignore the middle of a long prompt? канала ProCode
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять