CN117076607A - Method, device and query system for establishing logical expressions using large language models - Google Patents

Method, device and query system for establishing logical expressions using large language models Download PDF

Info

Publication number
CN117076607A
CN117076607A CN202311078223.5A CN202311078223A CN117076607A CN 117076607 A CN117076607 A CN 117076607A CN 202311078223 A CN202311078223 A CN 202311078223A CN 117076607 A CN117076607 A CN 117076607A
Authority
CN
China
Prior art keywords
model
training
fine
natural language
expression
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311078223.5A
Other languages
Chinese (zh)
Inventor
杨喆
李全忠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Puqiang Times Zhuhai Hengqin Information Technology Co ltd
Original Assignee
Puqiang Times Zhuhai Hengqin Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Puqiang Times Zhuhai Hengqin Information Technology Co ltd filed Critical Puqiang Times Zhuhai Hengqin Information Technology Co ltd
Priority to CN202311078223.5A priority Critical patent/CN117076607A/en
Publication of CN117076607A publication Critical patent/CN117076607A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3322Query formulation using system suggestions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • G06F16/355Creation or modification of classes or clusters
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Physics (AREA)
  • Machine Translation (AREA)

Abstract

本公开提供了一种大语言模型用于建立逻辑表达式的方法、装置及查询系统,涉及自然语言处理技术领域,其包括:检测大语言模型的训练类型;若训练类型为已完成继续训练,则向大语言模型输入描述逻辑表达式的自然语言文本,并获得大语言模型输出的自然语言文本对应的逻辑表达式;继续训练包括对根据大语言模型得到的微调模型以及奖励模型进行强化学习,其中微调模型用于生成预测表达式,奖励模型用于对预测表达式进行评分,以更新微调模型的参数。采用本公开中建立逻辑表达式的方法,能够自动获得自然语言文本对应的逻辑表达式,高效便捷,极大地提高了处理效率,同时无需人工参与,大幅降低了人力成本。

The present disclosure provides a method, device and query system for establishing logical expressions using a large language model, and relates to the technical field of natural language processing. It includes: detecting the training type of the large language model; if the training type is completed, continue training, Then input the natural language text describing the logical expression to the large language model, and obtain the logical expression corresponding to the natural language text output by the large language model; continued training includes strengthening learning of the fine-tuning model and reward model obtained based on the large language model, The fine-tuning model is used to generate predictive expressions, and the reward model is used to score the predictive expressions to update the parameters of the fine-tuning model. Using the method of establishing logical expressions in this disclosure, the logical expression corresponding to the natural language text can be automatically obtained, which is efficient and convenient, greatly improving the processing efficiency, and at the same time, no manual participation is required, which greatly reduces the labor cost.

Description

大语言模型用于建立逻辑表达式的方法、装置及查询系统Method, device and query system for establishing logical expressions using large language models

技术领域Technical field

本公开一般涉及自然语言处理技术领域,具体涉及一种大语言模型用于建立逻辑表达式的方法、装置及查询系统。The present disclosure generally relates to the technical field of natural language processing, and specifically relates to a method, device and query system for establishing logical expressions using a large language model.

背景技术Background technique

随着电子信息化的不断发展,在银行和保险等领域中产生了海量录音数据,这些录音数据包含属性、业务维度与数据时间等结构化信息以及通话录音与语音识别文本等非结构化信息。With the continuous development of electronic informatization, massive recording data has been generated in fields such as banking and insurance. These recording data include structured information such as attributes, business dimensions, and data time, as well as unstructured information such as call recordings and speech recognition texts.

企业对非结构化语音与文本内容进行分析的业务场景众多,例如包括投诉原因分析、成交单分析、来电原因分析和坐席违规分析等。目前,相关技术通过人工建立语义标签的逻辑表达式,例如问候语可以用逻辑表达式“你好or您好”表示,再将其转换为全文检索引擎输入,通过全文检索引擎检出匹配的索引,并输出结构化的语义标签。There are many business scenarios for enterprises to analyze unstructured voice and text content, such as complaint cause analysis, transaction order analysis, call reason analysis, and agent violation analysis. At present, related technologies manually establish logical expressions of semantic tags. For example, a greeting can be represented by a logical expression "hello or hello", which is then converted into a full-text search engine input, and the matching index is detected through the full-text search engine. , and output structured semantic tags.

然而,不同逻辑表达式语法复杂且形式多样,这给业务人员带来了较大的学习成本,同时人工建立逻辑表达式需要耗费大量人力来阅读文本,总结规则后再建立逻辑表达式,尤其是在复杂业务场景下,人工建立的逻辑表达式往往难以覆盖全部业务场景,导致召回率低。However, the syntax of different logical expressions is complex and diverse, which brings great learning costs to business personnel. At the same time, manually establishing logical expressions requires a lot of manpower to read the text, summarize the rules, and then create logical expressions, especially In complex business scenarios, manually created logical expressions often cannot cover all business scenarios, resulting in a low recall rate.

