Entity recognition method and device based on intelligent large language model, storage medium and electronic device

CN120911459APending Publication Date: 2025-11-07HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510863351.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

[0006]本申请实施例提供了一种基于智能大语言模型的实体识别方法、装置、存储介质及电子装置,以至少解决相关技术中,在使用神经网络模型执行实体识别任务时,实体识别效率较低的技术问题

Benefits of technology

[0017]在本申请实施例中,从为实体识别任务设置的查询语句中提取待识别实体词,基于所述待识别实体词得到所述查询语句对应的实体词列表;使用所述实体词列表更新初始提示语输入文本,得到目标提示语输入文本;将所述目标提示语输入文本输入至智能大语言模型,获取所述智能大语言模型基于所述目标提示语输入文本所输出的实体词编号,基于所述实体词编号所指示的目标实体词生成实体识别结果,其中,所述目标提示语输入文本至少包含所述实体识别任务的任务说明,所述查询语句,所述实体词列表的待识别实体词,所述智能大语言模型的输出格式;采用上述技术方案,通过查询语句的预处理和输出格式的优化,简化处理流程,大幅度提升识别速度,减少了直接输入查询语句带来的偏差,进一步提升了识别结果的可靠性和准确性。并且,本申请通过结合智能大语言模型与轻量级模型,增强了智能大语言模型的适应性和鲁棒性,降低了运行成本,解决了在使用神经网络模型执行实体识别任务时,实体识别效率较低的技术问题,进而提高了实体识别的准确性和效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120911459A_ABST
    Figure CN120911459A_ABST
Patent Text Reader

Abstract

The invention discloses an entity recognition method and device based on an intelligent large language model, a storage medium and an electronic device, and relates to the technical field of smart homes.The method comprises the steps that to-be-recognized entity words are extracted from query statements set for entity recognition tasks, and an entity word list corresponding to the query statements is obtained based on the to-be-recognized entity words; updating the initial cue input text by using the entity word list to obtain a target cue input text; and inputting the target cue input text into the intelligent large language model, obtaining an entity word number output by the intelligent large language model based on the target cue input text, and generating an entity recognition result based on the target entity word indicated by the entity word number. The technical problem that when a neural network model is used for executing an entity recognition task, the entity recognition efficiency is low is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of smart home, in particular to an entity recognition method and device based on a smart large language model, a storage medium and an electronic device. BACKGROUND

[0002] In recent years, with the continuous progress of deep learning technology, natural language processing technology has been widely applied in multiple application fields. For example, in the question and answer scenario, natural language processing technology is used to perform entity recognition tasks. The purpose of the entity recognition task is to extract key entity information such as time from natural language text.

[0003] Currently, a rule defined by a person can be directly used to perform entity recognition on a text, but this method has the disadvantage of a large workload in rule writing and maintenance, and is difficult to cope with the complexity of entities in the text, resulting in inaccurate recognition results. Although the related technology proposes a method of using a neural network model to perform entity recognition on a text to improve recognition accuracy, this method is time-consuming and slow in recognition speed, resulting in low efficiency of entity recognition.

[0004] Therefore, in the related technology, when a neural network model is used to perform an entity recognition task, there is a technical problem of low efficiency of entity recognition.

[0005] In view of the technical problem of low efficiency of entity recognition when a neural network model is used to perform an entity recognition task in the related technology, an effective solution has not yet been proposed. SUMMARY

[0006] The embodiments of the present application provide an entity recognition method and device based on a smart large language model, a storage medium and an electronic device to at least solve the technical problem of low efficiency of entity recognition when a neural network model is used to perform an entity recognition task in the related technology.

[0007] According to one of the embodiments of the present application, an entity recognition method based on a smart large language model is provided, including: extracting a to-be-recognized entity word from a query sentence set for an entity recognition task, and obtaining an entity word list corresponding to the query sentence based on the to-be-recognized entity word; updating an initial prompt input text using the entity word list to obtain a target prompt input text; inputting the target prompt input text into a smart large language model to obtain an entity word number output by the smart large language model based on the target prompt input text, and generating an entity recognition result based on a target entity word indicated by the entity word number, wherein the target prompt input text at least contains a task description of the entity recognition task, the query sentence, a to-be-recognized entity word of the entity word list, and an output format of the smart large language model.

[0008] In an example embodiment, extracting an entity word to be identified from a query sentence set for an entity identification task, and determining an entity word list corresponding to the query sentence based on the entity word to be identified, comprises: extracting a keyword conforming to a preset part-of-speech type from the query sentence; setting the keyword as a start selection anchor point, and starting from the start selection anchor point, backtracking all words located before the keyword in the query sentence; and determining the entity word list based on the plurality of entity words to be identified generated based on the all words and the keyword.

[0009] In an example embodiment, determining the entity word list based on the plurality of entity words to be identified generated based on the all words and the keyword comprises: in each case of backtracking a word, setting the word as an end selection anchor point, extracting a word located between the start selection anchor point and the end selection anchor point from the query sentence, generating an entity word to be identified based on the start selection anchor point, the word, and the end selection anchor point; determining a plurality of entity words to be identified corresponding to the all words, and generating the entity word list based on the plurality of entity words to be identified.

