PaperAgent 2024年11月06日
你要的增量更新来了:微软GraphRAG 0.4.0
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

微软GraphRAG发布v0.4.0,带来两项重要更新:添加增量索引及DRIFT图推理查询模块。还介绍了增量更新的核心部分及数据框架输出的更新,以及DRIFT搜索的原理和三个核心阶段。

🎉微软GraphRAG发布v0.4.0,获大量关注

💻添加增量索引,包括更新索引逻辑等

🚀DRIFT图推理查询,分三个核心阶段

📊更新数据框架输出,涉及多种数据处理

2024-11-06 12:33 湖北

微软GraphRAG自发布以来,引起了很大关注(目前18.7k star),但是一些功能却迟迟没有,比如增量更新。今天微软GraphRAG发布v0.4.0,3小时前,还是新鲜热乎的,带来两项重要更新:

增量更新索引逻辑

增量更新逻辑代码在这https://www.microsoft.com/en-us/research/blog/introducing-drift-search-combining-global-and-local-search-methods-to-improve-quality-and-efficiency/

获取数据变化:get_delta_docs函数用于比较输入数据集和存储中的最终文档,识别出新增和删除的文档。这是增量更新的核心部分,只有变化的部分会被进一步处理。

async def get_delta_docs(    input_dataset: pd.DataFrame, storage: PipelineStorage) -> InputDelta:    """Get the delta between the input dataset and the final documents.
Parameters ---------- input_dataset : pd.DataFrame The input dataset. storage : PipelineStorage The Pipeline storage.
Returns ------- InputDelta The input delta. With new inputs and deleted inputs. """ final_docs = await _load_table_from_storage( "create_final_documents.parquet", storage )
# Select distinct title from final docs and from dataset previous_docs: list[str] = final_docs["title"].unique().tolist() dataset_docs: list[str] = input_dataset["title"].unique().tolist()
# Get the new documents (using loc to ensure DataFrame) new_docs = input_dataset.loc[~input_dataset["title"].isin(previous_docs)]
# Get the deleted documents (again using loc to ensure DataFrame) deleted_docs = final_docs.loc[~final_docs["title"].isin(dataset_docs)]
    return InputDelta(new_docs, deleted_docs)


更新数据框架输出:update_dataframe_outputs函数负责更新各种数据框架,包括实体、关系、文本单元、协变量、节点和社区。这个函数会调用其他函数来处理这些更新。

async def update_dataframe_outputs(    dataframe_dict: dict[str, pd.DataFrame],    storage: PipelineStorage,    update_storage: PipelineStorage,    config: PipelineConfig,    cache: PipelineCache,    callbacks: VerbCallbacks,    progress_reporter: ProgressReporter,) -> None:    """Update the mergeable outputs.
Parameters ---------- dataframe_dict : dict[str, pd.DataFrame] The dictionary of dataframes. storage : PipelineStorage The storage used to store the dataframes. """ progress_reporter.info("Updating Final Documents") final_documents_df = await _concat_dataframes( "create_final_documents", dataframe_dict, storage, update_storage )
# Update entities and merge them progress_reporter.info("Updating Final Entities") merged_entities_df, entity_id_mapping = await _update_entities( dataframe_dict, storage, update_storage, config, cache, callbacks )
# Update relationships with the entities id mapping progress_reporter.info("Updating Final Relationships") merged_relationships_df = await _update_relationships( dataframe_dict, storage, update_storage    )

DRIFT图推理查询逻辑

DRIFT搜索原理:https://www.microsoft.com/en-us/research/blog/introducing-drift-search-combining-global-and-local-search-methods-to-improve-quality-and-efficiency/

DRIFT搜索层级的全景,突出了DRIFT搜索过程的三个核心阶段。A(预处理):DRIFT将用户查询与最语义相关的前K个社区报告进行比较,生成一个广泛的初始答案和后续问题,以引导进一步的探索。B(后续):DRIFT使用局部搜索来细化查询,产生额外的中间答案和后续问题,增强了具体性,引导引擎朝向内容丰富的信息。图中每个节点上的一个符号显示了算法继续查询扩展步骤的信心。C(输出层级):最终输出是一个按相关性排名的问题和答案的层级结构,反映了全局洞察和局部细化的平衡混合,使结果具有适应性和可理解性。


推荐阅读


欢迎关注我的公众号“PaperAgent”,每天一篇大模型(LLM)文章来锻炼我们的思维,简单的例子,不简单的方法,提升自己。

跳转微信打开

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

微软GraphRAG 增量索引 DRIFT图推理 数据框架更新
相关文章