发明内容Contents of the invention

鉴于相关技术中的上述缺陷或不足,期望提供一种大语言模型用于建立逻辑表达式的方法、装置及查询系统,能够自动获得逻辑表达式,提高处理效率,同时降低人力成本。In view of the above defects or shortcomings in related technologies, it is expected to provide a method, device and query system for establishing logical expressions using a large language model, which can automatically obtain logical expressions, improve processing efficiency, and reduce labor costs at the same time.

第一方面,本公开提供一种大语言模型用于建立逻辑表达式的方法,所述方法包括:In a first aspect, the present disclosure provides a method for establishing logical expressions using a large language model. The method includes:

检测大语言模型的训练类型;Detect the training type of large language models;

若所述训练类型为已完成继续训练,则向所述大语言模型输入描述逻辑表达式的自然语言文本,并获得所述大语言模型输出的所述自然语言文本对应的逻辑表达式;所述继续训练包括对根据所述大语言模型得到的微调模型以及奖励模型进行强化学习,其中所述微调模型用于生成预测表达式,所述奖励模型用于对所述预测表达式进行评分,以更新所述微调模型的参数。If the training type is Completed and Continued Training, then input the natural language text describing the logical expression to the large language model, and obtain the logical expression corresponding to the natural language text output by the large language model; Continuing training includes performing reinforcement learning on the fine-tuned model obtained according to the large language model and the reward model, wherein the fine-tuned model is used to generate a predictive expression, and the reward model is used to score the predicted expression to update The parameters of the fine-tuned model.

可选地,在本公开一些实施例中,所述微调模型根据人工标注数据,对所述大语言模型进行微调训练获得,所述人工标注数据包括自然语言与逻辑表达式的映射关系。Optionally, in some embodiments of the present disclosure, the fine-tuning model is obtained by fine-tuning the large language model based on manual annotation data, where the artificial annotation data includes a mapping relationship between natural language and logical expressions.

可选地,在本公开一些实施例中,所述奖励模型通过对所述预测表达式的人工评分排序结果进行训练获得。Optionally, in some embodiments of the present disclosure, the reward model is obtained by training the results of manual scoring and sorting of the prediction expression.

可选地,在本公开一些实施例中,所述方法还包括:Optionally, in some embodiments of the present disclosure, the method further includes:

若所述训练类型为未完成继续训练,则向所述大语言模型提供自然语言转化为逻辑表达式的示例,之后输入所述自然语言文本,以获得所述自然语言文本对应的逻辑表达式。If the training type is to continue training without completion, an example of converting natural language into a logical expression is provided to the large language model, and then the natural language text is input to obtain the logical expression corresponding to the natural language text.

可选地,在本公开一些实施例中,所述大语言模型的输出格式包括json格式、xml格式、yaml格式或者字段名称。Optionally, in some embodiments of the present disclosure, the output format of the large language model includes json format, xml format, yaml format or field names.

第二方面,本公开提供一种大语言模型用于建立逻辑表达式的装置,所述装置包括:In a second aspect, the present disclosure provides a device for establishing logical expressions using a large language model. The device includes:

检测模块,用于检测大语言模型的训练类型;Detection module, used to detect the training type of large language models;

建立模块,用于若所述训练类型为已完成继续训练,则向所述大语言模型输入描述逻辑表达式的自然语言文本,并获得所述大语言模型输出的所述自然语言文本对应的逻辑表达式;所述继续训练包括对根据所述大语言模型得到的微调模型以及奖励模型进行强化学习,其中所述微调模型用于生成预测表达式,所述奖励模型用于对所述预测表达式进行评分,以更新所述微调模型的参数。Establish a module, configured to input a natural language text describing a logical expression to the large language model if the training type is completed and continue training, and obtain the logic corresponding to the natural language text output by the large language model. Expression; the continued training includes performing reinforcement learning on the fine-tuning model and the reward model obtained according to the large language model, wherein the fine-tuning model is used to generate a predictive expression, and the reward model is used to generate the predictive expression. Scoring is performed to update the parameters of the fine-tuned model.

可选地,在本公开一些实施例中,所述微调模型根据人工标注数据,对所述大语言模型进行微调训练获得,所述人工标注数据包括自然语言与逻辑表达式的映射关系。Optionally, in some embodiments of the present disclosure, the fine-tuning model is obtained by fine-tuning the large language model based on manual annotation data, where the artificial annotation data includes a mapping relationship between natural language and logical expressions.

可选地,在本公开一些实施例中,所述奖励模型通过对所述预测表达式的人工评分排序结果进行训练获得。Optionally, in some embodiments of the present disclosure, the reward model is obtained by training the results of manual scoring and sorting of the prediction expression.