[0010] In an example embodiment, before extracting a keyword conforming to a preset part-of-speech type from the query sentence, the method further comprises: counting the frequency of occurrence of different keywords in the keyword library in historical query sentences; in a case where it is determined that the frequency of occurrence is higher than a first frequency, determining a merged keyword when the different keywords appear in the historical query sentences, and adding the merged keyword to the keyword library to update the keyword library; and in a case where it is determined that the frequency of occurrence is lower than the first frequency, generating an abstract keyword corresponding to the different keywords, and adding the merged keyword to the keyword library to update the keyword library.

[0011] In an example embodiment, the method further comprises: generating a historical entity word list according to keywords in historical query sentences of the entity identification task; obtaining a historical prompt input text generated based on the historical entity word list, wherein the text format of the historical prompt input text is consistent with the text format of the target prompt input text; setting the historical prompt input text as an input sample required for training a lightweight model, and setting a historical entity word number corresponding to the historical prompt input sample as an output sample required for training the lightweight model, training the lightweight model while keeping the model parameters of an initial intelligent large language model unchanged, to obtain the intelligent large language model, wherein the lightweight model is mounted outside the intelligent large language model.

[0012] In an example embodiment, before the historical prompt input text is set as an input sample required for training the lightweight model, the method further comprises: performing a synonym replacement operation on a keyword in the historical query sentence to obtain a synonymous keyword, and generating a new query sentence according to the synonymous keyword; and / or, obtaining a homonym word in the keyword in the historical query sentence, and generating a new query sentence according to the keyword in the historical query sentence and the homonym word; and / or, performing a syntax transformation on the syntax of the historical query sentence to obtain a query sentence with different syntax, and generating a new query sentence according to the query sentence with different syntax; and updating the input sample using the new query sentence.

[0013] In an example embodiment, updating the initial prompt input text using the entity word list to obtain a target prompt input text comprises: obtaining a pre-set initial prompt input text, wherein the initial prompt input text includes a task description of the entity recognition task, an output format of the intelligent large language model, a first text area for filling in the query sentence, and a second text area for filling in the to-be-recognized entity words of the entity word list; filling the first text area of the initial prompt input text using the query sentence, and filling the second text area using the to-be-recognized entity words of the entity word list, thereby obtaining an updated prompt input text, and determining the target prompt input text according to the updated prompt input text.

[0014] According to another aspect of the embodiments of the present application, an entity recognition device based on an intelligent large language model is also provided, which comprises: an extraction module configured to extract to-be-recognized entity words from a query sentence set for an entity recognition task, and obtain an entity word list corresponding to the query sentence based on the to-be-recognized entity words; an update module configured to update an initial prompt input text using the entity word list to obtain a target prompt input text; and a generation module configured to input the target prompt input text into an intelligent large language model, obtain entity word numbers output by the intelligent large language model based on the target prompt input text, and generate an entity recognition result based on target entity words indicated by the entity word numbers, wherein the target prompt input text at least includes a task description of the entity recognition task, the query sentence, to-be-recognized entity words of the entity word list, and an output format of the intelligent large language model.

[0015] According to still another aspect of the embodiments of the present application, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program is configured to execute the above-mentioned entity recognition method based on an intelligent large language model when running.

[0016] According to a further aspect of the embodiments of the present application, an electronic device is also provided, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned entity recognition method based on the intelligent large language model through the computer program.

[0017] In the embodiments of the present application, an entity word to be recognized is extracted from a query sentence set for an entity recognition task, and an entity word list corresponding to the query sentence is obtained based on the entity word to be recognized; the initial prompt input text is updated using the entity word list to obtain a target prompt input text; the target prompt input text is input into an intelligent large language model to obtain an entity word number output by the intelligent large language model based on the target prompt input text, and an entity recognition result is generated based on a target entity word indicated by the entity word number, wherein the target prompt input text at least contains a task description of the entity recognition task, the query sentence, an entity word to be recognized of the entity word list, and an output format of the intelligent large language model; by using the above technical solution, the processing flow is simplified, the recognition speed is greatly improved, and the deviation caused by directly inputting the query sentence is reduced, thereby further improving the reliability and accuracy of the recognition result. Moreover, by combining the intelligent large language model with the lightweight model, the adaptability and robustness of the intelligent large language model are enhanced, the running cost is reduced, the technical problem of low entity recognition efficiency when using the neural network model to perform the entity recognition task is solved, and thus the accuracy and efficiency of the entity recognition are improved. BRIEF DESCRIPTION OF DRAWINGS

[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.

[0020] Figure 1 is a hardware environment schematic diagram of an entity recognition method based on an intelligent large language model according to an embodiment of the present application;

[0021] Figure 2 is a flowchart of an entity recognition method based on an intelligent large language model according to an embodiment of the present application;

[0022] Figure 3is a structural block diagram of an entity recognition device based on an intelligent large language model according to an embodiment of the application (I);

[0023] Figure 4 is a structural block diagram of an entity recognition device based on an intelligent large language model according to an embodiment of the application (II). DETAILED DESCRIPTION

[0024] In order to enable persons skilled in the art to better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.

[0025] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0026] According to an aspect of an embodiment of the present application, a method for entity recognition based on an intelligent large language model is provided. The method for entity recognition based on an intelligent large language model is widely applied to smart home (Smart Home), smart home, smart home device ecology, intelligence house (Intelligence House) ecology, and other whole-house intelligent digital control application scenarios. Optionally, in the present embodiment, the above-mentioned method for entity recognition based on an intelligent large language model can be applied to the hardware environment composed of a terminal device 102 and a server 104 as shown in Figure 1 As shown in Figure 1 The server 104 is connected with the terminal device 102 through a network, and can be used to provide services (such as application services, etc.) for terminals or clients installed on terminals, a database can be set on the server or independently of the server, and used to provide data storage services for the server 104, cloud computing and / or edge computing services can be configured on the server or independently of the server, and used to provide data operation services for the server 104.

