An information query method, device, equipment and medium
Patent Information
- Application Number
- CN202611260534.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-10-30
AI Technical Summary
传统信息查询系统通常是通过提取用户输入信息中所包含的关键词来实现信息查询的,但该信息查询方式在处理复杂信息查询和自然语言理解方面的准确性较低
[0008]本发明实施例公开了一种信息查询方法、装置、设备及介质。将查询文本输入第一机器学习模型,输出多个初始意图标签及各初始查询意图标签对应的置信度;第一机器学习模型为对基座大语言模型进行结构裁剪获得;基于置信度、第一预设阈值和第二预设阈值从多个初始意图标签中确定目标意图标签;基于目标意图标签和预设映射关系确定目标数据源;其中,目标数据源包括静态数据源和动态数据源,预设映射关系包括意图标签与数据源标识之间的关系;基于查询文本从目标数据源查询目标信息;对目标信息进行校验,获得校验后的目标信息。可以提高信息查询的准确性及可靠性。
Smart Images

Figure CN123012115A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to an information query method, apparatus, device and medium. Background Technology
[0002] With the advent of the big data era, the amount of information has increased dramatically, and users' demands for efficient and accurate information retrieval are constantly growing. This is especially true for intelligent question-and-answer scenarios in high-security and heavily regulated fields, where the certainty of query results is paramount. Traditional information retrieval systems typically extract keywords from user input, but this method is less accurate in handling complex information queries and natural language understanding. Summary of the Invention
[0003] This invention provides an information query method, apparatus, device, and medium that can improve the accuracy and reliability of information query.
[0004] According to one aspect of the present invention, an information retrieval method is provided, comprising: The query text is input into the first machine learning model, which outputs multiple initial intent labels and the confidence scores corresponding to each initial query intent label; the first machine learning model is obtained by structural pruning of the base large language model. The target intent tag is determined from the plurality of initial intent tags based on the confidence level, the first preset threshold, and the second preset threshold; The target data source is determined based on the target intent tag and the preset mapping relationship; wherein, the target data source includes static data sources and dynamic data sources, and the preset mapping relationship includes the relationship between intent tags and data source identifiers; Based on the query text, retrieve target information from the target data source; The target information is verified to obtain the verified target information.
[0005] According to another aspect of the present invention, an information query device is provided, comprising: The query text input module is used to input query text into the first machine learning model and output multiple initial intent labels and the confidence scores corresponding to each initial query intent label; the first machine learning model is obtained by structural pruning of the base large language model. The target intent label determination module is used to determine a target intent label from the plurality of initial intent labels based on the confidence level, a first preset threshold, and a second preset threshold; The target data source determination module is used to determine the target data source based on the target intent tag and the preset mapping relationship; wherein, the target data source includes static data sources and dynamic data sources, and the preset mapping relationship includes the relationship between intent tags and data source identifiers; The information query module is used to query target information from the target data source based on the query text; The information verification module is used to verify the target information and obtain the verified target information.
[0006] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the information query method according to any embodiment of the present invention.
[0007] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the information query method described in any embodiment of the present invention.
[0008] This invention discloses an information query method, apparatus, device, and medium. The method involves inputting query text into a first machine learning model, which outputs multiple initial intent tags and corresponding confidence levels for each initial query intent tag. The first machine learning model is obtained by structurally pruning a base large language model. A target intent tag is determined from the multiple initial intent tags based on the confidence level, a first preset threshold, and a second preset threshold. A target data source is determined based on the target intent tag and a preset mapping relationship. The target data source includes static and dynamic data sources, and the preset mapping relationship includes the relationship between intent tags and data source identifiers. Target information is queried from the target data source based on the query text. The target information is then verified to obtain the verified target information. This method can improve the accuracy and reliability of information querying.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart of an information query method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of an information query device according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0012] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0013] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0014] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0015] The output text lacks byte-level consistency verification with the source data, resulting in a source break defect.
[0016] 1. When the large language model generates answer text, it performs rewriting, reasoning, or synthesis operations, which causes the text string output by the processor to fail the hash verification with the data source, thus failing to meet the technical requirement of "the output content is consistent with the source data" for civil aviation safety audit.
[0017] 2. Dynamic queries pose risks of SQL injection and unauthorized access. The large language model autonomously generates SQL statement strings, and the processor directly sends these unverified strings to the database for execution. This cannot guarantee that the accessed tables and fields are within the authorized scope, resulting in a failed security audit of the production system.
[0018] 3. The intent judgment mechanism is too simplistic and cannot identify "double-high confusing intents". The existing solution relies solely on a single absolute confidence threshold for judgment. When there are two candidate intents with high confidence and a small difference (e.g., Top1=0.45, Top2=0.42), the system will still select the one with the highest confidence and fail to trigger a rejection response. This results in a high false trigger rate in noisy input environments (referring to user input that is unrelated to any intent in the preset intent classification system).
[0019] 4. Model capacity overflow leads to wasted edge computing resources. Full-featured generative large language models load a complete vocabulary output head (lm_head) on the processor, with an output space covering tens of thousands of words, while intent classification tasks only need to output a small number of discrete labels. Redundant output capabilities occupy the limited storage and computing resources of the hardened terminal, and the inherent probabilistic generation characteristics of the model are difficult to suppress through external verification methods.
[0020] Example 1 Figure 1 This is a flowchart illustrating a reminder method provided in an embodiment of the present invention. This embodiment is applicable to reminder situations. The method can be executed by the reminder device in this embodiment, which can be implemented in software and / or hardware, such as... Figure 1 As shown, the method specifically includes the following steps: S110, input the query text into the first machine learning model, and output multiple initial intent labels and the confidence scores corresponding to each initial query intent label.
[0021] The first machine learning model was obtained by structurally pruning the base large language model.
[0022] In this embodiment, intent tags can be categorized according to the data source dimension, and the intent tags satisfy the following conditions: each intent tag strictly corresponds to a unique data source identifier (static data source ID or dynamic data source ID) in the mapping table; there is no case where one intent tag points to multiple data sources, nor is there a case where one data source is shared by multiple intent tags; the granularity of intent tags is bounded by the "smallest business unit that can return a complete answer in a single query"; all natural language spoken variants of the same business intent converge to the same intent tag ID, and semantic generalization is covered by the classification capability of the natural language model. The total number of intent tags K in a single domain can be controlled within the range of 64-256, determined by business experts based on the actual query scenario's full coverage requirements, and written into a read-only configuration file, which cannot be dynamically modified at runtime.
[0023] The query text can be natural language query text entered by the user through a microphone or keyboard, which is converted into a UTF-8 string through speech recognition or keyboard encoding, then converted into a data unit sequence (token sequence) by a word segmenter, and sent to the first storage partition.
[0024] The first machine learning model was obtained by replacing the language generation head of the base model with a linear classification layer; fine-tuning the linear classification layer and the shallow attention layer based on the intent classification dataset to obtain the first machine learning model; the shallow attention layer includes the self-attention module in the encoder blocks of layers 1 to 3. The self-attention module includes Q, K, and V projection matrices, which are the nine projection matrices corresponding to the shallow attention layer.
[0025] The process of replacing the language generation head of the base model with a linear classification layer can be as follows: First, obtain the pre-trained base model weight file and load it into memory; then, delete the weight matrix and bias vector of the last linear projection layer of the base model from the computation graph, release the corresponding video memory or memory, that is, remove the original language generation head; then, create a new linear classification layer with an input dimension of K1 (e.g., 4096) and an output dimension of K2 (representing the total number of intent labels, such as 128), initialize the weights of the linear classification layer, and attach the linear classification layer to the position of the original language generation head, that is, after the layer normalization (LayerNorm) output of an encoder block (Transformer block).
[0026] Fine-tuning can be done using Low-Rank Adaptation (LoRA). During training, the LoRA fine-tuning parameters are: rank of the low-rank matrix is 8, scaling factor is 16, and dropout rate is 0.05. The intent classification dataset can be data annotated by business experts (e.g., 5000 annotated samples covering 64 intent labels in the civil aviation maintenance field). Training parameters can be set to: 3 epochs, learning rate 1e-4, batch size 32, and cross-entropy loss function. In this embodiment, because the language generation head is removed, the first machine learning model cannot map the hidden layer representations to the vocabulary space, and therefore cannot perform autoregressive token generation; the processor can only read the intent ID and its confidence from the classification layer.
[0027] S120, determine the target intent label from multiple initial intent labels based on confidence level, a first preset threshold and a second preset threshold.
[0028] In this embodiment, a dual threshold determination is performed on the initial intent label output by the first machine learning module and the confidence level corresponding to each initial query intent label to obtain the target intent label.
[0029] Optionally, the method for determining the target intent label from multiple initial intent labels based on confidence level, a first preset threshold, and a second preset threshold can be as follows: obtain the highest confidence level and the second highest confidence level among multiple confidence levels; if the highest confidence level and the second highest confidence level meet the following conditions, then the initial intent label corresponding to the highest confidence level is determined as the target intent label: the highest confidence level is greater than or equal to the first preset threshold, and the difference between the highest confidence level and the second highest confidence level is greater than or equal to the second preset threshold; wherein, the first preset threshold is greater than the second preset threshold.
[0030] The highest confidence level can be represented as Top1 confidence level c1, and the second highest confidence level can be represented as Top2 confidence level c2. The first preset threshold can be obtained through calibration. Specifically, an offline validation set containing intent samples and noise samples is constructed, and false trigger rate-threshold curves and rejection rate-threshold curves are plotted. The c1 value, which is the intersection of the two curves or the closest to the intersection, is selected as the initial value of the first preset threshold. Then, it is fine-tuned according to the emphasis on security and availability in the business scenario. Example data: In a set of validation experiments in the civil aviation maintenance field, when the first preset threshold is gradually adjusted from 0.1 to 0.5, the two reach an equilibrium point near T_abs≈0.3. Therefore, the first preset threshold can be set to 0.3. The second preset threshold can be set to 0.1.
[0031] In this embodiment, if the highest confidence level is less than the first preset threshold, the input can be determined to be noise, meaning that the user input does not match any predefined intent, such as random characters or irrelevant questions. In this case, the user can be prompted to re-enter the input. If the difference between the highest confidence level and the second highest confidence level is less than the second preset threshold, it is determined that there is multiple intent ambiguity, and the user can be prompted to confirm the multiple intents.
[0032] In this embodiment, if the highest confidence level is greater than or equal to the first preset threshold, and the difference between the highest confidence level and the second highest confidence level is greater than or equal to the second preset threshold, it indicates that the user's input intent is clear. At this time, the initial intent label corresponding to the highest confidence level is determined as the target intent label.
[0033] S130, determine the target data source based on the target intent label and the preset mapping relationship.
[0034] The target data source includes static data sources and dynamic data sources, and the preset mapping relationship includes the relationship between intent tags and data source identifiers.
[0035] The preset mapping relationship may also include the intent name corresponding to the intent label and the type of data source (static or dynamic).
[0036] S140, Query target information from the target data source based on the query text.
[0037] Optionally, the method of retrieving target information from the target data source based on the query text can be as follows: if the target data source is a static data source, then query the first information from the target data source based on the query text; determine the first similarity hash value of the first information; determine the distance between the first similarity hash value and the second similarity hash value; wherein the second similarity hash value is predetermined and stored in a preset database; if the distance is less than a third preset threshold, then determine the first information as the target information.
[0038] In this embodiment, if the target data source is a static data source, the binary raw data stream (i.e., the first information) is obtained from the target data source. For example, a data block of 4096 bytes in length is read from offset address 0x1A3F00, its SimHash value is calculated, i.e., the first similar hash value, and then compared with the second similar hash value corresponding to the target data source stored in the benchmark library. If the Hamming distance between the first similar hash value and the second similar hash value is greater than or equal to a third preset threshold, a data integrity alarm is triggered and the query is terminated. If the Hamming distance between the first similar hash value and the second similar hash value is less than the third preset threshold, the first information is determined as the target information.
[0039] Optionally, the method for retrieving target information from the target data source based on the query text can be as follows: if the target data source is a dynamic data source, obtain the query statement template corresponding to the target data source; extract key fields from the query text and perform character validation on the key fields; add the key fields that pass the character validation to the query statement template to obtain the query statement; and retrieve the target information from the target data source based on the query statement.
[0040] The query template can be a Structured Query Language (SQL) template. Key fields can be extracted from the query text using regular expressions. Character validation of key fields can be based on preset character rules. For example, assuming the key fields are flight number and date, the regular expression for flight number is: r'([AZ]{2,3}\d{3,4})' (matching formats such as CA1234 and CZ888), and the regular expression for date is: r'(\d{4}-\d{2}-\d{2})' (matching the YYYY-MM-DD format). The character validation rules may include: only allowing uppercase letters A and Z, numbers 0-9, hyphens "-", and spaces " ", validated using the regular expression r'^[A-Z0-9\- ]+$'; if validation fails, the query operation is rejected and "parameter format error" is output; if validation passes, the key fields that passed the character validation are added to the query statement template to obtain the query statement, and the target information is queried from the target data source based on the query statement.
[0041] S150, verify the target information and obtain the verified target information.
[0042] In this embodiment, the target information is verified, including at least one of the following: data source version verification, sensitive word verification, data source permission verification, and preset information masking processing.
[0043] The data source version verification method can be as follows: compare the version number of the target data source with the currently effective version number (stored in the system configuration table). If the two are inconsistent, the target information verification fails, the target information is intercepted, and the message "The data source version has expired. Please contact the administrator to update" is displayed.
[0044] The sensitive word verification method can be as follows: scan the target information for preset sensitive words (such as "emergency", "independent judgment", "bypass inspection", etc., a total of 128 keywords, stored in an encrypted configuration file in a trusted storage partition); if a match is found, execute the preset policy. The preset policy can be: add a warning label to the target information, for example: the content involves sensitive operations, please review; or, block the target information, i.e., refuse to output it.
[0045] The data source permission verification methods can be as follows: verifying whether the user has the permission to operate the corresponding query statement template based on the user role (such as "repair technician", "dispatcher", "administrator") (determined through the role-query statement template permission mapping table); and verifying whether the data tables and fields of the query design are all in the whitelist.
[0046] The preset information can be private information. Parts of the preset information can be obscured.
[0047] Optionally, after obtaining the verified target information, the method further includes: inputting the target information and query text into a second machine learning model and outputting the adjusted target information; wherein the second machine learning model is configured with system prompt constraints and logarithmic probability processing constraints.
[0048] The second machine learning model can be a lightweight generative model. System prompt constraints are used to constrain the model's output content and format. Before inputting the model, the target information and query text are concatenated with the system prompt to form the first piece of information in the dialogue context. For example, the system prompt constraint could be: "You are an intelligent question-and-answer assistant in the civil aviation field. Your task is simply to answer user questions in natural language based on the content in the [Data] field provided by the user. You must strictly adhere to the following rules: 1. Use only factual information from the [Data] field; do not introduce any external knowledge; 2. Do not modify, infer, or expand any facts in the data; 3. If the [Data] field does not contain information to answer the question, you must answer 'The question cannot be answered based on the existing data'; 4. Do not summarize, generalize, or rewrite the data; the numerical values, terms, and numbers in the original data must remain consistent with the original text; 5. The output format is: [Answer]... [Data Source] Version Number: XXX, Verification Status: Passed."
[0049] The logarithmic probability constraint can be obtained as follows: Before inputting the data into the second machine learning model, the original data text is segmented, and the set of all appearing token IDs is extracted (e.g., after segmenting the data text "Flight CZ1234 status is delayed", token IDs [101, 2345, 4567, 89, ...] are obtained). This set is used as allowed_tokens. During the generation process, when the model attempts to generate tokens related to the data fields, the probability constraint module sets the logarithmic probability of non-allowed_tokens to negative infinity, forcing the model to select only tokens that have appeared in the data, thereby suppressing illusions at the decoding level.
[0050] The technical solution of this embodiment involves inputting query text into a first machine learning model, which outputs multiple initial intent tags and the confidence scores corresponding to each initial query intent tag. The first machine learning model is obtained by structurally pruning a base large language model. A target intent tag is determined from the multiple initial intent tags based on the confidence score, a first preset threshold, and a second preset threshold. A target data source is determined based on the target intent tag and a preset mapping relationship. The target data source includes static and dynamic data sources, and the preset mapping relationship includes the relationship between intent tags and data source identifiers. Target information is queried from the target data source based on the query text. The target information is then verified to obtain the verified target information. This approach can improve the accuracy and reliability of information retrieval.
[0051] Example 2 Figure 2 This is a schematic diagram of the structure of an information query device provided in an embodiment of the present invention. Figure 2 As shown, the device specifically includes: The query text input module 210 is used to input the query text into the first machine learning model and output multiple initial intent labels and the confidence scores corresponding to each initial query intent label; the first machine learning model is obtained by structural pruning of the base large language model. The target intent label determination module 220 is used to determine a target intent label from the plurality of initial intent labels based on the confidence level, a first preset threshold, and a second preset threshold. The target data source determination module 230 is used to determine the target data source based on the target intent tag and the preset mapping relationship; wherein, the target data source includes static data source and dynamic data source, and the preset mapping relationship includes the relationship between intent tag and data source identifier; Information query module 240 is used to query target information from the target data source based on the query text; The information verification module 250 is used to verify the target information and obtain the verified target information.
[0052] Optionally, the first machine learning model can be obtained as follows: Replace the language generation head of the base model with a linear classification layer; The first machine learning model is obtained by fine-tuning the linear classification layer and the shallow attention layer based on the intent classification dataset; wherein the shallow attention layer includes the self-attention module in the encoder blocks of layers 1 to 3.
[0053] Optionally, the target intent label determination module 220 is also used for: Obtain the highest and second-highest confidence scores from multiple confidence levels; If the highest confidence level and the second highest confidence level satisfy the following conditions, then the initial intent label corresponding to the highest confidence level is determined as the target intent label: the highest confidence level is greater than or equal to the first preset threshold, and the difference between the highest confidence level and the second highest confidence level is greater than or equal to the second preset threshold; wherein, the first preset threshold is greater than the second preset threshold.
[0054] Optionally, the information query module 240 is also used for: If the target data source is a static data source, then first information is retrieved from the target data source based on the query text; Determine the first similarity hash value of the first information; Determine the distance between the first similar hash value and the second similar hash value; wherein the second similar hash value is predetermined and stored in a preset database; If the distance is less than a third preset threshold, then the first information is determined as the target information.
[0055] Optionally, the information query module 240 is also used for: If the target data source is a dynamic data source, obtain the query statement template corresponding to the target data source; Extract key fields from the query text and perform character validation on the key fields; Add the key fields that pass character validation to the query statement template to obtain the query statement; Based on the query statement, retrieve target information from the target data source.
[0056] Optionally, the information verification module 250 is also used for: data source version verification, sensitive word verification, data source permission verification, and preset information masking processing.
[0057] Optionally, it also includes: an information adjustment module, used for: The target information and the query text are input into the second machine learning model, and the adjusted target information is output; wherein, the second machine learning model is configured with system prompt constraints and logarithmic probability processing constraints.
[0058] The above-described products can perform the methods provided in any embodiment of the present invention, and have the corresponding functional modules and beneficial effects for performing the methods.
[0059] Example 3 Figure 3A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0060] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory 12 or a random access memory 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 12 or loaded from storage unit 18 into the random access memory 13. The random access memory 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, read-only memory 12, and random access memory 13 are interconnected via a bus 14. An input / output interface 15 is also connected to the bus 14.
[0061] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0062] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing units, graphics processing units, various special-purpose artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as information query methods.
[0063] In some embodiments, the information query method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via read-only memory 12 and / or communication unit 19. When the computer program is loaded into random access memory 13 and executed by processor 11, one or more steps of the information query method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the information query method by any other suitable means (e.g., by means of firmware).
[0064] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard products (ASICs), systems-on-a-chip (SoCs), payload programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0065] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0066] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, optical fibers, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0067] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a cathode ray tube or liquid crystal display) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0068] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0069] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to address the shortcomings of traditional physical hosts and virtual private servers, such as high management difficulty and weak business scalability.
[0070] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0071] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the information query method according to any embodiment of the invention.
[0072] In the implementation of a computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0073] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. An information retrieval method, characterized in that, include: The query text is input into the first machine learning model, which outputs multiple initial intent labels and the confidence scores corresponding to each initial query intent label; the first machine learning model is obtained by structural pruning of the base large language model. The target intent tag is determined from the plurality of initial intent tags based on the confidence level, the first preset threshold, and the second preset threshold; The target data source is determined based on the target intent tag and the preset mapping relationship; wherein, the target data source includes static data sources and dynamic data sources, and the preset mapping relationship includes the relationship between intent tags and data source identifiers; Based on the query text, retrieve target information from the target data source; The target information is verified to obtain the verified target information.
2. The method according to claim 1, characterized in that, The first machine learning model is obtained as follows: Replace the language generation head of the base model with a linear classification layer; The first machine learning model is obtained by fine-tuning the linear classification layer and the shallow attention layer based on the intent classification dataset; wherein the shallow attention layer includes the self-attention module in the encoder blocks of layers 1 to 3.
3. The method according to claim 1, characterized in that, Determining the target intent tag from the plurality of initial intent tags based on the confidence level, the first preset threshold, and the second preset threshold includes: Obtain the highest and second-highest confidence scores from multiple confidence levels; If the highest confidence level and the second highest confidence level satisfy the following conditions, then the initial intent label corresponding to the highest confidence level is determined as the target intent label: the highest confidence level is greater than or equal to the first preset threshold, and the difference between the highest confidence level and the second highest confidence level is greater than or equal to the second preset threshold; wherein, the first preset threshold is greater than the second preset threshold.
4. The method according to claim 1, characterized in that, Based on the query text, query target information from the target data source, including: If the target data source is a static data source, then first information is retrieved from the target data source based on the query text; Determine the first similarity hash value of the first information; Determine the distance between the first similar hash value and the second similar hash value; wherein the second similar hash value is predetermined and stored in a preset database; If the distance is less than a third preset threshold, then the first information is determined as the target information.
5. The method according to claim 1, characterized in that, Based on the query text, query target information from the target data source, including: If the target data source is a dynamic data source, obtain the query statement template corresponding to the target data source; Extract key fields from the query text and perform character validation on the key fields; Add the key fields that pass character validation to the query statement template to obtain the query statement; Based on the query statement, retrieve target information from the target data source.
6. The method according to claim 4 or 5, characterized in that, The target information is verified, including at least one of the following: data source version verification, sensitive word verification, data source permission verification, and preset information masking processing.
7. The method according to claim 1, characterized in that, After obtaining the verified target information, the following is also included: The target information and the query text are input into the second machine learning model, and the adjusted target information is output; wherein, the second machine learning model is configured with system prompt constraints and logarithmic probability processing constraints.
8. An information query device, characterized in that, include: The query text input module is used to input query text into the first machine learning model and output multiple initial intent labels and the confidence scores corresponding to each initial query intent label; the first machine learning model is obtained by structural pruning of the base large language model. The target intent label determination module is used to determine a target intent label from the plurality of initial intent labels based on the confidence level, a first preset threshold, and a second preset threshold; The target data source determination module is used to determine the target data source based on the target intent tag and the preset mapping relationship; wherein, the target data source includes static data sources and dynamic data sources, and the preset mapping relationship includes the relationship between intent tags and data source identifiers; The information query module is used to query target information from the target data source based on the query text; The information verification module is used to verify the target information and obtain the verified target information.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the information query method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the information query method according to any one of claims 1-7.