可选地,在本公开一些实施例中,所述建立模块还用于若所述训练类型为未完成继续训练,则向所述大语言模型提供自然语言转化为逻辑表达式的示例,之后输入所述自然语言文本,以获得所述自然语言文本对应的逻辑表达式。Optionally, in some embodiments of the present disclosure, the establishment module is also configured to provide the large language model with an example of converting natural language into a logical expression if the training type is incomplete and continue training, and then input The natural language text is used to obtain the logical expression corresponding to the natural language text.

第三方面,本公开提供一种查询系统,所述查询系统的逻辑表达式通过第一方面中任意一项所述的建立逻辑表达式的方法获得。In a third aspect, the present disclosure provides a query system. The logical expression of the query system is obtained by the method of establishing a logical expression described in any one of the first aspects.

从以上技术方案可以看出,本公开实施例具有以下优点:It can be seen from the above technical solutions that the embodiments of the present disclosure have the following advantages:

本公开实施例提供了一种大语言模型用于建立逻辑表达式的方法、装置及查询系统,通过对大语言模型进行继续训练,使其预测结果更加精准,进而将描述逻辑表达式的自然语言文本输入至该大语言模型,能够自动获得自然语言文本对应的逻辑表达式,高效便捷,极大地提高了处理效率,同时无需人工参与,大幅降低了人力成本。Embodiments of the present disclosure provide a method, device and query system for using a large language model to create logical expressions. By continuing to train the large language model, its prediction results can be more accurate, thereby converting the natural language describing the logical expression into When text is input into this large language model, the logical expression corresponding to the natural language text can be automatically obtained, which is efficient and convenient, greatly improving the processing efficiency, and at the same time, no manual participation is required, which greatly reduces labor costs.

附图说明Description of the drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本公开的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present disclosure will become more apparent upon reading the detailed description of the non-limiting embodiments with reference to the following drawings:

图1为本公开实施例提供的一种大语言模型用于建立逻辑表达式的方法的流程示意图;Figure 1 is a schematic flowchart of a method for establishing logical expressions using a large language model according to an embodiment of the present disclosure;

图2为本公开实施例提供的一种大语言模型进行继续训练的流程示意图;Figure 2 is a schematic flow chart of continued training of a large language model provided by an embodiment of the present disclosure;

图3为本公开实施例提供的一种大语言模型用于建立逻辑表达式的装置的结构框图。FIG. 3 is a structural block diagram of a device for establishing logical expressions in a large language model provided by an embodiment of the present disclosure.

具体实施方式Detailed ways

为了使本技术领域的人员更好地理解本公开方案,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本公开保护的范围。In order to enable those skilled in the art to better understand the present disclosure, the following will clearly and completely describe the technical solutions in the present disclosure embodiments in conjunction with the accompanying drawings. Obviously, the described embodiments are only These are some embodiments of the present disclosure, but not all embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of this disclosure.

本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。The terms "first", "second", "third", "fourth", etc. (if present) in the description and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects without necessarily using Used to describe a specific order or sequence. It is to be understood that the figures so used are interchangeable under appropriate circumstances so that the described embodiments of the present disclosure can be practiced in sequences other than those illustrated or described herein.

此外,术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或模块的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或模块,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或模块。In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or modules and need not be limited to those explicitly listed. Those steps or modules may instead include other steps or modules not expressly listed or inherent to the processes, methods, products or devices.

需要说明的是,在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。为便于更好地理解本公开实施例,下面通过图1至图3详细地阐述本公开实施例提供的大语言模型用于建立逻辑表达式的方法、装置及查询系统。It should be noted that, as long as there is no conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other. In order to facilitate a better understanding of the embodiments of the present disclosure, the method, device and query system for establishing logical expressions using the large language model provided by the embodiments of the present disclosure are explained in detail below through FIGS. 1 to 3 .

请参考图1,其为本公开实施例提供的一种大语言模型用于建立逻辑表达式的方法的流程示意图。该方法具体包括以下步骤:Please refer to FIG. 1 , which is a schematic flowchart of a method for establishing logical expressions using a large language model according to an embodiment of the present disclosure. The method specifically includes the following steps:

S101,检测大语言模型的训练类型。S101, detect the training type of the large language model.

需要说明的是,本公开实施例中大语言模型(Large Language Models,LLM)是指在大规模文本语料上进行训练,包含百亿级别(或者更多)参数的语言模型,例如大语言模型可以包括但不限于GPT-3、PaLM和LLaMA等。虽然现有大语言模型在通用领域的文本生成能力很强,但对于特定领域和特定任务,尤其是在通用语料中数据很少的情况下,性能还是有所欠缺。因此,本公开实施例利用搜集到的领域数据和人工标注数据,对大语言模型进行继续训练,能够增强该大语言模型在相关业务领域下的自然语言转化为逻辑表达式的能力,其中逻辑表达式是指有固定语法,一般由关键词、保留字和逻辑关系(例如,与、或、非)所组成的表达式,可以用于描述某个文档的结构化和非结构化特征。It should be noted that in the embodiment of the present disclosure, large language models (Large Language Models, LLM) refer to language models that are trained on large-scale text corpus and contain tens of billions of parameters (or more). For example, large language models can Including but not limited to GPT-3, PaLM, LLaMA, etc. Although existing large language models have strong text generation capabilities in general fields, their performance is still lacking for specific fields and specific tasks, especially when there is little data in the general corpus. Therefore, the embodiments of the present disclosure use the collected domain data and manual annotation data to continue training the large language model, which can enhance the ability of the large language model to convert natural language into logical expressions in relevant business fields, where the logical expression An expression refers to an expression that has a fixed syntax and is generally composed of keywords, reserved words and logical relationships (for example, AND, OR, NOT). It can be used to describe the structured and unstructured features of a document.

