Word list query method and device, computer equipment and storage medium
By converting the vocabulary probability of the large language model into qubits and processing them using the Grover algorithm, the problem of slow prediction speed of the large language model is solved, and efficient vocabulary query under large-scale data is achieved.
Patent Information
- Application Number
- CN202411780592.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-21
AI Technical Summary
As the number of vocabulary lists increases, the prediction speed of large language models when selecting target words is slower and cannot meet actual needs.
By converting the probabilities predicted by the model into qubits and performing additions, adjusting the probability to a preset threshold, the target qubits are processed using the Grover algorithm to determine the target quotation.
It significantly reduces the complexity of traditional searches, from O(N) to O(n^0.5), improves computing efficiency and response speed, especially when processing large-scale data.
Smart Images

Figure CN119669441A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a vocabulary query method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of models, large language models came into being and performed well in many fields such as intelligent question answering and document generation. In large language models, the vocabulary is an indispensable component. Vocabulary query usually relies on the model's tokenizer. Large language models output the probability value of each vocabulary and select the target word based on these probability values. However, as the number of vocabularies continues to increase, the time required to select the target word also increases, which causes the prediction speed of large language models to slow down and cannot meet actual needs. Summary of the invention
[0003] Based on this, it is necessary to provide a vocabulary query method, device, computer equipment, computer readable storage medium and computer program product to address the above technical problems.
[0004] In a first aspect, the present application provides a vocabulary query method. The method comprises:
[0005] Get the probability of each vocabulary predicted by the preset model;
[0006] Determining the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary; wherein the quantum bits are used to characterize the state of each vocabulary; and the state includes a quantum mapping of the probabilities of each vocabulary;
[0007] The qubits of each vocabulary are added together, and the probability of each qubit after the addition is adjusted to a preset threshold value to obtain a target qubit;
[0008] The target quantum bits are processed using the preset Grover algorithm to determine the target vocabulary.
[0009] In one embodiment, determining the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary includes:
[0010] Using the preset effective bit threshold, the invalid bits of the probability of each word list are deleted to obtain the standard probability of each word list;
[0011] The quantum bits of each vocabulary are determined according to the standard probabilities of each vocabulary.
[0012] In one embodiment, the process of processing the target quantum bits using a preset Grover algorithm to determine the target vocabulary includes:
[0013] Using the preset Grover algorithm, the target quantum bits are processed to obtain the sub-target vocabulary;
[0014] When the number of the sub-target vocabulary does not reach the preset number, the quantum bits corresponding to each sub-target vocabulary are deleted from the target quantum bits, and the target quantum bits are processed using a preset Grover algorithm to obtain the next sub-target vocabulary;
[0015] When the number of the sub-target word lists reaches a preset number, all the sub-target word lists are determined as target word lists.
[0016] In one embodiment, the method for obtaining the preset threshold includes:
[0017] Get the number of words predicted by the preset model;
[0018] Performing arithmetic square root processing on the number of words in the vocabulary to obtain an initial threshold;
[0019] The initial threshold is processed inversely to obtain a preset threshold.
[0020] In one embodiment, the process of processing the target quantum bits using a preset Grover algorithm to determine the target vocabulary includes:
[0021] Using the preset Grover algorithm, the quantum mapping of the probability of each vocabulary in the target quantum bit is adjusted to obtain the target probability of each vocabulary;
[0022] A target vocabulary is determined according to the target probabilities of the various vocabulary.
[0023] In one embodiment, the use of a preset Grover algorithm to adjust the quantum mapping of the probability of each vocabulary in the target quantum bit to obtain the target probability of each vocabulary includes:
[0024] Using the preset Grover algorithm, a candidate word list is selected from the target quantum bit, and the quantum mapping corresponding to the candidate word list is amplified;
[0025] When the number of times of the amplification processing does not reach the preset number of times, a preset Grover algorithm is used to select a candidate word list from the target quantum bit, and amplify the quantum mapping corresponding to the candidate word list;
[0026] When the number of times of the amplification process reaches a preset number, the probability of each vocabulary is obtained from the target quantum bit.
[0027] In a second aspect, the present application also provides a vocabulary query device. The device comprises:
[0028] A data acquisition module is used to obtain the probability of each vocabulary predicted by a preset model;
[0029] A quantum conversion module, used to determine the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary; wherein the quantum bits are used to characterize the state of each vocabulary; and the state includes a quantum mapping of the probabilities of each vocabulary;
[0030] A quantum superposition module is used to add the quantum bits of each vocabulary, adjust the probability of each added quantum bit to a preset threshold, and obtain a target quantum bit;
[0031] The vocabulary determination module is used to process the target quantum bits using the preset Grover algorithm to determine the target vocabulary.
[0032] In one embodiment, the quantum conversion module comprises:
[0033] The invalid deletion submodule is used to delete the invalid bits of the probability of each vocabulary using a preset valid bit threshold to obtain the standard probability of each vocabulary;
[0034] The quantum conversion submodule is used to determine the quantum bits of each vocabulary according to the standard probability of each vocabulary.
[0035] In one embodiment, the vocabulary determination module includes:
[0036] A sub-target word list acquisition sub-module is used to process the target quantum bits using a preset Grover algorithm to obtain a sub-target word list;
[0037] A target word list acquisition submodule is used to delete the quantum bits corresponding to each sub-target word list from the target quantum bits when the number of the sub-target word lists does not reach a preset number, and use a preset Grover algorithm to process the target quantum bits to obtain the next sub-target word list;
[0038] The target vocabulary determination submodule is used to determine all sub-target vocabulary as target vocabulary when the number of the sub-target vocabulary reaches a preset number.
[0039] In one embodiment, the quantum superposition module comprises:
[0040] The quantity acquisition submodule is used to obtain the number of vocabulary predicted by the preset model;
[0041] A threshold determination submodule, used for performing arithmetic square root processing on the number of the word list to obtain an initial threshold;
[0042] The threshold determination submodule is used to perform inverse processing on the initial threshold to obtain a preset threshold.
[0043] In one embodiment, the vocabulary determination module includes:
[0044] A probability adjustment submodule, for adjusting the quantum mapping of the probability of each vocabulary in the target quantum bit using a preset Grover algorithm to obtain the target probability of each vocabulary;
[0045] The vocabulary determination submodule is used to determine the target vocabulary according to the target probabilities of the various vocabularies.
[0046] In one embodiment, the probability adjustment submodule includes:
[0047] A quantum mapping amplification unit, used to select a candidate word list from the target quantum bit using a preset Grover algorithm, and amplify the quantum mapping corresponding to the candidate word list;
[0048] The quantum mapping amplification unit is further configured to select a candidate word list from the target quantum bit using a preset Grover algorithm and amplify the quantum mapping corresponding to the candidate word list when the number of amplification processes does not reach a preset number;
[0049] The target vocabulary determination unit is used to obtain the probability of each vocabulary from the target quantum bit when the number of times of the amplification process reaches a preset number.
[0050] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the word list query method as described in any one of the embodiments of the present disclosure is implemented.
[0051] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the word list query method as described in any one of the embodiments of the present disclosure is implemented.
[0052] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the word list query method as described in any one of the embodiments of the present disclosure is implemented.
[0053] The above-mentioned vocabulary query method, device, computer equipment, storage medium and computer program product convert the probability of each vocabulary predicted by the model into quantum bits, determine the target quantum bits after superposition, and use the Grover algorithm to process the target quantum bits to obtain the target vocabulary. By obtaining the probability of each vocabulary predicted by the preset model and mapping it to quantum bits, the advantages of quantum computing can be effectively utilized. These quantum bits are added and their probabilities are adjusted according to the preset threshold to generate target quantum bits, which can compress information and optimize the representation of the vocabulary. The key to this process is to use the Grover algorithm, which can efficiently search the target vocabulary with a complexity of O(n^0.5) in given unstructured data, significantly reducing the O(N) complexity of traditional search. This enables the system to quickly locate the required results in a large number of candidate vocabulary, improve computing efficiency and response speed, especially when processing large-scale data, the advantages are more obvious. In this way, not only the query efficiency of the target vocabulary is improved, but also strong data support is provided for the query of the target vocabulary, further improving the accuracy of the target vocabulary. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A flowchart of a vocabulary query method in one embodiment;
[0055] Figure 2 A schematic diagram of a process of quantum bit conversion in one embodiment;
[0056] Figure 3 A schematic diagram of a process for determining sub-goal vocabulary lists in one embodiment;
[0057] Figure 4 A schematic diagram of a process for obtaining a prediction threshold in one embodiment;
[0058] Figure 5 A schematic diagram of a process for determining a target vocabulary in one embodiment;
[0059] Figure 6 A schematic diagram of a process for determining word list probability in one embodiment;
[0060] Figure 7 A structural block diagram of a vocabulary query device in one embodiment;
[0061] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0063] In one embodiment, Figure 1 As shown, a vocabulary query method is provided. This embodiment uses the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0064] Step S100, obtaining the probability of each vocabulary predicted by the preset model.
[0065] In an exemplary embodiment, the preset model may include a large language model, etc. Specifically, the preset model may be used for text translation, sentiment analysis, text generation, question-answering system, etc. In an exemplary embodiment, the vocabulary may include words, etc., that is, the probability of each word predicted by the model is obtained.
[0066] In an exemplary embodiment, the acquisition of the probabilities of the various vocabularies may include the softmax layer of the large language model outputting the probability of each vocabularies, etc.
[0067] Step S200, determining the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary; wherein the quantum bits are used to characterize the state of each vocabulary; and the state includes a quantum mapping of the probabilities of each vocabulary.
[0068] In an exemplary embodiment, the probabilities of each received vocabulary can be prepared on the quantum bit position, and the quantum bits of each vocabulary can be determined.
[0069] In an exemplary embodiment, the quantum bits for determining each vocabulary can be converted using the following formula (1):
[0070] (1)
[0071] Among them, |data> represents the quantum bit after the vocabulary conversion; q1, q2, q3....q n Respectively mark the status of different vocabularies (selected, not selected, etc.).
[0072] In an exemplary embodiment, the state of the qubit may include selected, unselected, zero state, one state, high-order qubit, etc. The quantum mapping of the probability of each vocabulary may include the arithmetic square root of the probability that the vocabulary is a certain state, etc.
[0073] Step S300, adding the quantum bits of each vocabulary, adjusting the probability of each added quantum bit to a preset threshold, and obtaining a target quantum bit.
[0074] In an exemplary embodiment, the adding of the quantum bits may include initializing the superposition state, etc. Specifically, the following formula (2) may be used to obtain:
[0075] (2)
[0076] Where |D> represents the superposed quantum bit; N represents the number of words; data i Represents the quantum bit corresponding to the i-th vocabulary, etc.
[0077] Step S400, using a preset Grover algorithm to process the target quantum bits and determine the target vocabulary.
[0078] In an exemplary embodiment, the Grover algorithm may include designing a quantum search operator Grover, amplifying the probability amplitude of the maximum value in the target quantum bit, and repeating the operation n^0.5 times, so as to achieve a probability of the target vocabulary close to 100%, and a probability of the non-target vocabulary close to zero; it can be understood here that since only n^0.5 operations need to be repeated. Therefore, in this embodiment, the query complexity of the target vocabulary is only O (n^0.5), etc.; in actual use, in order to improve efficiency or improve accuracy, the number of repetitions can be adjusted; specifically, it is known through experiments that repeating n^0.5 times can achieve dual guarantees of accuracy and efficiency, etc.
[0079] In an exemplary embodiment, after the Grover algorithm is processed, the measurement probability of each state can be obtained, and the state index index with the largest probability value is taken as the index of the target vocabulary, etc.
[0080] In an exemplary embodiment, the vocabulary query can be applied to a large language model, and specifically to a question-answering model, which can include responding to a question statement sent by an account. The preset model analyzes the question statement and predicts the probability of each vocabulary, and uses the vocabulary query method to determine the target vocabulary from each vocabulary and output it.
[0081] In the above-mentioned vocabulary query method, the probability of each vocabulary predicted by the model is converted into quantum bits, and the target quantum bits are determined after superposition, and the target quantum bits are processed using the Grover algorithm to obtain the target vocabulary. By obtaining the probability of each vocabulary predicted by the preset model and mapping it to quantum bits, the advantages of quantum computing can be effectively utilized. These quantum bits are added and their probabilities are adjusted according to the preset threshold to generate target quantum bits, which can compress information and optimize the representation of the vocabulary. The key to this process is to use the Grover algorithm, which can efficiently search for the target vocabulary with a complexity of O(n^0.5) in given unstructured data, significantly reducing the O(N) complexity of traditional search. This enables the system to quickly locate the required results in a large number of candidate vocabulary, improves computing efficiency and response speed, and the advantages are more obvious when processing large-scale data. In this way, not only the query efficiency of the target vocabulary is improved, but also strong data support is provided for the query of the target vocabulary, further improving the accuracy of the target vocabulary.
[0082] In one embodiment, Figure 2 As shown, according to the predicted probabilities of each vocabulary, the quantum bits of each vocabulary are determined, including:
[0083] Step S201 , using a preset effective bit threshold, deletes the invalid bits of the probability of each word list to obtain the standard probability of each word list.
[0084] Step S202, determining the quantum bits of each vocabulary according to the standard probability of each vocabulary.
[0085] In an exemplary embodiment, the effective bit threshold may include maintaining the number of bits of the probability value within the effective bit threshold through the effective bit threshold, thereby preventing the number of bits of the probability value from being too large and affecting the query efficiency, etc. In another exemplary embodiment, deleting the invalid bits of the word table probability through the effective bit threshold may include maintaining the data of the effective bits, deleting the data other than the effective bits, etc.
[0086] In this embodiment, by using a preset valid bit threshold to delete invalid bits in each word list probability, a standard probability is obtained, and then converted into a quantum bit, the efficiency of quantum computing can be significantly optimized. This process reduces the number of data bits required to be processed and the complexity of the quantum bit, thereby saving storage and computing resources when representing and calculating the quantum state. The simplified standard probability can speed up subsequent quantum processing and improve the performance of the quantum algorithm (Grover algorithm) when searching and identifying the target word list. This high efficiency is particularly important for processing large-scale data and real-time applications, ensuring that the system maintains a high level of prediction accuracy while shortening response time.
[0087] In one embodiment, Figure 3 As shown, the target quantum bit is processed by using the preset Grover algorithm to determine the target vocabulary, including:
[0088] Step S401, using the preset Grover algorithm, the target quantum bits are processed to obtain a sub-target vocabulary.
[0089] Step S402, when the number of the sub-target vocabulary does not reach the preset number, the quantum bits corresponding to each sub-target vocabulary are deleted from the target quantum bits, and the target quantum bits are processed using the preset Grover algorithm to obtain the next sub-target vocabulary.
[0090] Step S403: when the number of the sub-target word lists reaches a preset number, all the sub-target word lists are determined as target word lists.
[0091] In an exemplary embodiment, after the Grover algorithm processes the target quantum bit, a sub-target word list can be obtained. However, in actual use, the Top-k results are usually selected, that is, multiple results are selected, so the target word list includes multiple sub-target word lists, etc. If the sub-target word list does not reach the preset number, all the sub-target word lists that have been obtained can be deleted in the target quantum bit, and the target quantum bit can continue to be processed with the Grover algorithm to obtain the next sub-target word list, etc., until the number of sub-target word lists meets the preset number, etc.
[0092] In this embodiment, the scheme of gradually acquiring multiple sub-target vocabularies by processing the target qubits using the preset Grover algorithm has significant advantages. First, such a method allows for dynamic adjustment and optimization of the search process, ensuring that only the most relevant qubits are focused on in each iteration, thereby improving computational efficiency. When the number of sub-target vocabularies has not yet reached the preset standard, the search space can be reduced and the computational burden can be reduced by deleting qubits that are not relevant to the current sub-target vocabularies. This enables the algorithm to quickly focus on the most promising candidates and improve the speed and accuracy of finding the final target vocabularies. At the same time, multiple iterations to acquire sub-target vocabularies can help the system better explore potential combinations in the probability distribution, improve the richness and diversity of the results, and thus provide a more comprehensive basis for the final decision.
[0093] In one embodiment, Figure 4 As shown, the method for obtaining the preset threshold includes:
[0094] Step S301, obtaining the number of vocabulary predicted by the preset model.
[0095] Step S302: Perform arithmetic square root processing on the number of words in the vocabulary to obtain an initial threshold.
[0096] Step S303, performing inverse processing on the initial threshold to obtain a preset threshold.
[0097] In this embodiment, the preset threshold is determined by the number of vocabularies. It can not only effectively balance the data scale and the threshold setting, but also reduce the computational complexity. The square root operation is usually more efficient than direct calculation of large values, because it can convert the large number of vocabularies into smaller values, thereby reducing the computational burden of subsequent processing. This means that when performing subsequent reciprocal processing, the input value processed is smaller, which can increase the calculation speed. In addition, the adaptability of the square root to extreme values can also reduce the threshold instability caused by data fluctuations, so that the system remains consistent and reliable under data of different scales. Ultimately, this method helps to improve the performance and accuracy of the overall system, making the determination of the target vocabulary more rapid and effective.
[0098] In one embodiment, Figure 5 As shown, the target quantum bit is processed by using the preset Grover algorithm to determine the target vocabulary, including:
[0099] Step S411, using the preset Grover algorithm, adjust the quantum mapping of each vocabulary probability in the target quantum bit to obtain the target probability of each vocabulary.
[0100] Step S412: determining a target vocabulary according to the target probabilities of the various vocabulary.
[0101] In an exemplary embodiment, it can be applied to natural language processing tasks, and the probability of each related vocabulary in the target quantum bit is adjusted using the preset Grover algorithm according to the query and context information input by the user, so as to optimize its quantum mapping, obtain the target probability of each vocabulary, and select the target vocabulary, etc. For example, in a model for processing an article summary generation, the probability of different vocabulary can be dynamically adjusted according to the context to better match the expected content of the account, etc.
[0102] In this embodiment, by accurately adjusting the probability of quantum bits, more efficient and accurate result screening can be achieved. This optimization not only improves the accuracy of the search, but also enhances the sensitivity to the context, making the final target vocabulary more relevant and practical, and improving the accuracy of the target vocabulary.
[0103] In one embodiment, Figure 6 As shown, the preset Grover algorithm is used to adjust the quantum mapping of the probability of each vocabulary in the target quantum bit to obtain the target probability of each vocabulary, including:
[0104] Step S421, using the preset Grover algorithm, select a candidate word list from the target quantum bit, and amplify the quantum mapping corresponding to the candidate word list.
[0105] Step S422, when the number of times of the amplification processing does not reach the preset number, a preset Grover algorithm is used to select a candidate word list from the target quantum bit, and the quantum mapping corresponding to the candidate word list is amplified.
[0106] Step S423, when the number of times of the amplification processing reaches a preset number, the probability of each vocabulary is obtained from the target quantum bit.
[0107] In an exemplary embodiment, the quantum search operator Grover in the Grover algorithm can be used to repeatedly amplify the quantum mapping corresponding to the candidate vocabulary in the target quantum bit, wherein the number of repetitions can be preset or confirmed according to the vocabulary, etc.; in actual use, it is usually set to n^0.5 times, where n represents the number of vocabularies, etc.
[0108] In this embodiment, it not only improves the accuracy and robustness of the target vocabulary, but also makes the system more flexible when processing complex queries or diverse data. After multiple rounds of amplification, the quantum mapping of the candidate phrases can better reflect the model prediction requirements, thereby improving the overall prediction efficiency and response speed. This method of enhancing effectiveness also reduces potential mismatches, thereby ensuring that the generated vocabulary is more in line with the requirements of actual application scenarios.
[0109] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0110] Based on the same inventive concept, the embodiment of the present application also provides a vocabulary query device for implementing the vocabulary query method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more vocabulary query device embodiments provided below can refer to the limitations of the vocabulary query method above, and will not be repeated here.
[0111] In one embodiment, Figure 7 As shown, a vocabulary query device 100 is provided, comprising: a data acquisition module 101, a quantum conversion module 102, a quantum superposition module 103 and a vocabulary determination module 104, wherein:
[0112] A data acquisition module is used to obtain the probability of each vocabulary predicted by a preset model;
[0113] A quantum conversion module, used to determine the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary; wherein the quantum bits are used to characterize the state of each vocabulary; and the state includes a quantum mapping of the probabilities of each vocabulary;
[0114] A quantum superposition module is used to add the quantum bits of each vocabulary, adjust the probability of each added quantum bit to a preset threshold, and obtain a target quantum bit;
[0115] The vocabulary determination module is used to process the target quantum bits using the preset Grover algorithm to determine the target vocabulary.
[0116] In one embodiment, the quantum conversion module comprises:
[0117] The invalid deletion submodule is used to delete the invalid bits of the probability of each vocabulary using a preset valid bit threshold to obtain the standard probability of each vocabulary;
[0118] The quantum conversion submodule is used to determine the quantum bits of each vocabulary according to the standard probability of each vocabulary.
[0119] In one embodiment, the vocabulary determination module includes:
[0120] A sub-target word list acquisition sub-module is used to process the target quantum bits using a preset Grover algorithm to obtain a sub-target word list;
[0121] A target word list acquisition submodule is used to delete the quantum bits corresponding to each sub-target word list from the target quantum bits when the number of the sub-target word lists does not reach a preset number, and use a preset Grover algorithm to process the target quantum bits to obtain the next sub-target word list;
[0122] The target vocabulary determination submodule is used to determine all sub-target vocabulary as target vocabulary when the number of the sub-target vocabulary reaches a preset number.
[0123] In one embodiment, the quantum superposition module comprises:
[0124] The quantity acquisition submodule is used to obtain the number of vocabulary predicted by the preset model;
[0125] A threshold determination submodule, used for performing arithmetic square root processing on the number of the word list to obtain an initial threshold;
[0126] The threshold determination submodule is used to perform inverse processing on the initial threshold to obtain a preset threshold.
[0127] In one embodiment, the vocabulary determination module includes:
[0128] A probability adjustment submodule, for adjusting the quantum mapping of the probability of each vocabulary in the target quantum bit using a preset Grover algorithm to obtain the target probability of each vocabulary;
[0129] The vocabulary determination submodule is used to determine the target vocabulary according to the target probabilities of the various vocabularies.
[0130] In one embodiment, the probability adjustment submodule includes:
[0131] A quantum mapping amplification unit, used to select a candidate word list from the target quantum bit using a preset Grover algorithm, and amplify the quantum mapping corresponding to the candidate word list;
[0132] The quantum mapping amplification unit is further configured to select a candidate word list from the target quantum bit using a preset Grover algorithm and amplify the quantum mapping corresponding to the candidate word list when the number of amplification processes does not reach a preset number;
[0133] The target vocabulary determination unit is used to obtain the probability of each vocabulary from the target quantum bit when the number of times of the amplification process reaches a preset number.
[0134] Each module in the above-mentioned vocabulary query device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0135] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store vocabulary data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a vocabulary query method is implemented.
[0136] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0137] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0138] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0139] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0140] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A vocabulary query method, characterized in that: The method comprises: Get the probability of each vocabulary predicted by the preset model; Determining the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary; wherein the quantum bits are used to characterize the state of each vocabulary; and the state includes a quantum mapping of the probabilities of each vocabulary; The qubits of each vocabulary are added together, and the probability of each qubit after the addition is adjusted to a preset threshold value to obtain a target qubit; The target quantum bits are processed using the preset Grover algorithm to determine the target vocabulary.
2. The method according to claim 1, characterized in that Determining the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary includes: Using the preset effective bit threshold, the invalid bits of the probability of each word list are deleted to obtain the standard probability of each word list; The quantum bits of each vocabulary are determined according to the standard probabilities of each vocabulary.
3. The method according to claim 1, characterized in that The method of using a preset Grover algorithm to process the target quantum bit and determine the target vocabulary includes: Using the preset Grover algorithm, the target quantum bits are processed to obtain the sub-target vocabulary; When the number of the sub-target vocabulary does not reach the preset number, the quantum bits corresponding to each sub-target vocabulary are deleted from the target quantum bits, and the target quantum bits are processed using a preset Grover algorithm to obtain the next sub-target vocabulary; When the number of the sub-target word lists reaches a preset number, all the sub-target word lists are determined as target word lists.
4. The method according to claim 1, characterized in that: The method for obtaining the preset threshold value includes: Get the number of words predicted by the preset model; Performing arithmetic square root processing on the number of words in the vocabulary to obtain an initial threshold; The initial threshold is processed inversely to obtain a preset threshold.
5. The method according to claim 1, characterized in that The method of using a preset Grover algorithm to process the target quantum bit and determine the target vocabulary includes: Using the preset Grover algorithm, the quantum mapping of the probability of each vocabulary in the target quantum bit is adjusted to obtain the target probability of each vocabulary; A target vocabulary is determined according to the target probabilities of the various vocabulary.
6. The method according to claim 1, characterized in that The method uses the preset Grover algorithm to adjust the quantum mapping of the probability of each vocabulary in the target quantum bit to obtain the target probability of each vocabulary, including: Using the preset Grover algorithm, a candidate word list is selected from the target quantum bit, and the quantum mapping corresponding to the candidate word list is amplified; When the number of times of the amplification processing does not reach the preset number of times, a preset Grover algorithm is used to select a candidate word list from the target quantum bit, and amplify the quantum mapping corresponding to the candidate word list; When the number of times of the amplification process reaches a preset number, the probability of each vocabulary is obtained from the target quantum bit.
7. A vocabulary query device, characterized in that: The device comprises: A data acquisition module is used to obtain the probability of each vocabulary predicted by a preset model; A quantum conversion module, used to determine the quantum bits of each vocabulary according to the predicted probabilities of each vocabulary; wherein the quantum bits are used to characterize the state of each vocabulary; and the state includes a quantum mapping of the probabilities of each vocabulary; A quantum superposition module is used to add the quantum bits of each vocabulary, adjust the probability of each added quantum bit to a preset threshold, and obtain a target quantum bit; The vocabulary determination module is used to process the target quantum bits using the preset Grover algorithm to determine the target vocabulary.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.