[0027] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0028] This embodiment provides an entity recognition method based on an intelligent large language model, applied to the aforementioned terminal device. The intelligent large language model is a pre-trained deep learning model, with a lightweight model, such as a LORA (Low-Rank Adaptation) model, mounted externally. LORA is a machine learning model fine-tuning technique used for efficient fine-tuning of a large pre-trained model with limited data, achieving this by learning the low-rank decomposition of model parameters. This technique maintains the performance of the original model while enabling rapid adaptation and optimization for specific tasks or domains.

[0029] The relationship between intelligent large language models and LoRA can be understood as follows: Intelligent large language models, such as Doubao and Wenxin Yiyan mentioned above, are pre-trained deep learning models with powerful general understanding and generation capabilities. These models are typically trained on large-scale datasets containing hundreds of millions or even billions of parameters to ensure they can handle a wide range of language understanding and generation tasks. However, directly fine-tuning these large models to adapt them to specific tasks (such as entity recognition) may face problems such as excessive computational resources, excessively long training times, and a tendency to overfit to new datasets.

[0030] LoRA technology is a lightweight adaptive layer mounted outside the intelligent large language model. Its design purpose is to enable the large model to quickly adapt to specific tasks or domains without modifying the parameters of the main model. LoRA fine-tunes the model's parameters by adding low-rank matrices, which are trained on a small amount of task-specific training data, allowing the model to retain its original general capabilities while enhancing its performance on specific tasks. As a lightweight additional module, fine-tuning the parameters of the LoRA layer requires much less computational resources and time than the entire large model. Moreover, LoRA fine-tuning is an external operation that can be performed without changing the main large model. It can flexibly handle various entity recognition needs for different entity recognition types (such as person names, place names, and time expressions) without the need for comprehensive retraining of the large model for multiple entity recognition tasks. In summary, LoRA fine-tuning technology can significantly improve recognition accuracy and efficiency with a small amount of data, bringing high flexibility and adaptability to large models, allowing them to retain their original generalization capabilities while quickly mastering the details of specific tasks.

[0031] Figure 2 is a flowchart of an entity recognition method based on an intelligent large language model according to an embodiment of the present application. The flowchart includes the following steps:

[0032] Step S202, extracting an entity word to be recognized from a query sentence set for an entity recognition task, and obtaining an entity word list corresponding to the query sentence based on the entity word to be recognized;

[0033] It should be noted that by preprocessing the query sentence and generating the entity word list, all potential entities can be listed in advance, providing a clear range of candidate entities for the intelligent large language model, which helps the model to make more accurate choices among these candidates and avoids the uncertainty of identifying entities from a large number of irrelevant words.

[0034] Step S204, updating the initial prompt input text using the entity word list to obtain a target prompt input text;

[0035] Wherein, the prompt input text can be understood as a prompt template used in the natural language processing task of an intelligent large language model (such as GPT series, Ernie, etc.). The prompt is an input format that guides the model to generate a specific type of output, and is used to stimulate the model to produce a response that meets the requirements.

[0036] For example, the prompt input text is briefly described as follows:

[0037] Role setting: Set a role or scenario at the beginning of the prompt, which helps the model understand the role it should play and the type of task. For example, the role setting content is "You are an NLP expert, now you have an entity recognition task, please list the recognition results."

[0038] Task description: Clearly tell the model what task needs to be completed, which can include the type of input content and the expected output format. For example, "The input lists all possible entities, and the output is the entity word number that you think is correct. You only need to output the entity label."

[0039] Specific input content: Represents the actual content that the model needs to process and analyze, such as query or question text. For example, "query = tomorrow morning I want to play basketball."

[0040] Entity list: In the entity recognition task, the prompt contains a pre-processed entity list to help the model quickly locate and identify entities in the entity list. Each entity can include entity content, type, and specific format listing of location in the input text, such as "<index_0>: tomorrow, time, <0,2>".

[0041] Output instruction: Clearly tell the model how to output the results, for example, "The output result is: ***".

[0042] Model response format: This is the output format generated by the model, which can be directly specified in the prompt. For the entity recognition task in this application, the model response format is set to entity word number, which requires the model to only output the number of entities, rather than the complete entity description, to reduce the number of output tokens and speed up processing.

[0043] By integrating pre-processed entity information into the prompt, combined with role setting and task description, this application can enable the model to quickly understand the task requirements and output the correct answer in the shortest form, thereby significantly improving the speed and efficiency of entity recognition.

