[GH-ISSUE #2027] [BUG]: Citations do not correspond to the true chunk locations. #1323

Closed
opened 2026-02-22 18:24:16 -05:00 by yindo · 1 comment
Owner

Originally created by @sonnt-dna on GitHub (Aug 2, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2027

How are you running AnythingLLM?

Docker (local)

What happened?

I am using a Docker file and embedding texts in the AnythingLLM Database. When I use it, the citation section shows the wrong positions of the chunks used to provide the answer. Please help me fix this issue, and if there is a way to do it, please provide guidance!

Set up the Environment:

Ensure Docker is installed and running on your machine.
Use the provided Docker file to set up the AnythingLLM environment.
Start the Docker container.

Embed Texts in AnythingLLM Database:

Use the embedding function to add texts to the AnythingLLM Database.
Ensure that the texts are divided into chunks correctly during the embedding process.

Query the Database:

Perform a query that triggers the citation functionality.
Observe the results and note the positions of the cited chunks.

Identify the Issue:

Compare the cited positions with the actual positions in the original text.
Note any discrepancies where the citation positions do not match the correct locations of the chunks

Originally created by @sonnt-dna on GitHub (Aug 2, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2027 ### How are you running AnythingLLM? Docker (local) ### What happened? I am using a Docker file and embedding texts in the AnythingLLM Database. When I use it, the citation section shows the wrong positions of the chunks used to provide the answer. Please help me fix this issue, and if there is a way to do it, please provide guidance! **Set up the Environment:** Ensure Docker is installed and running on your machine. Use the provided Docker file to set up the AnythingLLM environment. Start the Docker container. **Embed Texts in AnythingLLM Database:** Use the embedding function to add texts to the AnythingLLM Database. Ensure that the texts are divided into chunks correctly during the embedding process. **Query the Database:** Perform a query that triggers the citation functionality. Observe the results and note the positions of the cited chunks. **Identify the Issue:** Compare the cited positions with the actual positions in the original text. Note any discrepancies where the citation positions do not match the correct locations of the chunks
yindo added the possible bug label 2026-02-22 18:24:16 -05:00
yindo closed this issue 2026-02-22 18:24:16 -05:00
Author
Owner

@timothycarambat commented on GitHub (Aug 2, 2024):

This is not a bug if I am reading this correctly, this is just how RAG works. They are ranked by "similarity" not their inherent order in the original document. In fact, embeddings do not preserve their order in the source document at all and are purely linked via metadata alone.

What you see in citations are just the relevancy order from your query

@timothycarambat commented on GitHub (Aug 2, 2024): This is not a bug if I am reading this correctly, this is just how RAG works. They are ranked by "similarity" not their inherent order in the original document. In fact, embeddings do not preserve their order in the source document at all and are purely linked via metadata alone. What you see in citations are just the relevancy order from your query
yindo changed title from [BUG]: Citations do not correspond to the true chunk locations. to [GH-ISSUE #2027] [BUG]: Citations do not correspond to the true chunk locations. 2026-06-05 14:40:09 -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#1323