microsoft / graphrag

A modular graph-based Retrieval-Augmented Generation (RAG) system
https://microsoft.github.io/graphrag/
MIT License
18.65k stars 1.82k forks source link

[Issue]: <title> ❌ create_base_entity_graph solution | 按照graphrag最后一步create_base_entity_graph失败的解决方案 #951

Closed Mxk-1 closed 2 months ago

Mxk-1 commented 2 months ago

Is there an existing issue for this?

Describe the issue

Many people, including myself, have encountered the ❌ create_base_entity_graph issue. After trying various methods, I finally found a solution. It turns out that this isn't a bug, but rather a matter of balancing model capabilities with the supported max tokens.

很多人遇到了❌ create_base_entity_graph这个问题,包括我在内,尝试了很多方法后,最终得到了解决方案,或者说这并不是一个bug,而是有关模型能力和支持max_token的平衡。

Steps to reproduce

The chunk splitting in the original setting.yaml provided may not be suitable for the model launched with Ollama, as it could be either too large or too small, leading to errors in the model's responses. The original paper mentioned using the GPT-4o model, while the model I deployed locally is Gemma2:9b via Ollama. These two models differ in size and performance.

Additionally, since the pipeline relies on prompt-based Q&A with the text, the prompt itself takes up some of the model's processing length. By adjusting the chunk_size, I was able to successfully run the experiment. If you encounter this issue, try increasing or decreasing the chunk_size. If you have a better solution, feel free to discuss it with me.


原始提供的setting.yaml中chunk的拆分可能并不适合ollama启动的模型,可能过大过小,造成模型回答问题的错误。在原始的paper中提到了使用的模型为gpt4o,我本地部署的模型才用的是ollama方式的gemma2:9b,两个模型大小不同,性能也是不同的。

再结合pipeline过程中依赖于prompt结合text进行问答,prompt会占用模型处理的文本长度,所以我通过调整chunk_size达到了跑通实验的效果。遇到此问题的小伙伴可以尝试,调大或者调小。或者有更好的解决方案,一起讨论。

GraphRAG Config Used

chunks:
  size: 600
  overlap: 150

Logs and screenshots

No response

Additional Information

No response

natoverse commented 2 months ago

Thanks for your contribution! I'll make a note in #657 for folks using Ollama.

night666e commented 2 months ago

这个只能一直试验大小吗,我用的xinference的模型

night666e commented 2 months ago

请问楼主,你是修改提示词后遇到的这个问题吗

wangweizheng22 commented 1 month ago

请问楼主,你是修改提示词后遇到的这个问题吗

我是在修改prompts下的enyity——extraction文件后出现了这个问题,然后重新自动生成索引这个问题依旧存在,请问您的解决了么

Mxk-1 commented 1 month ago

不好意思刚注意到,我没有遇到修改提示词遇到这个问题,因为是中文的数据,所有我将原本的提示词翻译了一下,抽取部分标签维持原样,然后可以运行成功,原本的英文提示词也可以运行成功,我运行成功的时候用的是deepseek的api,本地的话推荐千问一些吧,感觉输出更加可控一些。

Mxk-1 commented 1 month ago

代码是没什么问题的,主要看后台的模型能力。