S102,若训练类型为已完成继续训练,则向大语言模型输入描述逻辑表达式的自然语言文本,并获得大语言模型输出的自然语言文本对应的逻辑表达式。S102, if the training type is Completed and Continued Training, input the natural language text describing the logical expression to the large language model, and obtain the logical expression corresponding to the natural language text output by the large language model.

需要说明的是,继续训练包括但不限于对根据大语言模型得到的微调模型以及奖励模型进行强化学习(Reinforcement Learning,RL),强化学习又称再励学习、评价学习或者增强学习,是机器学习的范式和方法论之一,用于描述和解决智能体(agent)在与环境的交互过程中,通过学习策略以达成回报最大化或者实现特定目标的问题。其中,微调模型用于生成预测表达式,奖励模型用于对预测表达式进行评分,以更新微调模型的参数。It should be noted that continued training includes but is not limited to reinforcement learning (Reinforcement Learning, RL) on fine-tuned models and reward models obtained based on large language models. Reinforcement learning is also called reinforcement learning, evaluation learning or reinforcement learning. It is a machine learning It is one of the paradigms and methodologies used to describe and solve problems in which an agent learns strategies to maximize returns or achieve specific goals during its interaction with the environment. Among them, the fine-tuning model is used to generate prediction expressions, and the reward model is used to score the prediction expressions to update the parameters of the fine-tuning model.

示例性地,如图2所示,本公开实施例利用人工标注数据,对大语言模型进行微调训练获得微调模型Model 1,该人工标注数据可以包括自然语言与逻辑表达式的映射关系,即(自然语言-逻辑表达式)对,从而使微调模型具有初步的自然语言转化为逻辑表达式的能力。Illustratively, as shown in Figure 2, the embodiment of the present disclosure uses manual annotation data to perform fine-tuning training on a large language model to obtain fine-tuning model Model 1. The artificial annotation data may include the mapping relationship between natural language and logical expressions, that is, ( Natural language-logical expression) pairs, so that the fine-tuning model has the preliminary ability to convert natural language into logical expressions.

例如,自然语言[对应预测阶段的提示语(prompt)]:查询2022年3月1日到2023年5月1日武汉职场坐席没有向客户问好的文本。For example, natural language [prompt corresponding to the prediction stage]: Query the text of Wuhan workplace agents who did not say hello to customers from March 1, 2022 to May 1, 2023.

逻辑表达式[对应预测阶段的期望输出]:Logical expression [corresponding to the expected output of the prediction phase]:

可以理解的是,此处大语言模型的输出格式为json格式仅用于示例。实际上,根据不同逻辑表达式系统的需求,大语言模型的输出格式还可以为xml格式、yaml格式或者字段名称等。It is understandable that the output format of the large language model here is json format only for example. In fact, according to the needs of different logical expression systems, the output format of the large language model can also be xml format, yaml format or field name, etc.

进一步地,本公开实施例还可以再搜集一批自然语言,并使用微调模型来生成对应的预测表达式。之后,通过人工进行评分,评分越高,表明模型所生成的预测表达式质量越高,此时利用评分排序结果训练一个奖励模型(Reward Model),该奖励模型是一个单独的分类模型,即用于判定两个模型生成的预测表达式哪个更好,其可以基于微调模型或者一个全新的大语言模型训练得到。Furthermore, embodiments of the present disclosure can also collect a batch of natural languages and use fine-tuning models to generate corresponding prediction expressions. Afterwards, manual scoring is performed. The higher the score, the higher the quality of the prediction expression generated by the model. At this time, a reward model (Reward Model) is trained using the score ranking results. The reward model is a separate classification model, that is, using To determine which predictive expression generated by two models is better, it can be trained based on a fine-tuned model or a new large language model.

进一步地,本公开实施例采用强化学习来增强微调模型,这个阶段无需人工标注数据,即利用上个阶段学习好的奖励模型,并通过强化学习方法来更新微调模型的参数。最终,重复评分过程以及强化学习过程,直至模型的生成效果达到预期,获得已完成继续训练的大语言模型,称之为Text2Query模型。Furthermore, the embodiments of the present disclosure use reinforcement learning to enhance the fine-tuning model. This stage does not require manual labeling of data, that is, the reward model learned in the previous stage is used, and the parameters of the fine-tuning model are updated through the reinforcement learning method. Finally, the scoring process and reinforcement learning process are repeated until the model generation effect reaches the expectation, and a large language model that has completed continued training is obtained, which is called the Text2Query model.