[0044] Step S206, input the target prompt text into the intelligent large language model, obtain the entity word number output by the intelligent large language model based on the target prompt text, and generate an entity recognition result based on the target entity word indicated by the entity word number, wherein the target prompt text at least contains the task description of the entity recognition task, the query statement, the entity word list to be recognized entity word, and the output format of the intelligent large language model.

[0045] It should be noted that, considering that directly fine-tuning these intelligent large language models to adapt to specific tasks (such as entity recognition) may face problems such as excessive computing resources, excessive training time, and easy overfitting to new data sets. The present application has a lightweight model mounted outside the intelligent large language model. On the one hand, the intelligent large language model ensures the understanding and processing ability of complex context, and on the other hand, the mounting of the lightweight model reduces the consumption of computing resources, so that the entity recognition can better adapt to mobile devices and real-time processing requirements while maintaining high accuracy.

[0046] The lightweight model is, for example, a LoRA (Low-Rank Adaptation) model. By mounting the LoRA model outside the intelligent large language model, an additional lightweight adaptation layer can be added outside the intelligent large language model, so that the intelligent large language model can quickly adapt to specific tasks or domains without modifying the parameters of the main model (i.e., the intelligent large language model).

[0047] Optionally, for the LoRA model, the parameters can be fine-tuned by adding low-rank matrices, which are trained by a small amount of training data for specific tasks, so that the model can retain its original general capabilities while enhancing its performance on specific tasks. It can be understood that LoRA only contains a small part of the parameters of the intelligent large language model, so the computing resources and time required to fine-tune the parameters of LoRA are much less than those of the entire intelligent large language model. By fine-tuning LoRA, the present application can quickly and efficiently improve the performance of the model on the entity recognition task without changing the intelligent large language model, thereby achieving effective adaptation and optimization for specific tasks.

[0048] The time consumption of the intelligent large language model is proportional to the length of the prompt and the length of the output. The longer the length of the prompt and the more tokens the output, the higher the time consumption of the intelligent large language model. For example, with a 3b intelligent large language model and a10 gpu, the encoding speed of each token in the prompt stage is 0.56ms / token, and the output time of each token in the generation stage is 5.6ms / token. Without preprocessing, directly using the intelligent large language model to extract entities, the number of tokens output by the large model is between 12 and 20, and the time consumption is 120-168ms. According to the preprocessed to-be-recognized entities, the present application updates the prompt, so that the intelligent large language model outputs 2 tokens according to the latest prompt, while ensuring the accuracy of the results, effectively shortening the interaction time.

[0049] The intelligent large language model only needs to output entity word numbers instead of complete entity content, which reduces the output length of the model, thereby significantly reducing the computing amount and response time of the intelligent large language model. That is, the time-consuming process of generating entity content is replaced by generating only two token entity word numbers, making entity recognition faster.

[0050] The process of generating an entity recognition result based on the target entity word indicated by the entity word number is, for example, querying the entity word corresponding to the entity word number from the entity word list, and then generating the entity recognition result.

[0051] Through the above steps, the entity word to be recognized is extracted from the query sentence set for the entity recognition task, and the entity word list corresponding to the query sentence is obtained based on the entity word to be recognized; the initial prompt input text is updated using the entity word list to obtain a target prompt input text; the target prompt input text is input into the intelligent large language model to obtain the entity word number output by the intelligent large language model based on the target prompt input text, and an entity recognition result is generated based on the target entity word indicated by the entity word number, wherein the target prompt input text at least contains the task description of the entity recognition task, the query sentence, the entity word to be recognized of the entity word list, and the output format of the intelligent large language model; by using the above technical solution, the processing flow is simplified, the recognition speed is greatly improved, the deviation caused by directly inputting the query sentence is reduced, and the reliability and accuracy of the recognition result are further improved. Furthermore, by combining the intelligent large language model with the lightweight model, the adaptability and robustness of the intelligent large language model are enhanced, the running cost is reduced, and the technical problem of low entity recognition efficiency when using a neural network model to perform an entity recognition task is solved, thereby improving the accuracy and efficiency of entity recognition.

[0052] Further, the technical solution of the present application can be widely applied to information retrieval, natural language processing, intelligent question answering and other scenarios, thereby providing more accurate and faster information services.

[0053] In one exemplary embodiment, the process of extracting the entity word to be recognized from the query sentence set for the entity recognition task based on the entity word to be recognized to obtain the entity word list corresponding to the query sentence can include: extracting a keyword conforming to a preset part of speech type from the query sentence; setting the keyword as a starting anchor point, starting from the starting anchor point, and backtracking all words located before the keyword in the query sentence; determining the entity word list based on the plurality of entity words generated based on the all words and the keyword. Through this preprocessing method, the present embodiment can more accurately locate the entity in the query sentence, reducing the probability of misrecognition and missed recognition.

[0054] The preset part-of-speech type includes one of the following, for example: time, action, and personal pronoun.

[0055] In an example embodiment, the implementation process of determining the entity word list based on the all words and the keywords generated includes the following steps: in each case of backtracking to a word, setting the word as an end selection anchor, extracting words between the start selection anchor and the end selection anchor from the query statement, generating an entity word to be identified based on the start selection anchor, the words, and the end selection anchor; determining the plurality of entity words to be identified corresponding to the all words, and generating the entity word list based on the plurality of entity words to be identified. This embodiment can adapt to entity words of different lengths and structures by dynamically adjusting the boundaries of entity words, thereby improving the flexibility and accuracy of identification.

[0056] In an example embodiment, before extracting keywords of a preset part-of-speech type from the query statement, the frequency of occurrence of different keywords in the keyword library in the historical query statement can be further counted; in a case where the frequency of occurrence is determined to be higher than a first frequency, a merged keyword of the different keywords in the historical query statement is determined, and the merged keyword is added to the keyword library to update the keyword library; in a case where the frequency of occurrence is determined to be lower than the first frequency, an abstract keyword corresponding to the different keywords is generated, and the merged keyword is added to the keyword library to update the keyword library. By analyzing the merged occurrence frequency of keywords and generating abstract keywords, the understanding and application of the model to keywords can be enhanced, and the efficiency and accuracy of professional information processing can be improved.

[0057] Based on this embodiment, for example, for the query statement "I plan to run in the early morning", since the keyword library already contains "early morning" and "time", the "early morning time" can be more accurately identified as a time entity, rather than just identifying "early morning" as a time entity.

[0058] Further, when training the intelligent large language model, the weight of the merged keyword can be adjusted to improve the probability of the intelligent large language model identifying the merged keyword as a time entity; other keywords not belonging to the keyword library are determined from the historical query statement, and the other keywords are added to the keyword library to update the keyword library.

[0059] For example, by analyzing historical queries and entity recognition results, it is found that the combination of time points such as "3 pm" frequently appears in queries, and the model is not aware that this is a specific time entity when it identifies such combinations because the weights of "afternoon" and "3 pm" alone are not enough.

[0060] The weight of "afternoon" in the keyword library is 1, and the weight of "3 pm" is 1, without the keyword "afternoon 3 pm". At this time, the keyword weight can be updated, that is, the weights of "afternoon" and "3 pm" are adjusted to make them more prominent when the model processes input. For example, the weight of "afternoon" is increased to 2, and the weight of "3 pm" is increased to 2, indicating that these two expressions are more likely to constitute a time entity when combined. Alternatively, an abstract keyword "specific time point" is added to prompt the model that when encountering specific numerical and time expressions such as "afternoon" and "3 pm", they are likely to constitute a combined entity. The weight of this new keyword can also be set to 3, higher than the weights of "afternoon" and "3 pm" alone, to emphasize its importance, so that the model can more accurately identify "afternoon 3 pm" as a time entity, rather than just as two independent time words.

[0061] This method not only improves the accuracy of the model in identifying common time point combinations, but also can handle more similar specific time point combinations without creating a keyword for each possible combination. Through the adjustment of keyword weights and the addition of abstract keywords, the present application can effectively guide the model to more accurately recognize and locate entities when processing new input, so that the model can more flexibly and intelligently process time expressions, and improve the overall entity recognition efficiency and accuracy.

[0062] In an exemplary embodiment, further, a model training method is provided, specifically comprising: generating a historical entity word list according to keywords in historical query sentences of the entity recognition task; obtaining a historical prompt input text generated based on the historical entity word list, wherein the text format of the historical prompt input text is consistent with the text format of the target prompt input text; setting the historical prompt input text as an input sample required for training the lightweight model, and setting the historical entity word number corresponding to the historical prompt input sample as an output sample required for training the lightweight model, training the lightweight model while keeping the model parameters of the initial intelligent large language model unchanged, to obtain the intelligent large language model. By utilizing historical query sentences for model training, the generalization ability of the model can be enhanced, so that when facing new queries, the model can more accurately recognize entities.

[0063] In an example embodiment, before the historical prompt input text is set as an input sample required for training the lightweight model, the training data can also be updated, specifically including: performing a synonym replacement operation on the keywords in the historical query sentence to obtain synonymous keywords, and generating a new query sentence according to the synonymous keywords; and / or, obtaining the same word nature words of the keywords in the historical query sentence, and generating a new query sentence according to the keywords in the historical query sentence and the same word nature words; and / or, performing a syntax transformation on the syntax of the historical query sentence to obtain query sentences with different syntaxes, and generating a new query sentence according to the query sentences with different syntaxes; and updating the input sample using the new query sentence. This embodiment realizes the data augmentation operation by performing synonym replacement, same word nature word replacement and syntax transformation on the keywords of the historical query sentence, increases the diversity of the training sample, and can effectively enhance the generalization ability and recognition accuracy of the model, so that the model can still maintain stable recognition performance when facing diversified query sentences.

[0064] In an example embodiment, the process of updating the initial prompt input text using the entity word list to obtain the target prompt input text can include: obtaining a pre-set initial prompt input text, wherein the initial prompt input text includes a task description of the entity recognition task, an output format of the intelligent large language model, a first text area for filling in the query sentence, and a second text area for filling in the to-be-recognized entity words of the entity word list; filling the first text area of the initial prompt input text using the query sentence, and filling the second text area using the to-be-recognized entity words of the entity word list, thereby obtaining an updated prompt input text, and determining the target prompt input text according to the updated prompt input text. This embodiment can more effectively guide the model to perform entity recognition through the structured prompt input text, reduce the error of the model in understanding the query sentence, and improve the accuracy and efficiency of information extraction.

[0065] In order to better understand the process of the above-mentioned entity recognition method based on the intelligent large language model, the implementation method flow of the above-mentioned entity recognition based on the intelligent large language model will be described in combination with optional embodiments below, but not used to limit the technical solutions of the embodiments of the present application.

[0066] In this embodiment, an entity recognition method based on an intelligent large language model is provided, Figure 3 is a flowchart of the entity recognition method based on the intelligent large language model according to the embodiments of the present application, as Figure 3 shown, specifically including the following steps:

[0067] Step one: query preprocessing. The ultimate goal of query preprocessing is to list all the entities to be identified, encode them, and output the encoded results. For example, use the keyword search method to find the end of the entity that may be generated or the word as the anchor point to backtrack each word forward to generate the possible entity, as follows:

[0068] “<number>: entity content, entity type, <entity content start position>.”

[0069] Take the identification of time entities / action entities / personal entities as an example.

[0070] query = tomorrow morning I want to play basketball;

[0071] Time type keywords: day, noon;

[0072] The generated possible time entity format is <index_0>: tomorrow, time, <0, 2>, <index_1>: morning, time, <2, 4>, <index_2>: tomorrow morning, time, <1, 4>, <index_3>: tomorrow morning, time, <0, 4>.”

[0073] Step two: prompt generation.

[0074] The initial prompt of the present application is:

[0075] “You are an nlp expert, now there is a task of entity recognition, the input lists all possible entities, and the output is an entity word number that you think is the correct answer, you only need to output the entity word number. query = “query content”, all possible entities are listed, and the output result is: ****.”

[0076] Taking query = tomorrow morning I want to play basketball as an example, the generated prompt is:

[0077] “You are an nlp expert (role setting), now there is a task of entity recognition (task designation), the input lists all possible entities (input content), and the output is an entity word number that you think is the correct answer (output result), you only need to output the entity word number (output format). query = “tomorrow morning I want to play basketball as an example” (query), all possible entities are <index_0>: tomorrow, time, <0, 2>, <index_1>: morning, time, <2, 4>, <index_2>: tomorrow morning, time, <1, 4>, <index_3>: tomorrow morning, time, <0, 4>, the output result is: ***.”.

[0078] Optionally, before step one, step three can also be performed: model fine-tuning.

[0079] An intelligent large language model externally mounted with lora is taken as the main body, and a small amount of training data is used to fine-tune the parameters of lora without fine-tuning the parameters of the intelligent large language model.

[0080] For a type of entity recognition, 2k-1w pieces of basic data are prepared, training data is generated by using prompt preprocessing, and then the existing lora fine-tuning technology is used to fine-tune the parameters of lora mounted by the main intelligent large language model.

[0081] The format of the training data is taken as an example of query=tomorrow morning I want to play basketball, and the generated training data is:

[0082] {"input":"You are an NLP expert, and now you have an entity recognition task. The input lists all possible entities, and the output is an entity word number that you think is correct. You only need to output the entity word number. Query = "tomorrow morning I want to play basketball as an example", all possible entities are: \n<index_0>: tomorrow, time, <0, 2>, \n<index_1>: morning, time, <2, 4>, \n<index_2>: tomorrow morning, time, <0, 4>, \n<index_3>: morning, time, <1, 4>, \n, the output result is:", "output":"3"}.

[0083] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, or network device, etc.) execute the methods of various embodiments of the present application.

[0084] Figure 3 is a structural block diagram of an entity recognition device based on an intelligent large language model according to an embodiment of the present application (one); as shown in Figure 3 , it includes:

[0085] The extraction module 32 is configured to extract an entity word to be recognized from a query sentence set for an entity recognition task, and obtain an entity word list corresponding to the query sentence based on the entity word to be recognized.

[0086] The updating module 34 is configured to update the initial prompt input text using the entity word list to obtain a target prompt input text.

[0087] The generating module 36 is configured to input the target prompt input text into the intelligent large language model, acquire an entity word number output by the intelligent large language model based on the target prompt input text, and generate an entity recognition result based on a target entity word indicated by the entity word number, wherein the target prompt input text at least contains a task description of the entity recognition task, the query sentence, a to-be-recognized entity word of the entity word list, and an output format of the intelligent large language model.

[0088] By means of the above device, a to-be-recognized entity word is extracted from a query sentence set for an entity recognition task, an entity word list corresponding to the query sentence is obtained based on the to-be-recognized entity word, the initial prompt input text is updated using the entity word list to obtain a target prompt input text, the target prompt input text is input into the intelligent large language model, an entity word number output by the intelligent large language model based on the target prompt input text is acquired, and an entity recognition result is generated based on a target entity word indicated by the entity word number, wherein the target prompt input text at least contains a task description of the entity recognition task, the query sentence, a to-be-recognized entity word of the entity word list, and an output format of the intelligent large language model. By means of the above technical solution, the processing flow is simplified, the recognition speed is greatly improved, the deviation caused by directly inputting the query sentence is reduced, and the reliability and accuracy of the recognition result are further improved through the preprocessing of the query sentence and the optimization of the output format. Furthermore, the adaptability and robustness of the intelligent large language model are enhanced by combining the intelligent large language model with the lightweight model, the running cost is reduced, the technical problem of low entity recognition efficiency when a neural network model is used to perform an entity recognition task is solved, and thus the accuracy and efficiency of entity recognition are improved.

[0089] In one example embodiment, the extracting module is further configured to extract a keyword conforming to a preset part-of-speech type from the query sentence, set the keyword as a starting selection anchor point, backtrack all words located before the keyword in the query sentence from the starting selection anchor point, and determine the entity word list based on the all words and the keyword.

[0090] In an example embodiment, the extraction module is further configured to: set one word as an end selection anchor point in each backtracking to one word, extract a word located between the start selection anchor point and the end selection anchor point from the query sentence, generate an entity word to be identified based on the start selection anchor point, the word and the end selection anchor point; determine a plurality of entity words to be identified corresponding to the all words, and generate the entity word list based on the plurality of entity words to be identified.

[0091] In an example embodiment, the extraction module is further configured to: before extracting the keywords conforming to the preset part-of-speech type from the query sentence, further, count the occurrence frequency of different keywords in the keyword library in the historical query sentences; in a case where it is determined that the occurrence frequency is higher than a first frequency, determine a merged keyword when the different keywords appear in the historical query sentences, and add the merged keyword to the keyword library to update the keyword library; in a case where it is determined that the occurrence frequency is lower than the first frequency, generate an abstract keyword corresponding to the different keywords, and add the merged keyword to the keyword library to update the keyword library.

[0092] In an example embodiment, the update module is further configured to: obtain a pre-set initial prompt input text, wherein the initial prompt input text includes a task description of the entity recognition task, an output format of the intelligent large language model, a first text area for filling the query sentence, and a second text area for filling the entity words to be identified of the entity word list; fill the first text area of the initial prompt input text with the query sentence, and fill the second text area with the entity words to be identified of the entity word list, thereby obtaining an updated prompt input text, and determine the target prompt input text according to the updated prompt input text.

[0093] In an example embodiment, further, as shown in Figure 4 The above-mentioned entity recognition device based on the intelligent large language model further includes a training module 42 in addition to the extraction module 32, the update module 34 and the generation module 36.

[0094] Optionally, the training module is further configured to: generate a historical entity word list according to keywords in a historical query sentence of the entity recognition task; obtain a historical prompt input text generated based on the historical entity word list, wherein the historical prompt input text has a same text format as the target prompt input text; set the historical prompt input text as an input sample required for training the lightweight model, and set a historical entity word number corresponding to the historical prompt input sample as an output sample required for training the lightweight model; and train the lightweight model while keeping model parameters of the initial intelligent large language model unchanged, to obtain the intelligent large language model.

[0095] In an example embodiment, the training module is further configured to: before setting the historical prompt input text as the input sample required for training the lightweight model, update the training data, specifically including: performing a synonym replacement operation on the keywords in the historical query sentence to obtain synonymous keywords, and generating a new query sentence according to the synonymous keywords; and / or obtaining homonym words in the historical query sentence, and generating a new query sentence according to the keywords in the historical query sentence and the homonym words; and / or performing a syntax transformation on the syntax of the historical query sentence to obtain query sentences with different syntaxes, and generating a new query sentence according to the query sentences with different syntaxes; and update the input sample using the new query sentence.

[0096] Embodiments of the present application also provide a storage medium including a stored program, wherein the program performs any of the above methods when executed.

[0097] Optionally, in the present embodiment, the storage medium can be configured to store program code for performing the following steps:

[0098] S1, extracting an entity word to be recognized from a query sentence set for an entity recognition task, and obtaining an entity word list corresponding to the query sentence based on the entity word to be recognized;

[0099] S2, updating an initial prompt input text using the entity word list to obtain a target prompt input text;

[0100] S3, inputting the target prompt input text into an intelligent large language model, obtaining an entity word number output by the intelligent large language model based on the target prompt input text, and generating an entity recognition result based on a target entity word indicated by the entity word number, wherein the target prompt input text at least contains task description of the entity recognition task, the query sentence, the entity word to be recognized of the entity word list, and an output format of the intelligent large language model.

[0101] Embodiments of the present application also provide an electronic device, comprising a memory and a processor, the memory storing a computer program, and the processor being configured to execute the computer program to perform the steps in any of the above method embodiments.

[0102] Optionally, the electronic device described above can further comprise a transmission device connected with the processor and an input and output device connected with the processor.

[0103] Optionally, in the present embodiment, the processor can be configured to perform the following steps through the computer program:

[0104] S1. extracting an entity word to be recognized from a query sentence set for an entity recognition task, and obtaining an entity word list corresponding to the query sentence based on the entity word to be recognized;

[0105] S2. updating an initial prompt input text using the entity word list to obtain a target prompt input text;

[0106] S3. inputting the target prompt input text into an intelligent large language model, obtaining an entity word number output by the intelligent large language model based on the target prompt input text, and generating an entity recognition result based on a target entity word indicated by the entity word number, wherein the target prompt input text at least contains a task description of the entity recognition task, the query sentence, an entity word to be recognized of the entity word list, and an output format of the intelligent large language model.

[0107] Optionally, in the present embodiment, the storage medium can include but is not limited to a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0108] Optionally, specific examples in the present embodiment can refer to the examples described in the above embodiments and optional implementation manners, which will not be described herein again.

[0109] It is apparent that those skilled in the art can, without departing from the spirit of the present application, make various changes and modifications of the modules or steps of the present application described above, which can be implemented by general computing devices, and can be centralized on a single computing device or distributed on a network composed of multiple computing devices, and optionally, can be implemented by program codes executable by computing devices, so that they can be stored in storage devices and executed by computing devices, and in some cases, the steps shown or described can be executed in different order, or can be made into individual integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module. Thus, the present application is not limited to any particular combination of hardware and software.

[0110] The above description is only the preferred embodiments of the present application, and it should be pointed out that those skilled in the art can make several improvements and refinements without departing from the principles of the present application, and these improvements and refinements should be considered as the protection scope of the present application.

Claims

1. A method for entity recognition based on a smart large language model, characterized in that, The method comprises the following steps: extracting an entity word to be recognized from a query sentence set for an entity recognition task, and obtaining an entity word list corresponding to the query sentence based on the entity word to be recognized; updating an initial prompt input text using the entity word list to obtain a target prompt input text; inputting the target prompt input text into an intelligent large language model to obtain an entity word number output by the intelligent large language model based on the target prompt input text, and generating an entity recognition result based on a target entity word indicated by the entity word number, wherein the target prompt input text at least contains task description of the entity recognition task, the query sentence, the entity word to be recognized in the entity word list, and the output format of the intelligent large language model. 2.The method of claim 1, wherein, The method comprises the following steps: extracting a keyword conforming to a preset part-of-speech type from the query sentence; setting the keyword as a start selection anchor point, and starting from the start selection anchor point, backtracking all words located before the keyword in the query sentence; determining the entity word list based on a plurality of entity words to be recognized generated based on the all words and the keyword. 3.The method of claim 2, wherein, The method comprises the following steps: in the case of backtracking one word, setting the one word as an end selection anchor point, extracting a word located between the start selection anchor point and the end selection anchor point from the query sentence, and generating an entity word to be recognized based on the start selection anchor point, the word, and the end selection anchor point; determining a plurality of entity words to be recognized corresponding to the all words, and generating the entity word list based on the plurality of entity words to be recognized. 4.The method of claim 2, wherein, Before extracting the keyword conforming to the preset part-of-speech type from the query sentence, the method further comprises the following steps: counting the frequency of occurrence of different keywords in the keyword library in historical query sentences; in the case that the frequency of occurrence is higher than a first frequency, determining a merged keyword when the different keywords appear in the historical query sentences, and adding the merged keyword to the keyword library to update the keyword library; 5.The method of claim 1, wherein, in the case that the frequency of occurrence is lower than the first frequency, generating an abstract keyword corresponding to the different keywords, and adding the merged keyword to the keyword library to update the keyword library. The method further comprises the following steps: generating a historical entity word list according to the keywords in the historical query sentences of the entity recognition task; and obtaining a historical prompt input text generated based on the historical entity word list, wherein the text format of the historical prompt input text is consistent with the text format of the target prompt input text. The historical prompt input text is set as an input sample required for training a lightweight model, and a historical entity word number corresponding to the historical prompt input sample is set as an output sample required for training the lightweight model, and the lightweight model is trained while keeping the model parameters of an initial intelligent large language model unchanged, to obtain the intelligent large language model, wherein the lightweight model is mounted outside the intelligent large language model. 6.The method of claim 5, wherein, Before the historical prompt input text is set as an input sample required for training the lightweight model, the method further comprises: performing a synonym replacement operation on a keyword in the historical query sentence to obtain a synonymous keyword, and generating a new query sentence according to the synonymous keyword; and / or, obtaining a homonym word in the historical query sentence, and generating a new query sentence according to the keyword in the historical query sentence and the homonym word; and / or, performing a syntax transformation on the syntax of the historical query sentence to obtain a query sentence with different syntaxes, and generating a new query sentence according to the query sentence with different syntaxes; updating the input sample using the new query sentence. 7.The smart large language model-based entity recognition method of claim 1, wherein, The input sample is updated using the entity word list to obtain a target prompt input text, comprising: obtaining a pre-set initial prompt input text, wherein the initial prompt input text includes a task description of the entity recognition task, an output format of the intelligent large language model, a first text area for filling in the query sentence, and a second text area for filling in the entity word list to be recognized; filling in the first text area of the initial prompt input text using the query sentence, and filling in the second text area using the entity word list to be recognized, thereby obtaining an updated prompt input text, and determining the target prompt input text according to the updated prompt input text.

8. An entity recognition apparatus based on a smart large language model, characterized by, comprising: an extraction module configured to extract an entity word to be recognized from a query sentence set for an entity recognition task, and obtain an entity word list corresponding to the query sentence based on the entity word to be recognized; an updating module configured to update an initial prompt input text using the entity word list to obtain a target prompt input text; a generation module configured to input the target prompt input text into an intelligent large language model, obtain an entity word number output by the intelligent large language model based on the target prompt input text, and generate an entity recognition result based on a target entity word indicated by the entity word number, wherein the target prompt input text at least includes a task description of the entity recognition task, the query sentence, an entity word to be recognized of the entity word list, and an output format of the intelligent large language model.

9. A computer readable storage medium, characterized in that, The computer-readable storage medium comprises a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed. 10.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 7 by using the computer program.