[GH-ISSUE #2100] [BUG]: Possible context trunking issue in version 1.6.2 #1368

Closed
opened 2026-02-22 18:24:28 -05:00 by yindo · 2 comments
Owner

Originally created by @Taluen79 on GitHub (Aug 12, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2100

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

Hi!

I was having a rather long coding session with Llama 3.1 via Groq and suddenly notices some weird reply from the LLM. So I made a fork from the thread where there reply started to sound inconsistent. I then asked the LLM to repeat my most recent message. It cited something way far back, like it has forgotten our most recent discussion, but remember what was said long ago.

I have repeated this test a few times and it seems that after a certain limit, something fishy is being done to the chat history. It feels like the trunking of message history is done incorrectly after a certain limit so that instead of remembering the most recent messages, it instead remembers the start of the conversation but forget everything that has been said recently.

I was using a chat history length of 25 in the workspace settings.

Are there known steps to reproduce?

Just have a very long chat and pay attention to what the LLM is saying, if it starts drifting of from the current topic, make a fork from the thread and then ask it to repeat your most recent message that it can remember.

Originally created by @Taluen79 on GitHub (Aug 12, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2100 ### How are you running AnythingLLM? AnythingLLM desktop app ### What happened? Hi! I was having a rather long coding session with Llama 3.1 via Groq and suddenly notices some weird reply from the LLM. So I made a fork from the thread where there reply started to sound inconsistent. I then asked the LLM to repeat my most recent message. It cited something way far back, like it has forgotten our most recent discussion, but remember what was said long ago. I have repeated this test a few times and it seems that after a certain limit, something fishy is being done to the chat history. It feels like the trunking of message history is done incorrectly after a certain limit so that instead of remembering the most recent messages, it instead remembers the start of the conversation but forget everything that has been said recently. I was using a chat history length of 25 in the workspace settings. ### Are there known steps to reproduce? Just have a very long chat and pay attention to what the LLM is saying, if it starts drifting of from the current topic, make a fork from the thread and then ask it to repeat your most recent message that it can remember.
yindo added the possible bug label 2026-02-22 18:24:28 -05:00
yindo closed this issue 2026-02-22 18:24:28 -05:00
Author
Owner

@shatfield4 commented on GitHub (Aug 12, 2024):

What you're experiencing is actually due to our messageArrayCompressor function.

You can read through the comment here explaining why this is happening and our reasoning for implementing this.

As you said it only happens when you have a very long chat and that is how this is intended to work. This function is only used when you use the entire context window of the model you are using and we need to compress your messages in order for it to fit.

@shatfield4 commented on GitHub (Aug 12, 2024): What you're experiencing is actually due to our `messageArrayCompressor` function. You can read through the comment [here](https://github.com/Mintplex-Labs/anything-llm/blob/dfb951e9cf278e06273e9d0ccae1f4cca537fc2e/server/utils/helpers/chat/index.js#L7-L22) explaining why this is happening and our reasoning for implementing this. As you said it only happens when you have a very long chat and that is how this is intended to work. This function is only used when you use the entire context window of the model you are using and we need to compress your messages in order for it to fit.
Author
Owner

@Taluen79 commented on GitHub (Aug 13, 2024):

Why not only cannonballing in query mode and use other methods to retain recent memory when chatting?

Don't want to dwell on this. I'm just pointing out that the issue exists and that it might become more prevalent when the app gains more popularity. People will not only use it for chatting with documents.

@Taluen79 commented on GitHub (Aug 13, 2024): Why not only cannonballing in query mode and use other methods to retain recent memory when chatting? Don't want to dwell on this. I'm just pointing out that the issue exists and that it might become more prevalent when the app gains more popularity. People will not only use it for chatting with documents.
yindo changed title from [BUG]: Possible context trunking issue in version 1.6.2 to [GH-ISSUE #2100] [BUG]: Possible context trunking issue in version 1.6.2 2026-06-05 14:40:23 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1368