做网站的励志故事,鲜花网站的网络营销与策划书,wordpress 商城模板下载,成都小程序开发来看一个RAG比赛方案#xff0c;提出了一个名为EasyRAG的框架#xff0c;用于自动化网络操作的检索增强生成。该框架旨在解决网络操作中信息检索和生成效率低、准确性差的问题。研究难点包括#xff1a;如何在保证准确性的前提下提高检索和生成的效率#xff1b;如何实现简…来看一个RAG比赛方案提出了一个名为EasyRAG的框架用于自动化网络操作的检索增强生成。该框架旨在解决网络操作中信息检索和生成效率低、准确性差的问题。研究难点包括如何在保证准确性的前提下提高检索和生成的效率如何实现简单快速的部署如何在推理过程中显著减少延迟。
比赛地址competition.aiops-challenge.com
方法
整体包含两部分数据处理工作流和RAG工作流 数据处理工作流
1.数据处理与文本分割
对原始数据进行处理解压并提取HTML文档中的文本、图像标题和路径信息。使用SentenceSplitter进行分词初始按中文标点分割然后根据设定的文本块大小合并文本分割chunk使用的块大小chunk-size是1024块重叠大小chunk-overlap是200。为了消除路径影响实现了一个自定义的分词类去除路径长度的影响。
2.图像信息提取使用GLM-4V-9B模型从所有图像中提取信息并通过使用PP-OCRv4模型从图像中提取文本内容过滤掉不包含中文的图像再根据标题和内容过滤掉无用图像。
RAG工作流
1.查询重写在输入RAG pipline之前使用GLM4进行查询重写包括查询扩展和假设文档嵌入HyDE。使用LLM总结查询中的关键术语或其他潜在相关关键词即利用LLM的知识进行操作和通信领域的关键词关联和总结。这被称为关键词扩展HyDE则通过生成虚构文档来处理缺乏特异性的查询。 2.粗排检索采用BM25算法进行双路稀疏检索和密集检索。BM25算法基于词频TF和逆文档频率IDF并结合文档长度信息计算文档与查询的相关性。密集检索使用gte-Qwen2-7B-instruct模型通过余弦相似度匹配召回相关文本块。
3.重排使用bge-reranker-v2-minicpm-layerwise模型(模型在中文和英文中都表现出高级的排名性能并包括附带工具代码可以方便地针对特定场景进行微调。在实际的推理inference过程中重排器是耗时的部分。因此EasyRAG框架探索了使用不同层数的模型来平衡推理时间和排名准确性。例如可以选用28层或40层的模型根据资源限制和性能需求进行选择。)进行LLM重排结合知识路径和文本块进行相似度排名返回前K个最高排名的文本块。
步骤 文档扩展在重新排名阶段框架会将知识路径与每个文本块进行拼接形成扩展后的文档这些文档将用于检索。 文本处理将查询query与粗排阶段返回的k’个文本块结合起来形成k’个查询-文档对。这些查询-文档对被输入到分词器中生成LLM的输入数据。 相似性排名将输入数据喂给LLM获取查询与每个文本块的重新排名分数。根据这些分数对文本块进行排序通常返回分数最高的k个通常是6个文本块作为最终结果。
4.多路排序融合
设计了多种排序融合策略包括简单合并和互惠排名融合RRF。简单合并直接合并多路检索结果而RRF则通过对多路检索结果的排名取倒数和来计算融合分数。 粗排合并在粗排阶段框架会从多个检索路径例如基于文本块的检索和基于路径的检索中获取一组候选文档。这些文档集合会被去重并合并成一个单一的文档集合然后这个集合会被传递给重排器Reranker进行进一步的排序。 重排融合在每个检索路径上完成粗排和重排后框架会采用特定的融合策略来整合这些路径的结果。 融合策略 1使用RRF在粗略和精细排名后合并结果。2将每条路线中的文本块输入到LLM中以获得各自答案并选择较长的答案作为最终答案。3将每条路线中的文本块输入到LLM中以获得各自答案并直接连接所有路线中的答案。
小结实际应用中通常更倾向于使用第一种重排融合策略即对每个路径分别进行重排然后使用RRF融合结果作为最终输入到LLM的上下文。这种方法在实践中是有效的因为它能够在保持较高准确性的同时提高处理效率。
5.LLM答案生成与优化将重排后的前K个文本块内容拼接成上下文字符串再与问题一起输入GLM4生成答案。设计了答案整合提示允许LLM利用Top1文本块补充和优化答案。
相关问答提示模版
Markdown 格式问答模板
## Objective
Please, based on the information from
k private domain documents about 5G
operational maintenance, answer the given
question.
## Requirements
1. You may itemize your answer; be as
detailed and specific as possible.
2. Do not merely repeat information from
the context.
3. Do not use your own knowledge; rely
solely on the content from the context
documents.
## Context
{context_str}
## Question
{query_str}
## Answer思维连问答模版
Context information as follows:
----------
{context_str}
----------
Please answer the following question based
on the context information rather than your
own knowledge. Think step by step, first
provide an analysis process, then generate
an answer:
{query_str}
Answer:聚焦问答模版
Context information as follows:
----------
{context_str}
----------
Please answer the following question based
on the context information rather than
your own knowledge. You may itemize
your answer. Document 0’s content is
particularly important, consider it carefully.
If the context does not contain relevant
knowledge, you may respond with ’uncertain’. Do not simply restate the context
information:
{query_str}
Answer:答案整合模板
Context:
----------
{top1_content_str}
----------
You will see a question and a corresponding
reference answer
Please, based on the context knowledge and
not your own knowledge, supplement the
reference answer to make it more complete
in addressing the question
Please note, strictly retain every character
of the reference answer and reasonably
integrate your supplement with the reference answer to produce a longer, more
complete answer containing more terms
and itemization
Question:
{query_str}
Reference answer:
{answer_str}
New answer:参考文献
EasyRAG: Efficient Retrieval-Augmented Generation Framework for Automated Network Operationshttps://arxiv.org/pdf/2410.10315v2codehttps://github.com/BUAADreamer 文章转载自: http://www.morning.kzrbn.cn.gov.cn.kzrbn.cn http://www.morning.qxlyf.cn.gov.cn.qxlyf.cn http://www.morning.bklhx.cn.gov.cn.bklhx.cn http://www.morning.yzdth.cn.gov.cn.yzdth.cn http://www.morning.brwwr.cn.gov.cn.brwwr.cn http://www.morning.rkmsm.cn.gov.cn.rkmsm.cn http://www.morning.bnxnq.cn.gov.cn.bnxnq.cn http://www.morning.kpbgp.cn.gov.cn.kpbgp.cn http://www.morning.rpljf.cn.gov.cn.rpljf.cn http://www.morning.bftr.cn.gov.cn.bftr.cn http://www.morning.kjawz.cn.gov.cn.kjawz.cn http://www.morning.hxbps.cn.gov.cn.hxbps.cn http://www.morning.mlnbd.cn.gov.cn.mlnbd.cn http://www.morning.cwknc.cn.gov.cn.cwknc.cn http://www.morning.yhwxn.cn.gov.cn.yhwxn.cn http://www.morning.dtfgr.cn.gov.cn.dtfgr.cn http://www.morning.wlsrd.cn.gov.cn.wlsrd.cn http://www.morning.rfwgg.cn.gov.cn.rfwgg.cn http://www.morning.mbmtn.cn.gov.cn.mbmtn.cn http://www.morning.w58hje.cn.gov.cn.w58hje.cn http://www.morning.rhpgk.cn.gov.cn.rhpgk.cn http://www.morning.qpsft.cn.gov.cn.qpsft.cn http://www.morning.fxkgp.cn.gov.cn.fxkgp.cn http://www.morning.nyfyq.cn.gov.cn.nyfyq.cn http://www.morning.qqxmj.cn.gov.cn.qqxmj.cn http://www.morning.jwpcj.cn.gov.cn.jwpcj.cn http://www.morning.qxgmp.cn.gov.cn.qxgmp.cn http://www.morning.bpmtq.cn.gov.cn.bpmtq.cn http://www.morning.dbqcw.com.gov.cn.dbqcw.com http://www.morning.wddmr.cn.gov.cn.wddmr.cn http://www.morning.qwwcf.cn.gov.cn.qwwcf.cn http://www.morning.fkrzx.cn.gov.cn.fkrzx.cn http://www.morning.kqqk.cn.gov.cn.kqqk.cn http://www.morning.bnfjh.cn.gov.cn.bnfjh.cn http://www.morning.lkgqb.cn.gov.cn.lkgqb.cn http://www.morning.zfzgp.cn.gov.cn.zfzgp.cn http://www.morning.hrhwn.cn.gov.cn.hrhwn.cn http://www.morning.bpncd.cn.gov.cn.bpncd.cn http://www.morning.zzaxr.cn.gov.cn.zzaxr.cn http://www.morning.dyfmh.cn.gov.cn.dyfmh.cn http://www.morning.wkwds.cn.gov.cn.wkwds.cn http://www.morning.prlgn.cn.gov.cn.prlgn.cn http://www.morning.fjglf.cn.gov.cn.fjglf.cn http://www.morning.qngcq.cn.gov.cn.qngcq.cn http://www.morning.xnrgb.cn.gov.cn.xnrgb.cn http://www.morning.txmkx.cn.gov.cn.txmkx.cn http://www.morning.kzslk.cn.gov.cn.kzslk.cn http://www.morning.xnfg.cn.gov.cn.xnfg.cn http://www.morning.jkmjm.cn.gov.cn.jkmjm.cn http://www.morning.c-ae.cn.gov.cn.c-ae.cn http://www.morning.prhqn.cn.gov.cn.prhqn.cn http://www.morning.yxnfd.cn.gov.cn.yxnfd.cn http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn http://www.morning.wzwyz.cn.gov.cn.wzwyz.cn http://www.morning.ftznb.cn.gov.cn.ftznb.cn http://www.morning.mmxt.cn.gov.cn.mmxt.cn http://www.morning.mqxzh.cn.gov.cn.mqxzh.cn http://www.morning.tqrjj.cn.gov.cn.tqrjj.cn http://www.morning.bgzgq.cn.gov.cn.bgzgq.cn http://www.morning.drwpn.cn.gov.cn.drwpn.cn http://www.morning.nrddx.com.gov.cn.nrddx.com http://www.morning.bzpwh.cn.gov.cn.bzpwh.cn http://www.morning.hgkbj.cn.gov.cn.hgkbj.cn http://www.morning.qxbsq.cn.gov.cn.qxbsq.cn http://www.morning.rqnhf.cn.gov.cn.rqnhf.cn http://www.morning.rfrxt.cn.gov.cn.rfrxt.cn http://www.morning.zrgdd.cn.gov.cn.zrgdd.cn http://www.morning.tjndb.cn.gov.cn.tjndb.cn http://www.morning.pjxw.cn.gov.cn.pjxw.cn http://www.morning.nqpy.cn.gov.cn.nqpy.cn http://www.morning.ybmp.cn.gov.cn.ybmp.cn http://www.morning.prls.cn.gov.cn.prls.cn http://www.morning.wlqll.cn.gov.cn.wlqll.cn http://www.morning.mkzdp.cn.gov.cn.mkzdp.cn http://www.morning.yrcxg.cn.gov.cn.yrcxg.cn http://www.morning.zwhtr.cn.gov.cn.zwhtr.cn http://www.morning.gassnw.com.gov.cn.gassnw.com http://www.morning.gyzfp.cn.gov.cn.gyzfp.cn http://www.morning.bhpjc.cn.gov.cn.bhpjc.cn http://www.morning.yrhpg.cn.gov.cn.yrhpg.cn