实际使用时,如果大语言模型经过继续训练,则直接根据业务需求,向该大语言模型输入描述逻辑表达式的自然语言文本,例如输入为“你是一个自然语言转化为逻辑表达式机器人,帮我将下列文本转化为逻辑表达式:查询2022年3月1日到2023年5月1日武汉职场坐席没有向客户问好的文本”,此时模型输出即为对应的逻辑表达式。In actual use, if the large language model continues to be trained, the natural language text describing the logical expression is directly input to the large language model according to the business needs. For example, the input is "You are a natural language-to-logical expression robot that helps you." I converted the following text into a logical expression: Query the text "Wuhan workplace agents did not say hello to customers from March 1, 2022 to May 1, 2023". At this time, the model output is the corresponding logical expression.

而如果大语言模型未经过继续训练,即S103,训练类型为未完成继续训练,则向该大语言模型提供自然语言转化为逻辑表达式的示例,这样设置的好处是在精度要求不高、标注数据难以获取的场景下,能够利用大语言模型的上下文学习(In Context Learning,ICL)能力进行快速学习,同时节省算力,满足了多样化的使用需求。例如,示例为:你是一个自然语言转化为逻辑表达式机器人,可以将类似“查询2022年3月1日到2023年5月1日武汉职场坐席没有向客户问好的文本”的自然语言文本转化为下面的逻辑表达式:“{If the large language model has not been continuously trained, that is, S103, and the training type is incomplete continued training, then the large language model will be provided with examples of natural language converted into logical expressions. The advantage of this setting is that the accuracy requirements are not high and the labeling In scenarios where data is difficult to obtain, the In Context Learning (ICL) capability of large language models can be used for rapid learning, while saving computing power and meeting diversified usage needs. For example, the example is: You are a natural language into logical expression robot, which can convert natural language text like "Query the text that Wuhan workplace agents did not say hello to customers from March 1, 2022 to May 1, 2023" For the following logical expression: "{

之后,向该大语言模型输入自然语言文本,以获得自然语言文本对应的逻辑表达式。例如,输入的自然语言文本为:当自然语言描述为“查询2022年3月1日到2023年5月1日北京职场坐席没有向客户道别的文本”,应该输出的逻辑表达式是?Afterwards, the natural language text is input into the large language model to obtain the logical expression corresponding to the natural language text. For example, the input natural language text is: When the natural language description is "Query the text of Beijing workplace agents who did not say goodbye to customers from March 1, 2022 to May 1, 2023", what is the logical expression that should be output?

此时,本公开实施例期望该大语言模型的输出为:At this time, the embodiment of the present disclosure expects the output of the large language model to be:

本公开实施例提供的大语言模型用于建立逻辑表达式的方法,通过对大语言模型进行继续训练,使其预测结果更加精准,进而将描述逻辑表达式的自然语言文本输入至该大语言模型,能够自动获得自然语言文本对应的逻辑表达式,高效便捷,极大地提高了处理效率,同时无需人工参与,大幅降低了人力成本。The large language model provided by the embodiments of the present disclosure is used to create a method for logical expressions. By continuing to train the large language model, its prediction results are more accurate, and then the natural language text describing the logical expression is input into the large language model. , can automatically obtain the logical expression corresponding to the natural language text, which is efficient and convenient, greatly improving the processing efficiency, and at the same time, no manual participation is required, which greatly reduces the labor cost.

基于前述实施例,本公开实施例提供一种大语言模型用于建立逻辑表达式的装置。该大语言模型用于建立逻辑表达式的装置100可以应用于图1~图2对应实施例的大语言模型用于建立逻辑表达式的方法中。请参考图3,该大语言模型用于建立逻辑表达式的装置100包括:Based on the foregoing embodiments, embodiments of the present disclosure provide a device for establishing logical expressions using a large language model. The apparatus 100 for establishing a logical expression using a large language model can be applied to the method for establishing a logical expression using a large language model in the corresponding embodiment of FIGS. 1 to 2 . Please refer to Figure 3. The device 100 of the large language model for establishing logical expressions includes:

检测模块101,用于检测大语言模型的训练类型;The detection module 101 is used to detect the training type of the large language model;

建立模块102,用于若训练类型为已完成继续训练,则向大语言模型输入描述逻辑表达式的自然语言文本,并获得大语言模型输出的自然语言文本对应的逻辑表达式;继续训练包括对根据大语言模型得到的微调模型以及奖励模型进行强化学习,其中微调模型用于生成预测表达式,奖励模型用于对预测表达式进行评分,以更新微调模型的参数。The establishment module 102 is used to input natural language text describing logical expressions to the large language model if the training type is completed and continue training, and obtain the logical expression corresponding to the natural language text output by the large language model; continuing training includes Reinforcement learning is performed based on the fine-tuning model and reward model obtained from the large language model, where the fine-tuning model is used to generate predictive expressions, and the reward model is used to score the predictive expression to update the parameters of the fine-tuning model.

可选地,本公开一些实施例中微调模型根据人工标注数据,对大语言模型进行微调训练获得,人工标注数据包括自然语言与逻辑表达式的映射关系。Optionally, in some embodiments of the present disclosure, the fine-tuning model is obtained by fine-tuning and training the large language model based on manual annotation data, where the artificial annotation data includes the mapping relationship between natural language and logical expressions.

可选地,本公开一些实施例中奖励模型通过对预测表达式的人工评分排序结果进行训练获得。Optionally, in some embodiments of the present disclosure, the reward model is obtained by training the results of manual scoring and sorting of predictive expressions.

可选地,本公开一些实施例中建立模块102还用于若训练类型为未完成继续训练,则向大语言模型提供自然语言转化为逻辑表达式的示例,之后输入自然语言文本,以获得自然语言文本对应的逻辑表达式。Optionally, in some embodiments of the present disclosure, the establishment module 102 is also used to provide the large language model with examples of converting natural language into logical expressions if the training type is to continue training without completion, and then input the natural language text to obtain the natural language model. The logical expression corresponding to the language text.

可选地,本公开一些实施例中大语言模型的输出格式包括json格式、xml格式、yaml格式或者字段名称。Optionally, the output format of the large language model in some embodiments of the present disclosure includes json format, xml format, yaml format or field names.

需要说明的是,本实施例中与其它实施例中相同步骤和相同内容的说明,可以参照其它实施例中的描述,此处不再赘述。It should be noted that for descriptions of the same steps and content in this embodiment as in other embodiments, reference may be made to the descriptions in other embodiments, and will not be described again here.

本公开实施例提供的大语言模型用于建立逻辑表达式的装置,通过对大语言模型进行继续训练,使其预测结果更加精准,进而将描述逻辑表达式的自然语言文本输入至该大语言模型,能够自动获得自然语言文本对应的逻辑表达式,高效便捷,极大地提高了处理效率,同时无需人工参与,大幅降低了人力成本。The large language model provided by the embodiment of the present disclosure is a device for establishing logical expressions. By continuing to train the large language model, its prediction results are more accurate, and then the natural language text describing the logical expression is input into the large language model. , can automatically obtain the logical expression corresponding to the natural language text, which is efficient and convenient, greatly improving the processing efficiency, and at the same time, no manual participation is required, which greatly reduces the labor cost.

基于前述实施例,本公开实施例提供一种查询系统,该查询系统的逻辑表达式通过图1~图2对应实施例的建立逻辑表达式的方法获得。例如,查询系统可以用于全文检索,该全文检索是指计算机程序通过扫描文章中的每一个词,并对必要的词建立一个索引,指明该词在文章中出现的次数和位置。当用户查询包含某些字词的文本时,能够根据建立的索引进行查找,类似于通过字典的检索字表来查字的过程。Based on the foregoing embodiments, embodiments of the present disclosure provide a query system. The logical expression of the query system is obtained through the method of establishing logical expressions in the corresponding embodiments of Figures 1 to 2. For example, the query system can be used for full-text retrieval, which means that a computer program scans each word in an article and creates an index for the necessary words, indicating the number and position of the word in the article. When users query text that contains certain words, they can search based on the established index, similar to the process of looking up words through a dictionary's search list.

作为另一方面,本公开实施例提供一种电子设备,该电子设备包括处理器和存储器。存储器中存储有至少一条指令、至少一段程序、代码集或指令集,指令、程序、代码集或指令集由处理器加载并执行以实现图1~图2对应实施例的建立逻辑表达式的方法的步骤。As another aspect, embodiments of the present disclosure provide an electronic device including a processor and a memory. At least one instruction, at least one program, code set or instruction set is stored in the memory. The instruction, program, code set or instruction set is loaded and executed by the processor to implement the method of establishing a logical expression according to the embodiment corresponding to Figures 1 to 2 A step of.

作为又一方面,本公开实施例提供一种计算机可读存储介质,用于存储程序代码,该程序代码用于执行前述图1~图2对应实施例的建立逻辑表达式的方法中的任意一种实施方式。As yet another aspect, an embodiment of the present disclosure provides a computer-readable storage medium for storing program code. The program code is used to execute any one of the methods of establishing logical expressions in the corresponding embodiments of FIGS. 1 to 2 . implementation.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.

在本公开所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or modules, and may be in electrical, mechanical or other forms. Modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本公开各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个模块单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。而集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。In addition, each functional module in various embodiments of the present disclosure may be integrated into one processing unit, or each module may exist physically alone, or two or more units may be integrated into one module. The above integrated units can be implemented in the form of hardware or software functional units. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.

基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例建立逻辑表达式的方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。Based on this understanding, the technical solution of the present disclosure is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method for establishing a logical expression in various embodiments of the present disclosure. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .

需要说明的是,以上实施例仅用以说明本公开的技术方案,而非对其限制;尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本公开各实施例技术方案的精神和范围。It should be noted that the above embodiments are only used to illustrate the technical solution of the present disclosure, but not to limit it; although the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still The technical solutions described in the foregoing embodiments may be modified, or some of the technical features may be equivalently replaced; however, these modifications or substitutions shall not cause the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present disclosure.

Claims (10)

1.一种大语言模型用于建立逻辑表达式的方法,其特征在于,所述方法包括:1. A method for establishing logical expressions in a large language model, characterized in that the method includes: 检测大语言模型的训练类型;Detect the training type of large language models; 若所述训练类型为已完成继续训练,则向所述大语言模型输入描述逻辑表达式的自然语言文本,并获得所述大语言模型输出的所述自然语言文本对应的逻辑表达式;所述继续训练包括对根据所述大语言模型得到的微调模型以及奖励模型进行强化学习,其中所述微调模型用于生成预测表达式,所述奖励模型用于对所述预测表达式进行评分,以更新所述微调模型的参数。If the training type is Completed and Continued Training, then input the natural language text describing the logical expression to the large language model, and obtain the logical expression corresponding to the natural language text output by the large language model; Continuing training includes performing reinforcement learning on the fine-tuned model obtained according to the large language model and the reward model, wherein the fine-tuned model is used to generate a predictive expression, and the reward model is used to score the predicted expression to update The parameters of the fine-tuned model. 2.根据权利要求1所述的方法,其特征在于,所述微调模型根据人工标注数据,对所述大语言模型进行微调训练获得,所述人工标注数据包括自然语言与逻辑表达式的映射关系。2. The method according to claim 1, characterized in that the fine-tuning model is obtained by fine-tuning the large language model based on manual annotation data, and the artificial annotation data includes a mapping relationship between natural language and logical expressions. . 3.根据权利要求1所述的方法,其特征在于,所述奖励模型通过对所述预测表达式的人工评分排序结果进行训练获得。3. The method according to claim 1, characterized in that the reward model is obtained by training the artificial scoring and sorting results of the prediction expression. 4.根据权利要求1至3中任意一项所述的方法,其特征在于,所述方法还包括:4. The method according to any one of claims 1 to 3, characterized in that the method further includes: 若所述训练类型为未完成继续训练,则向所述大语言模型提供自然语言转化为逻辑表达式的示例,之后输入所述自然语言文本,以获得所述自然语言文本对应的逻辑表达式。If the training type is to continue training without completion, an example of converting natural language into a logical expression is provided to the large language model, and then the natural language text is input to obtain the logical expression corresponding to the natural language text. 5.根据权利要求4所述的方法,其特征在于,所述大语言模型的输出格式包括json格式、xml格式、yaml格式或者字段名称。5. The method according to claim 4, characterized in that the output format of the large language model includes json format, xml format, yaml format or field name. 6.一种大语言模型用于建立逻辑表达式的装置,其特征在于,所述装置包括:6. A device for establishing logical expressions in a large language model, characterized in that the device includes: 检测模块,用于检测大语言模型的训练类型;Detection module, used to detect the training type of large language models; 建立模块,用于若所述训练类型为已完成继续训练,则向所述大语言模型输入描述逻辑表达式的自然语言文本,并获得所述大语言模型输出的所述自然语言文本对应的逻辑表达式;所述继续训练包括对根据所述大语言模型得到的微调模型以及奖励模型进行强化学习,其中所述微调模型用于生成预测表达式,所述奖励模型用于对所述预测表达式进行评分,以更新所述微调模型的参数。Establish a module, configured to input a natural language text describing a logical expression to the large language model if the training type is completed and continue training, and obtain the logic corresponding to the natural language text output by the large language model. Expression; the continued training includes performing reinforcement learning on the fine-tuning model and the reward model obtained according to the large language model, wherein the fine-tuning model is used to generate a predictive expression, and the reward model is used to generate the predictive expression. Scoring is performed to update the parameters of the fine-tuned model. 7.根据权利要求6所述的装置,其特征在于,所述微调模型根据人工标注数据,对所述大语言模型进行微调训练获得,所述人工标注数据包括自然语言与逻辑表达式的映射关系。7. The device according to claim 6, wherein the fine-tuning model is obtained by fine-tuning the large language model based on manual annotation data, and the artificial annotation data includes a mapping relationship between natural language and logical expressions. . 8.根据权利要求6所述的装置,其特征在于,所述奖励模型通过对所述预测表达式的人工评分排序结果进行训练获得。8. The device according to claim 6, wherein the reward model is obtained by training the artificial scoring and sorting results of the prediction expression. 9.根据权利要求6至8中任意一项所述的装置,其特征在于,所述建立模块还用于若所述训练类型为未完成继续训练,则向所述大语言模型提供自然语言转化为逻辑表达式的示例,之后输入所述自然语言文本,以获得所述自然语言文本对应的逻辑表达式。9. The device according to any one of claims 6 to 8, characterized in that the establishment module is also used to provide natural language conversion to the large language model if the training type is incomplete and continued training. is an example of a logical expression, and then the natural language text is input to obtain the logical expression corresponding to the natural language text. 10.一种查询系统,其特征在于,所述查询系统的逻辑表达式通过权利要求1至5中任意一项所述的大语言模型用于建立逻辑表达式的方法获得。10. A query system, characterized in that the logical expression of the query system is obtained through the method of establishing a logical expression using a large language model according to any one of claims 1 to 5.
CN202311078223.5A 2023-08-25 2023-08-25 Method, device and query system for establishing logical expressions using large language models Pending CN117076607A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311078223.5A CN117076607A (en) 2023-08-25 2023-08-25 Method, device and query system for establishing logical expressions using large language models

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311078223.5A CN117076607A (en) 2023-08-25 2023-08-25 Method, device and query system for establishing logical expressions using large language models

Publications (1)

Publication Number Publication Date
CN117076607A true CN117076607A (en) 2023-11-17

Family

ID=88703875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311078223.5A Pending CN117076607A (en) 2023-08-25 2023-08-25 Method, device and query system for establishing logical expressions using large language models

Country Status (1)

Country Link
CN (1) CN117076607A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118331152A (en) * 2024-05-22 2024-07-12 山东和信智能科技有限公司 Industrial control system logic optimization method and system based on natural language big model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060025987A1 (en) * 2004-07-30 2006-02-02 Baisley Donald E Generating software components from business rules expressed in a natural language
CN111767381A (en) * 2020-06-30 2020-10-13 北京百度网讯科技有限公司 Automatic question answering method and device
CN116127020A (en) * 2023-03-03 2023-05-16 北京百度网讯科技有限公司 Method for training generated large language model and searching method based on model
CN116127045A (en) * 2023-03-03 2023-05-16 北京百度网讯科技有限公司 Training method for generating large language model and man-machine voice interaction method based on model

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060025987A1 (en) * 2004-07-30 2006-02-02 Baisley Donald E Generating software components from business rules expressed in a natural language
CN111767381A (en) * 2020-06-30 2020-10-13 北京百度网讯科技有限公司 Automatic question answering method and device
CN116127020A (en) * 2023-03-03 2023-05-16 北京百度网讯科技有限公司 Method for training generated large language model and searching method based on model
CN116127045A (en) * 2023-03-03 2023-05-16 北京百度网讯科技有限公司 Training method for generating large language model and man-machine voice interaction method based on model

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118331152A (en) * 2024-05-22 2024-07-12 山东和信智能科技有限公司 Industrial control system logic optimization method and system based on natural language big model

Similar Documents

Publication Publication Date Title
WO2020244073A1 (en) Speech-based user classification method and device, computer apparatus, and storage medium
CN111783993A (en) Intelligent labeling method, device, intelligent platform and storage medium
CN112069811A (en) Multi-task interaction enhanced electronic text event extraction method
US20150019571A1 (en) Method for population of object property assertions
CN110209802B (en) Method and device for extracting abstract text
WO2023035330A1 (en) Long text event extraction method and apparatus, and computer device and storage medium
US20220358295A1 (en) System and method for a cognitive conversation service
CN116244344B (en) Retrieval method, device and electronic equipment based on user needs
Miao et al. A dynamic financial knowledge graph based on reinforcement learning and transfer learning
CN112966089A (en) Problem processing method, device, equipment, medium and product based on knowledge base
CN111242710A (en) Business classification processing method and device, service platform and storage medium
CN117112767A (en) Question and answer result generation method, commercial query big model training method and device
CN117076607A (en) Method, device and query system for establishing logical expressions using large language models
CN117709969B (en) Generative matching large model construction method, medium and equipment for customer service scenarios
CN114528400A (en) Unified low-sample relation extraction method and device based on multi-selection matching network
CA3178952A1 (en) Systems and method for intent messaging
CN118779404A (en) A method and system for intelligent document query in enterprise knowledge base
CN114491010A (en) Training method and device for information extraction model
CN117633193A (en) A method, device, equipment and storage medium for replying to query questions
WO2020010930A1 (en) Method for detecting ambiguity of customer service robot knowledge base, storage medium, and computer device
CN110750989A (en) Statement analysis method and device
CN117648986B (en) Task processing and code processing method, computing device, medium, and program product
US11907500B2 (en) Automated processing and dynamic filtering of content for display
US20230244872A1 (en) Generating and identifying textual trackers in textual data
US20240362412A1 (en) Entropy based key-phrase extraction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination