Replies: 2 comments 4 replies
-
|
Hi @TimD3! I'm Dosu and I’m helping the ragflow team. This is expected behavior in Ragflow and comes down to how retrieval scoring and filtering work. Ragflow always searches all enabled chunks, but the chunks returned depend on the hybrid similarity score, which combines weighted keyword similarity, vector similarity, and a rank feature (like pagerank or tag features). The default weights and the similarity threshold can cause some chunks to be excluded even if they have a high raw similarity in isolation. When you enable only one file, the system scores just those chunks, so your target chunk stands out and passes the threshold. When you enable all files, the retrieval process ranks all chunks and only returns those above the threshold or within the top-N (default is 8 or 10). If your target chunk's hybrid score is just below the threshold or not in the top-N, it won't appear—even if its raw similarity is high in isolation. Small changes in threshold or weights can cause borderline chunks to be included or excluded, which explains the behavior you see. Also, the rank feature can lower the final score for some chunks, so a chunk with a high raw similarity might still lose out if its rank feature is low or if the weights favor another component source source. To get more consistent results, try lowering the similarity threshold, increasing the top-N parameter, or adjusting the keyword/vector weights. Make sure your preprocessing is consistent between queries and stored chunks. If you want to guarantee retrieval of a specific chunk, set a higher threshold or filter more aggressively source source. There was also a recent bug fix in the retrieval component (merged 2025-12-26), so if you're running an older version, consider updating source. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
hi there @TimD3 ! while this does seem pretty weird at first, it’s actually pretty normal. essentially this is how ragflow works:
when you remove all other chunks from you dataset, you are essentially reducing the initial search space for the ann algorithm, making the correct chunk more 'reachable'. this time, there is only 1 data chunk to calculate the distance metric w.r.t the query. ann is now forced to shortlist the only available chunk for data retrieval, which is why you get the correct answer. like you mentioned, all other chunks have similarity < 0.6. hence when you increase the similarity threshold to 0.6, the first shortlisted set of chunks is no more eligible for data retrieval. the ann moves to shortlist a new set, that subsequently includes the correct chunk this time. although increasing the similarity threshold did give you the required answer for 1 query, it worsens the overall performance for obvious reasons. remember that all LLMs and RAG algorithms dont really 'understand' your query. at the end of the day, they only represent words in vectors, calculate the similarity of those vectors, and get you the answer. if your query isnt specific enough or lacks necessary keywords, you will always get vague answers. do let me know if you have any more doubts! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Im playing around with Ragflow and noticed a behaviour that appears odd to me. I have setup a dataset from crawled webpages, converted to markdown format and am using a basic configuration. Mostly everything default + a few auto keywords and autoquestions. When doing retrieval testing there is one query where I had trouble to get it to retrieve the correct chunk.
I wanted to see what the similarity for that chunk is, thus I disabled all files except for the file that contained the target chunk and redid the retrieval test. Turns out the similarity was actually quite high (69.24). However when I reactivate all files in the dataset and perform the same retrieval test, not only does it not find the correct chunk, all the chunks it does show me have similarity scores lower than 69.24, ranging from 57 to 50 or so.
I can get similar behaviour by increasing the similarity threshold value. E.g. at 0.2 it only finds the incorrect chunks with similarity scores lower than 60 but if I set similarity threshold to 0.6 it does manage to find the correct chunk and only this one.
This is counterintuitive to me. Is this expected behaviour, does Ragflow somehow not always search through all chunks in a dataset or is there something else I am missing? I do not use any advanced features such as RAPTOR, knowledge graphs, a reranking model etc
Beta Was this translation helpful? Give feedback.
All reactions