Patent Publication Number: US-2023147890-A1

Title: Quantum enhanced word embedding for natural language processing

Description:
BACKGROUND 
     Field of the Technology Disclosed 
     The disclosed technology generally relates to computer-implemented methods, systems, and computer programs for natural language processing (NLP). More particularly, the disclosed technology relates to a method, system, and computer program for quantum-enhanced word embedding using a hybrid quantum-classical computer. 
     Description of Related Art 
     The subject matter discussed in this section should not be assumed to be prior art merely as a result of its mention in this section. Similarly, any problems or shortcomings mentioned in this section or associated with the subject matter provided as background should not be assumed to have been previously recognized in the prior art. The subject matter in this section merely represents different approaches, which in and of themselves can also correspond to implementations of the claimed technology. 
     Natural Language Processing (NLP) is concerned with computer processing and analyzing large amounts of natural language data, with the purpose of better understanding human language and its interactions. Human language generally consists of words and sentences, and NLP attempts to extract information from these sentences. Words have associations with other words, and these associations can be classified as both semantic (related to its meaning) and a contextual relationship (related to its proximity to other words). 
     In natural language processing, the term word embedding refers to a method of text analysis in which words or word pairs are plotted in vector space so that words with similar semantic relationships and meanings are positioned closer in vector space. 
     Currently, many of the techniques of NLP involve machine learning methods, which are used to extract similar features from sample text. The size of the vector is equal to the number of elements in the vocabulary. A method known as “word2vec” requires a huge amount of training data associated with a vocabulary or a dictionary. These vocabularies and dictionaries often involve more than 100,000 words, and possibly much more. The object is to map all the words into vector space while preserving semantic relationships. 
     While some approaches to classifying words, such as bag of words (BOW), do not preserve semantic relationships, current word embedding methods such as word2vec place vectors of semantically similar items close to each other. Semantic similarity means that words with similar meaning have similar distances in vector space. A commonly used example is: king is to queen, as man is to woman. It is desirable, when words are mapped in vector space, that the distance metric between words with similar meaning will be minimized, thus preserving the semantic relationship between those words. Similarly, the distance metric between tenses of verbs will be minimized. A further example would be the encoding of countries, capital cities, and major cities. These are semantically similar and would advantageously be mapped with minimal distance metrics in vector space. Also, words that are analogically similar or have another known associations would be encoded to minimize distance metrics. 
     Word embedding has many practical uses, which will not be discussed here in any depth. For one example, recommendation engines may predict what a user would purchase based on historical purchases of other users with similar interests. This method is generally known as collaborative filtering, where similar products bought by multiple customers are embedded into neighboring vector space. Using methods such as nearest neighbor algorithms, similar products will be placed next to semantically similar items in vector space. 
     As the number of individual words to be classified increases according to the principles of word embedding, conventional methods of deep learning become increasingly costly in terms of required time and processing power. This is particularly true when performing word embedding for large vocabularies (100,000 words or more). 
     SUMMARY 
     The disclosed technology uses quantum computing technology to provide a solution to the challenges described above. The disclosed technology includes a method and system for generating a word embedding using quantum-assisted technology. Some particular implementations and features are described in the following discussion. The disclosed method for generating a word embedding is performed on a hybrid quantum-classical computer system, which may include both a classical computer component and a quantum computer component. The classical computer component includes a processor, a non-transitory computer-readable medium, and computer instructions stored in the non-transitory computer-readable medium. The quantum computer component includes a plurality of qubits, and accepts a sequence of instructions to evolve a quantum state based on a series of quantum gates. 
     When the computer instructions are executed, the hybrid quantum-classical computer performs a method for generating a word embedding for at least one pair of words. The classical computer includes a training set of training samples comprising (1) a word pair set, the word pair set comprising N pairs of words, wherein N≥1, and (2) for each pair of words P in the word pair set, a numerical value B P  indicating a classical correlation between the words in the pair of words P. 
     In one embodiment, the disclosed word embedding method generates, on the quantum computer, a plurality of quantum state representations including one quantum state representation for at least one word in the word pair set. A quantum correlation is trained between (1) words in a word pair X in the pairs of words on the quantum computer using an error function, (2) the numerical value B X  corresponding to the word pair X, and (3) the plurality of quantum state representations, the word embedding including the quantum correlation. 
     In another aspect, the method of training uses an engineered likelihood function to train the quantum correlation. The engineering likelihood function may be implemented as a parameterized quantum circuit. Also, the method of training may use Bayesian inference to train the quantum correlation. 
     The disclosed method is particularly applicable to large dictionaries or vocabularies of words, which can typically exceed 100,000, and may be multiples of 100,000 (e.g., greater than 200,000, greater than 500,000, and greater than 1,000,000). As previously stated, as the number of individual words to be classified increases according to the principles of word embedding, conventional methods of deep learning are very costly in terms of required time and classical processing power. This is particularly true when performing word embedding for large vocabularies (100,000 words or more). The disclosed quantum computing method for a hybrid classical-quantum computer can overcome these drawbacks by training quantum correlations. 
     In another aspect, the training set may include a set of triples (x, y, b). For each of the triples T: (1) x and y in triple T are two words in a corresponding pair of words in the word set, and (2) b in triple T is a binary value indicating whether the two words in the corresponding pair of words are semantically correlated. In one aspect of the disclosed method, for each pair of words P in the word pair set, the numerical value B P  comprises a binary value indicating whether the words in the pair of words P are semantically correlated. 
     The disclosed method may incorporate in the training set the use of the “skip-gram with negative sampling” method. Also, the training of the quantum correlation may use quantum amplitude estimation. This is particularly useful in noisy intermediate-scale quantum (NISQ) environments, which may have limited fault tolerance. All the above disclosed methods and concepts for quantum-assisted word embedding are useful in natural language processing (NLP) applications. 
     In another embodiment of the disclosed technology the level of association between each pair of words is determined by a distance metric. Also, the distance metric may be represented by a function of at least one quantum state. In a further aspect, the correlation between word pairs is a semantic correlation related to the meaning of the words in the word pair. For example, the words “man” and “woman” are semantically correlated as to gender. The tenses of verbs may be related in this way. In another aspect, the correlation between word pairs is a contextual correlation, having to do with the proximity of word pairs as found in sentences and textual expressions of language. 
     In a further aspect, the training may include evaluating each word pair using the SWAP test. In another aspect, the training may include testing the word embedding using overlap estimation. 
     In one embodiment, the method includes generating, on the quantum computer, the plurality of quantum state representations including one quantum state representation for each of the words in the N pairs of words in the word pair set. Also, the method may further comprise repeating the training for each word pair in the N pairs of words. As previously stated, the number of word pairs (N-pairs) may exceed 100,000 in the case of large vocabularies, dictionaries, and lexicons. 
     In another embodiment, the disclosed technology is a hybrid quantum-classical computer system for generating a word embedding. The system includes a classical computer and a quantum computer. The classical computer includes a processor, a non-transitory computer-readable medium, and computer instructions stored in the non-transitory computer-readable medium. The quantum computer includes a quantum component, having a plurality of qubits, which accepts a sequence of instructions to evolve a quantum state based on a series of quantum gates. The computer instructions, when executed by the processor, perform a method for generating, on the hybrid quantum-classical computer, a word embedding for at least one pair of words. The classical computer includes a training set of training samples comprising (1) a word pair set, the word pair set comprising N-pairs of words, wherein N≥1, and (2) for each pair of words P in the word pair set, a numerical value B P  indicating a classical correlation between the words in the pair of words P. The method for generating a word embedding includes generating, on the quantum computer, a plurality of quantum state representations including one quantum state representation for at least one word in the word pair set; and training a quantum correlation between (1) words in a word pair X in the pairs of words on the quantum computer using an error function, (2) the numerical value B X  corresponding to the word pair X, and (3) the plurality of quantum state representations, the word embedding including the quantum correlation. 
     In another aspect of the disclosed system, the method of training uses an engineered likelihood function to train the quantum correlation. The engineering likelihood function may be implemented as a parameterized or parametrized quantum circuit. Also, the method of training may use Bayesian inference to train the quantum correlation. Because of its quantum component, the disclosed system is applicable to training large sets of N-pairs, where N&gt;100,000 (e.g., N&gt;200,000, N&gt;300,000, N&gt;500,000, or N&gt;1,000,000). 
     In another aspect of the disclosed system, the training set may include a set of triples (x, y, b). For each of the triples T (1) x and y in triple T are two words in a corresponding pair of words in the word set, and (2) b in triple T is a binary value indicating whether the two words in the corresponding pair of words are semantically correlated. In one aspect of the disclosed system, for each pair of words P in the word pair set, the numerical value B P  comprises a binary value indicating whether the words in the pair of words P are semantically correlated. The system may generate, on the classical computer, the training set using the “skip-gram with negative sampling” method. Also, the training of the quantum correlation may use quantum amplitude estimation, particularly useful for noisy intermediate-scale quantum (NISQ) environments. The disclosed system, methods, and concepts for quantum-assisted word embedding are useful in natural language processing (NLP) applications. 
     In the disclosed system, the level of association between each pair of words may be determined by a distance metric. Also, the distance metric may be represented by a function of at least one quantum state. In a further aspect, the correlation between word pairs is a semantic correlation related to the meaning of the words in the word pair. For example, the words “man” and “woman” are semantically correlated as to gender. The tenses of verbs may be related in this way. In another aspect, the correlation between word pairs is a contextual correlation, having to do with the proximity of word pairs as found in sentences and textual expressions of language. 
     In a further aspect of the disclosed system, the training may include evaluating each word pair using the SWAP test. In another aspect, the training may include testing the word embedding using overlap estimation. In one embodiment, the method includes generating, on the quantum computer, the plurality of quantum state representations including one quantum state representation for each of the words in the N pairs of words in the word pair set. Also, the method may further comprise repeating the training for each word pair in the N pairs of words. As previously stated, the number of word pairs (N-pairs) may exceed 100,000 in the case of large vocabularies, dictionaries, and lexicons. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The disclosed technology, as well as a preferred mode of use and further objectives and advantages thereof, will best be understood by reference to the following detailed description of illustrative embodiments when read in conjunction with the accompanying drawings. In the drawings, like reference characters generally refer to like parts throughout the different views. The drawings are not necessarily to scale, with an emphasis instead generally being placed upon illustrating the principles of the technology disclosed. 
         FIG.  1    is a diagram of a quantum computer according to one embodiment of the present invention; 
         FIG.  2 A  is a flowchart of a method performed by the quantum computer of  FIG.  1    according to one embodiment of the present invention; 
         FIG.  2 B  is a diagram of a hybrid quantum-classical computer which performs quantum annealing according to one embodiment of the present invention; 
         FIG.  3    is a diagram of a hybrid quantum-classical computer according to one embodiment of the present invention; 
         FIG.  4    illustrates the concept of word embedding in n-dimensional vector space; 
         FIG.  5    illustrates as a block diagram the data flow of the disclosed method for quantum-assisted word embedding; 
         FIG.  6    illustrates the concept of parameterized word embedding starting with defining a training set followed by generating quantum state representations; 
         FIG.  7    illustrates the parameterized circuit for implementing the engineered likelihood function (ELF); and 
         FIG.  8    illustrates, as part of the engineered likelihood function (ELF), the geometric interpretation of θ as an angle parameter between |0  and |ξ =V \ W|0 ; and 
     
    
    
     DETAILED DESCRIPTION 
     Natural language processing (NLP) is a field of machine learning which has gained tremendous importance in the recent years. Central to many algorithms in NLP is the concept of word embedding, where each word x in a given dictionary of a language is mapped to a vector representation {right arrow over (v)} x . The quality of such representation can often be engaged by testing whether a certain analogy relationship holds. An example of such an analogy would be “king:man=queen:woman”, for which a good word embedding should approximately satisfy {right arrow over (ν)} king −{right arrow over (ν)} man +{right arrow over (ν)} woman ≈{right arrow over (ν)} queen . 
     In natural language processing, the term word embedding refers to a method of text analysis in which words or word pairs are plotted in vector space. Words with similar semantic relationships are positioned closer in vector space and are expected to be similar in meaning. The process involves mapping words into vector space so that pairs of related words preserve semantic relationships. 
     Referring to  FIG.  4   , these concepts are illustrated. Pairs of words are mapped into vector space so that word pairs that are related are closely mapped. Another way of saying this is that words that are related in meaning are mapped closely together in vector space. That is, they have a small metric distance. In the first drawing, the word pairs man-woman and king-queen are related semantically, denoting the relationship between male-female and their corresponding gender roles. These word pairs have been mapped in vector space with a minimal metric distance separating them. 
     Continuing with  FIG.  4   , in the middle illustration, the word pairs walked-walking and swam-swimming are related semantically by their meaning, in this case verb tense, as variations in the same semantic definitions. In the third illustration of  FIG.  4   , pairs of words are related to the concept of country-capital. Therefore, as an example, Italy is mapped in vector space with a minimum metric distance from Rome, and Russia is mapped in vector space with a minimum metric distance from Moscow. 
     Currently, many of the techniques of NLP involve machine learning methods, which are used to extract similar features from sample text. The size of the vector is equal to the number of elements in the vocabulary. Other approaches include more sophisticated deep learning methods. A method known as “word2vec” requires a huge amount of training data to be associated with the vocabulary contained in a dictionary. These vocabularies comprise dictionaries often involving more than 100,000 words, or even several hundred thousand words. 
     For common NLP tasks, such as sentimentality analysis and next word prediction (as implemented on many smartphone devices), a well-trained word embedding can serve as an advantageous starting point for more detailed natural language processing (NLP). In addition to the vector representations themselves, of equal importance is the distance metric used for evaluating the level of association between two words. 
     Quantum computers offer possibilities of carrying out computations that are beyond the capabilities of classical computers, particularly for higher word-count applications. The present technology makes it possible to generate quantum state representations of large dictionaries of words, which are difficult for classical computers. The present technology also provides a way to efficiently implement distance metrics between words, as represented by quantum states, that are, once again, beyond the capabilities of classical computers. 
     Embodiments of the present invention use quantum computers for generating word representation, which may represent high-rank entangled states efficiently. Such embodiments include methods for efficiently computing inner products. In addition, embodiments of the present invention may use methods for quantum amplitude estimation that are more efficient and suitable for noisy intermediate-scale quantum (NISQ) environments 
     Embodiments of the present invention may use word embedding for NLP applications, where the algorithm design may take into account the sequential nature of natural language data. Embodiments of the present invention include methods for efficiently computing inner products. 
     The Word Embedding System and Method 
     The disclosed technology includes a method and system for generating a word embedding. The disclosed method and system for generating a word embedding may be implemented on a hybrid quantum-classical computer system, which includes both a classical computer component and a quantum computer component, such as the hybrid quantum-classical computer  300  of  FIG.  3   . The classical computer component (e.g., the classical computer  306  of  FIG.  3   ) includes a processor, a non-transitory computer-readable medium, and computer instructions stored in the non-transitory computer-readable medium. The quantum computer component (e.g., the quantum computer  102  of  FIGS.  1  and  3   ) includes a plurality of qubits, and accepts a sequence of instructions to evolve a quantum state based on a series of quantum gates. 
     Referring to  FIG.  5   , when computer instructions are executed, the hybrid quantum-classical computer performs a method for generating a word embedding for at least one pair of words  500 . The classical computer includes a training set of training samples  510  comprising (1) a word pair set, the word pair set comprising N pairs of words, wherein N≥1, and (2) for each pair of words P in the word pair set, a numerical value B P  indicating a classical correlation between the words in the pair of words P. The disclosed word embedding method generates  520 , on the quantum computer, a plurality of quantum state representations including one quantum state representation for at least one word in the word pair set. A quantum correlation is trained  530  between (1) words in a word pair X in the pairs of words on the quantum computer using an error function, (2) the numerical value B X  corresponding to the word pair X, and (3) the plurality of quantum state representations, the word embedding including the quantum correlation  540 . The method may use an engineered likelihood function to train the quantum correlation, such as an engineered likelihood function implemented as a parameterized quantum circuit. The method of training may use a Bayesian inference to train the quantum correlation. 
     Generating a Training Set 
     To generate a word embedding that captures the sematic correlations between words in a vocabulary, embodiments of the present invention may start by generating a training set consisting of a list of triples (x, y, b). Here x and y may be words and b may be a numerical value, such as a binary value indicating whether the two words are semantically correlated. 
     Skip-Gram Method 
     One way of generating such a training set is the so-called “skip gram with negative sampling” method. Skip gram with negative sampling is a method where, for a block of text, a sliding window is applied spanning a certain number of words through the text. For a given window position, let w be a word inside the window and {right arrow over (ν)} be the rest of the words in the window. The elements in {right arrow over (ν)} are words that are both preceding and succeeding w. Then (ν i , w, 1) is added to the training set for all ν i  in {right arrow over (ν)}. The window is then advanced one word down the text and the same process is repeated. This way the training set generated consists of only those elements where b is 1. 
     As part of this method, it may also be desirable to generate negative samples where x and y are uncorrelated. This is accomplished simply by going through the (ν i , w, 1) training samples generated previously and for each w, choosing a set of random words R from the dictionary, which are most likely semantically uncorrelated with w, and adding (r, w, 0) to the training set for each r in R. 
     Defining The Parametrized Word Embedding 
     Once the training set is defined, the next step is to specify the parametrized word embedding.  FIG.  6    illustrates that for each word x a quantum state representation |ψ x    may be generated with tunable classical functions and quantum circuits. The classical function may be a pre-trained classical word embedding, in which case the quantum component (combined with the overlap estimation part which will be described further on) serves as an enhancement to the classical model. 
       FIG.  6    illustrates schematically the word embedding scheme. Here and {right arrow over (η)} c  and {right arrow over (η)} q  are tunable parameters for the classical function and the quantum circuit respectively. The vector {right arrow over (θ)} x  can be considered as an embedding by itself and used for other NLP applications as it is. To capture correlations quantum mechanically, an additional step is performed to generate the quantum embedding |ψ x   . 
     The SWAP Test 
     For two words x and y with quantum representations |ψ x    and |ψ y   , one could evaluate their correlation  ψ x |ψ y    by variants of the SWAP test, which costs O(1/∈ 2 ) repetitions of the quantum circuit if one were to estimate the correlation to error ∈. One can in principle accelerate this quadratically to a cumulative runtime of O(1/∈) by O(1/∈) amount of quantum coherence time in each repetition, which becomes quickly impractical for noisy quantum devices. 
     Instead, embodiments of the present invention may use a method that naturally interpolates between the two regimes and derives as much quantum speedup as is feasible on a noisy device. In particular, for noise parameter λ, it is advantageous to implement quantum circuits of depth O(1/λ) repeating O(λ 2 /∈ 2 ) times to yield a cumulative runtime of O(λ/ϵ 2 ). Better performing devices have a smaller value of A., affording shorter estimation runtimes. 
     Engineered Likelihood Function 
       FIG.  7    and  FIG.  8    illustrate evaluating  0|V † W|0  using engineered likelihood function. The problem of evaluating  ψ x |ψ y    essentially reduces to estimating overlaps of the form  0|V † W|0  where V and W are unitary operations performed by some coherent quantum mechanical process. Let θ be such that cos θ= 0|V † W|0 . A central object that needs to be constructed is an engineered likelihood function (ELF), p(d|θ,{right arrow over (x)}), where d is a measurement outcome from executing a quantum process and {right arrow over (x)} are tunable parameters. Here we realize the ELF by executing the quantum circuit in  FIG.  7    and performing a measurement as a final step. 
       FIG.  7    illustrates a parameterized circuit for implementing the engineered likelihood function (ELF). Here S(x,θ)=V † WR(x)W † V implicitly contains θ by virtue of its construction ( FIG.  3   ). The operator R(x)=exp(−ix|0   0|). The measurement Π 0  returns 0 only if the readouts on all of the qubits are 0, and returns 1 in any other cases. 
       FIG.  8    illustrates a geometric interpretation of θ as an angle parameter between |0  and |ξ =V † W|0 . The operator S(x,θ) can then be rewritten as exp(−ix|ξ   ξ|). 
     The ELF then takes the form of 
     
       
         
           
             
               
                 
                   
                     p 
                     ( 
                     d 
                      
                   
                   ⁢ 
                   θ 
                 
                 , 
                 
                   x 
                   → 
                 
               
               ) 
             
             = 
             
               
                 1 
                 + 
                 
                   
                     
                       ( 
                       
                         - 
                         1 
                       
                       ) 
                     
                     d 
                   
                   ⁢ 
                   
                     〈 
                     
                       0 
                       ⁢ 
                       
                          
                         
                           Q 
                           ⁡ 
                           
                             ( 
                             
                               θ 
                               ; 
                               
                                 x 
                                 → 
                               
                             
                             ) 
                           
                         
                          
                       
                       ⁢ 
                       0 
                     
                     〉 
                   
                 
               
               2 
             
           
         
       
     
     where Q (θ;{right arrow over (x)}) is the circuit in  FIG.  2   . With the ELF defined, one can use the rest of the Bayesian inference machinery laid out in Ref 7 for estimating the overlap  0|V † W|0 . 
     Training The Word Embedding 
     If the vocabulary contains in total N words, two sets of quantum states are defined: E={|ν i   , i∈[N]} and C={|w i ), i∈[N]}. Here the set E represents the embedding which is sought, while the set C is an auxiliary set of states for capturing the “context.” One way to parametrize the states in both sets is by the approach described in  FIG.  6   , where each state |υ i   =∪(f(x,{right arrow over (η)} c,i ),{right arrow over (η)} q,i )|0. The same applies to the states in C. The training process is to minimize the error 
     
       
         
           
             ⁢ 
             
                
               
                 σ 
                 ( 
                 
                   
                     Re 
                     ⁢ 
                     
                       〈 
                       
                         
                           v 
                           x 
                         
                         ⁢ 
                         
                            
                           
                             w 
                             y 
                           
                           〉 
                         
                       
                       ) 
                     
                   
                   - 
                   b 
                 
                  
               
             
           
         
       
     
     where T is the training set and σ is a sigmoid function. After the training, the set E represents the quantum enhanced word embedding while the set C can be discarded. With proper choices of the sigmoid function as well as the setting in  FIG.  6   , the parameter gradients can be efficiently evaluated across the classical and quantum components. 
     Testing an Embedding by Analogy 
     In the classical setting one would typically carry out simple tests such as {right arrow over (ν)} king −{right arrow over (ν)} man +{right arrow over (ν)} woman ≈{right arrow over (ν)} queen  for an analogy “king:man=queen:woman”. Quantum mechanically, one would instead transform the problem to one of overlap estimation, since evaluating the 2-norm of the error vector |{right arrow over (ν)} 1   =|u 1   +|ν 2   −|u 2    amounts to 
       ∥|ν 1     −|u   1   +|ν 2     −|u   2   ∥ 2   2 =4=2( ν 1   |u   1   +(ν 1   |u   2   + ν 2   |u   1   + ν 2   |u   2   − ν 1 |ν 2   −   u   1   |u   2   )
 
     where each of the overlap term can be estimated with previously described methods. 
     The methods described in this section and other sections of the technology disclosed can include one or more of the following features and/or features described in connection with additional methods disclosed. In the interest of conciseness, the combinations of features disclosed in this application are not individually enumerated and are not repeated with each base set of features. The reader will understand how features identified in this method can readily be combined with sets of base features identified as implementations. 
     It is to be understood that although the invention has been described above in terms of particular embodiments, the foregoing embodiments are provided as illustrative only, and do not limit or define the scope of the invention. Various other embodiments, including but not limited to the following, are also within the scope of the claims. For example, elements and components described herein may be further divided into additional components or joined together to form fewer components for performing the same functions. 
     Various physical embodiments of a quantum computer are suitable for use according to the present disclosure. In general, the fundamental data storage unit in quantum computing is the quantum bit, or qubit. The qubit is a quantum-computing analog of a classical digital computer system bit. A classical bit is considered to occupy, at any given point in time, one of two possible states corresponding to the binary digits (bits) 0 or 1. By contrast, a qubit is implemented in hardware by a physical medium with quantum-mechanical characteristics. Such a medium, which physically instantiates a qubit, may be referred to herein as a “physical instantiation of a qubit,” a “physical embodiment of a qubit,” a “medium embodying a qubit,” or similar terms, or simply as a “qubit,” for ease of explanation. It should be understood, therefore, that references herein to “qubits” within descriptions of embodiments of the present invention refer to physical media which embody qubits. 
     Each qubit has an infinite number of different potential quantum-mechanical states. When the state of a qubit is physically measured, the measurement produces one of two different basis states resolved from the state of the qubit. Thus, a single qubit can represent a one, a zero, or any quantum superposition of those two qubit states; a pair of qubits can be in any quantum superposition of  4  orthogonal basis states; and three qubits can be in any superposition of 8 orthogonal basis states. The function that defines the quantum-mechanical states of a qubit is known as its wavefunction. The wavefunction also specifies the probability distribution of outcomes for a given measurement. A qubit, which has a quantum state of dimension two (i.e., has two orthogonal basis states), may be generalized to a d-dimensional “qudit,” where d may be any integral value, such as 2, 3, 4, or higher. In the general case of a qudit, measurement of the qudit produces one of d different basis states resolved from the state of the qudit. Any reference herein to a qubit should be understood to refer more generally to an d-dimensional qudit with any value of d. 
     Although certain descriptions of qubits herein may describe such qubits in terms of their mathematical properties, each such qubit may be implemented in a physical medium in any of a variety of different ways. Examples of such physical media include superconducting material, trapped ions, photons, optical cavities, individual electrons trapped within quantum dots, point defects in solids (e.g., phosphorus donors in silicon or nitrogen-vacancy centers in diamond), molecules (e.g., alanine, vanadium complexes), or aggregations of any of the foregoing that exhibit qubit behavior, that is, comprising quantum states and transitions therebetween that can be controllably induced or detected. 
     For any given medium that implements a qubit, any of a variety of properties of that medium may be chosen to implement the qubit. For example, if electrons are chosen to implement qubits, then the x component of its spin degree of freedom may be chosen as the property of such electrons to represent the states of such qubits. Alternatively, the y component, or the z component of the spin degree of freedom may be chosen as the property of such electrons to represent the state of such qubits. This is merely a specific example of the general feature that for any physical medium that is chosen to implement qubits, there may be multiple physical degrees of freedom (e.g., the x, y, and z components in the electron spin example) that may be chosen to represent 0 and 1. For any particular degree of freedom, the physical medium may controllably be put in a state of superposition, and measurements may then be taken in the chosen degree of freedom to obtain readouts of qubit values. 
     Certain implementations of quantum computers, referred to as gate model quantum computers, comprise quantum gates. In contrast to classical gates, there is an infinite number of possible single-qubit quantum gates that change the state vector of a qubit. Changing the state of a qubit state vector typically is referred to as a single-qubit rotation, and may also be referred to herein as a state change or a single-qubit quantum-gate operation. A rotation, state change, or single-qubit quantum-gate operation may be represented mathematically by a unitary 2×2 matrix with complex elements. A rotation corresponds to a rotation of a qubit state within its Hilbert space, which may be conceptualized as a rotation of the Bloch sphere. (As is well-known to those having ordinary skill in the art, the Bloch sphere is a geometrical representation of the space of pure states of a qubit.) Multi-qubit gates alter the quantum state of a set of qubits. For example, two-qubit gates rotate the state of two qubits as a rotation in the four-dimensional Hilbert space of the two qubits. (As is well-known to those having ordinary skill in the art, a Hilbert space is an abstract vector space possessing the structure of an inner product that allows length and angle to be measured. Furthermore, Hilbert spaces are complete: there are enough limits in the space to allow the techniques of calculus to be used.) 
     A quantum circuit may be specified as a sequence of quantum gates. As described in more detail below, the term “quantum gate,” as used herein, refers to the application of a gate control signal (defined below) to one or more qubits to cause those qubits to undergo certain physical transformations and thereby to implement a logical gate operation. To conceptualize a quantum circuit, the matrices corresponding to the component quantum gates may be multiplied together in the order specified by the gate sequence to produce a 2″×2″ complex matrix representing the same overall state change on n qubits. A quantum circuit may thus be expressed as a single resultant operator. However, designing a quantum circuit in terms of constituent gates allows the design to conform to a standard set of gates, and thus enable greater ease of deployment. A quantum circuit thus corresponds to a design for actions taken upon the physical components of a quantum computer. 
     A given variational quantum circuit may be parameterized in a suitable device-specific manner. More generally, the quantum gates making up a quantum circuit may have an associated plurality of tuning parameters. For example, in embodiments based on optical switching, tuning parameters may correspond to the angles of individual optical elements. 
     In certain embodiments of quantum circuits, the quantum circuit includes both one or more gates and one or more measurement operations. Quantum computers implemented using such quantum circuits are referred to herein as implementing “measurement feedback.” For example, a quantum computer implementing measurement feedback may execute the gates in a quantum circuit and then measure only a subset (i.e., fewer than all) of the qubits in the quantum computer, and then decide which gate(s) to execute next based on the outcome(s) of the measurement(s). In particular, the measurement(s) may indicate a degree of error in the gate operation(s), and the quantum computer may decide which gate(s) to execute next based on the degree of error. The quantum computer may then execute the gate(s) indicated by the decision. This process of executing gates, measuring a subset of the qubits, and then deciding which gate(s) to execute next may be repeated any number of times. Measurement feedback may be useful for performing quantum error correction, but is not limited to use in performing quantum error correction. For every quantum circuit, there is an error-corrected implementation of the circuit with or without measurement feedback. 
     Some embodiments described herein generate, measure, or utilize quantum states that approximate a target quantum state (e.g., a ground state of a Hamiltonian). As will be appreciated by those trained in the art, there are many ways to quantify how well a first quantum state “approximates” a second quantum state. In the following description, any concept or definition of approximation known in the art may be used without departing from the scope hereof. For example, when the first and second quantum states are represented as first and second vectors, respectively, the first quantum state approximates the second quantum state when an inner product between the first and second vectors (called the “fidelity” between the two quantum states) is greater than a predefined amount (typically labeled E). In this example, the fidelity quantifies how “close” or “similar” the first and second quantum states are to each other. The fidelity represents a probability that a measurement of the first quantum state will give the same result as if the measurement were performed on the second quantum state. Proximity between quantum states can also be quantified with a distance measure, such as a Euclidean norm, a Hamming distance, or another type of norm known in the art. Proximity between quantum states can also be defined in computational terms. For example, the first quantum state approximates the second quantum state when a polynomial time-sampling of the first quantum state gives some desired information or property that it shares with the second quantum state. 
     Not all quantum computers are gate model quantum computers. Embodiments of the present invention are not limited to being implemented using gate model quantum computers. As an alternative example, embodiments of the present invention may be implemented, in whole or in part, using a quantum computer that is implemented using a quantum annealing architecture, which is an alternative to the gate model quantum computing architecture. More specifically, quantum annealing (QA) is a metaheuristic for finding the global minimum of a given objective function over a given set of candidate solutions (candidate states), by a process using quantum fluctuations. 
       FIG.  2 B  shows a diagram illustrating operations typically performed by a computer system  250  which implements quantum annealing. The system  250  includes both a quantum computer  252  and a classical computer  254 . Operations shown on the left of the dashed vertical line  256  typically are performed by the quantum computer  252 , while operations shown on the right of the dashed vertical line  256  typically are performed by the classical computer  254 . 
     Quantum annealing starts with the classical computer  254  generating an initial Hamiltonian  260  and a final Hamiltonian  262  based on a computational problem  258  to be solved, and providing the initial Hamiltonian  260 , the final Hamiltonian  262  and an annealing schedule  270  as input to the quantum computer  252 . The quantum computer  252  prepares a well-known initial state  266  ( FIG.  2 B , operation  264 ), such as a quantum-mechanical superposition of all possible states (candidate states) with equal weights, based on the initial Hamiltonian  260 . The classical computer  254  provides the initial Hamiltonian  260 , a final Hamiltonian  262 , and an annealing schedule  270  to the quantum computer  252 . The quantum computer  252  starts in the initial state  266 , and evolves its state according to the annealing schedule  270  following the time-dependent Schrodinger equation, a natural quantum-mechanical evolution of physical systems ( FIG.  2 B , operation  268 ). More specifically, the state of the quantum computer  252  undergoes time evolution under a time-dependent Hamiltonian, which starts from the initial Hamiltonian  260  and terminates at the final Hamiltonian  262 . If the rate of change of the system Hamiltonian is slow enough, the system stays close to the ground state of the instantaneous Hamiltonian. If the rate of change of the system Hamiltonian is accelerated, the system may leave the ground state temporarily but produce a higher likelihood of concluding in the ground state of the final problem Hamiltonian, i.e., diabatic quantum computation. At the end of the time evolution, the set of qubits on the quantum annealer is in a final state  272 , which is expected to be close to the ground state of the classical Ising model that corresponds to the solution to the original optimization problem  258 . An experimental demonstration of the success of quantum annealing for random magnets was reported immediately after the initial theoretical proposal. 
     The final state  272  of the quantum computer  252  is measured, thereby producing results  276  (i.e., measurements) ( FIG.  2 B , operation  274 ). The measurement operation  274  may be performed, for example, in any of the ways disclosed herein, such as in any of the ways disclosed herein in connection with the measurement unit  110  in  FIG.  1   . The classical computer  254  performs postprocessing on the measurement results  276  to produce output  280  representing a solution to the original computational problem  258  ( FIG.  2 B , operation  278 ). 
     As yet another alternative example, embodiments of the present invention may be implemented, in whole or in part, using a quantum computer that is implemented using a one-way quantum computing architecture, also referred to as a measurement-based quantum computing architecture, which is another alternative to the gate model quantum computing architecture. More specifically, the one-way or measurement based quantum computer (MBQC) is a method of quantum computing that first prepares an entangled resource state, usually a cluster state or graph state, then performs single qubit measurements on it. It is “one-way” because the resource state is destroyed by the measurements. 
     The outcome of each individual measurement is random, but they are related in such a way that the computation always succeeds. In general the choices of basis for later measurements need to depend on the results of earlier measurements, and hence the measurements cannot all be performed at the same time. 
     Any of the functions disclosed herein may be implemented using means for performing those functions. Such means include, but are not limited to, any of the components disclosed herein, such as the computer-related components described below. 
     Referring to  FIG.  1   , a diagram is shown of a system  100  implemented according to one embodiment of the present invention. Referring to  FIG.  2 A , a flowchart is shown of a method  200  performed by the system  100  of  FIG.  1    according to one embodiment of the present invention. The system  100  includes a quantum computer  102 . The quantum computer  102  includes a plurality of qubits  104 , which may be implemented in any of the ways disclosed herein. There may be any number of qubits  104  in the quantum computer  102 . For example, the qubits  104  may include or consist of no more than 2 qubits, no more than 4 qubits, no more than 8 qubits, no more than 16 qubits, no more than 32 qubits, no more than 64 qubits, no more than 128 qubits, no more than 256 qubits, no more than 512 qubits, no more than 1024 qubits, no more than 2048 qubits, no more than 4096 qubits, or no more than 8192 qubits. These are merely examples, in practice there may be any number of qubits  104  in the quantum computer  102 . 
     There may be any number of gates in a quantum circuit. However, in some embodiments the number of gates may be at least proportional to the number of qubits  104  in the quantum computer  102 . In some embodiments the gate depth may be no greater than the number of qubits  104  in the quantum computer  102 , or no greater than some linear multiple of the number of qubits  104  in the quantum computer  102  (e.g., 2, 3, 4, 5, 6, or 7). 
     The qubits  104  may be interconnected in any graph pattern. For example, they be connected in a linear chain, a two-dimensional grid, an all-to-all connection, any combination thereof, or any subgraph of any of the preceding. 
     As will become clear from the description below, although element  102  is referred to herein as a “quantum computer,” this does not imply that all components of the quantum computer  102  leverage quantum phenomena. One or more components of the quantum computer  102  may, for example, be classical (i.e., non-quantum components) components which do not leverage quantum phenomena. 
     The quantum computer  102  includes a control unit  106 , which may include any of a variety of circuitry and/or other machinery for performing the functions disclosed herein. The control unit  106  may, for example, consist entirely of classical components. The control unit  106  generates and provides as output one or more control signals  108  to the qubits  104 . The control signals  108  may take any of a variety of forms, such as any kind of electromagnetic signals, such as electrical signals, magnetic signals, optical signals (e.g., laser pulses), or any combination thereof. 
     For example:
         In embodiments in which some or all of the qubits  104  are implemented as photons (also referred to as a “quantum optical” implementation) that travel along waveguides, the control unit  106  may be a beam splitter (e.g., a heater or a mirror), the control signals  108  may be signals that control the heater or the rotation of the mirror, the measurement unit  110  may be a photodetector, and the measurement signals  112  may be photons.   In embodiments in which some or all of the qubits  104  are implemented as charge type qubits (e.g., transmon, X-mon, G-mon) or flux-type qubits (e.g., flux qubits, capacitively shunted flux qubits) (also referred to as a “circuit quantum electrodynamic” (circuit QED) implementation), the control unit  106  may be a bus resonator activated by a drive, the control signals  108  may be cavity modes, the measurement unit  110  may be a second resonator (e.g., a low-Q resonator), and the measurement signals  112  may be voltages measured from the second resonator using dispersive readout techniques.   In embodiments in which some or all of the qubits  104  are implemented as superconducting circuits, the control unit  106  may be a circuit QED-assisted control unit or a direct capacitive coupling control unit or an inductive capacitive coupling control unit, the control signals  108  may be cavity modes, the measurement unit  110  may be a second resonator (e.g., a low-Q resonator), and the measurement signals  112  may be voltages measured from the second resonator using dispersive readout techniques.   In embodiments in which some or all of the qubits  104  are implemented as trapped ions (e.g., electronic states of, e.g., magnesium ions), the control unit  106  may be a laser, the control signals  108  may be laser pulses, the measurement unit  110  may be a laser and either a CCD or a photodetector (e.g., a photomultiplier tube), and the measurement signals  112  may be photons.   In embodiments in which some or all of the qubits  104  are implemented using nuclear magnetic resonance (NMR) (in which case the qubits may be molecules, e.g., in liquid or solid form), the control unit  106  may be a radio frequency (RF) antenna, the control signals  108  may be RF fields emitted by the RF antenna, the measurement unit  110  may be another RF antenna, and the measurement signals  112  may be RF fields measured by the second RF antenna.   In embodiments in which some or all of the qubits  104  are implemented as nitrogen-vacancy centers (NV centers), the control unit  106  may, for example, be a laser, a microwave antenna, or a coil, the control signals  108  may be visible light, a microwave signal, or a constant electromagnetic field, the measurement unit  110  may be a photodetector, and the measurement signals  112  may be photons.   In embodiments in which some or all of the qubits  104  are implemented as two-dimensional quasiparticles called “anyons” (also referred to as a “topological quantum computer” implementation), the control unit  106  may be nanowires, the control signals  108  may be local electrical fields or microwave pulses, the measurement unit  110  may be superconducting circuits, and the measurement signals  112  may be voltages.   In embodiments in which some or all of the qubits  104  are implemented as semiconducting material (e.g., nanowires), the control unit  106  may be microfabricated gates, the control signals  108  may be RF or microwave signals, the measurement unit  110  may be microfabricated gates, and the measurement signals  112  may be RF or microwave signals.       

     Although not shown explicitly in  FIG.  1    and not required, the measurement unit  110  may provide one or more feedback signals  114  to the control unit  106  based on the measurement signals  112 . For example, quantum computers referred to as “one-way quantum computers” or “measurement-based quantum computers” utilize such feedback  114  from the measurement unit  110  to the control unit  106 . Such feedback  114  is also necessary for the operation of fault-tolerant quantum computing and error correction. 
     The control signals  108  may, for example, include one or more state preparation signals which, when received by the qubits  104 , cause some or all of the qubits  104  to change their states. Such state preparation signals constitute a quantum circuit also referred to as an “ansatz circuit.” The resulting state of the qubits  104  is referred to herein as an “initial state” or an “ansatz state.” The process of outputting the state preparation signal(s) to cause the qubits  104  to be in their initial state is referred to herein as “state preparation” ( FIG.  2 A , section  206 ). A special case of state preparation is “initialization,” also referred to as a “reset operation,” in which the initial state is one in which some or all of the qubits  104  are in the “zero” state i.e. the default single-qubit state. More generally, state preparation may involve using the state preparation signals to cause some or all of the qubits  104  to be in any distribution of desired states. In some embodiments, the control unit  106  may first perform initialization on the qubits  104  and then perform preparation on the qubits  104 , by first outputting a first set of state preparation signals to initialize the qubits  104 , and by then outputting a second set of state preparation signals to put the qubits  104  partially or entirely into non-zero states. 
     Another example of control signals  108  that may be output by the control unit  106  and received by the qubits  104  are gate control signals. The control unit  106  may output such gate control signals, thereby applying one or more gates to the qubits  104 . Applying a gate to one or more qubits causes the set of qubits to undergo a physical state change which embodies a corresponding logical gate operation (e.g., single-qubit rotation, two-qubit entangling gate or multi-qubit operation) specified by the received gate control signal. As this implies, in response to receiving the gate control signals, the qubits  104  undergo physical transformations which cause the qubits  104  to change state in such a way that the states of the qubits  104 , when measured (see below), represent the results of performing logical gate operations specified by the gate control signals. The term “quantum gate,” as used herein, refers to the application of a gate control signal to one or more qubits to cause those qubits to undergo the physical transformations described above and thereby to implement a logical gate operation. 
     It should be understood that the dividing line between state preparation (and the corresponding state preparation signals) and the application of gates (and the corresponding gate control signals) may be chosen arbitrarily. For example, some or all the components and operations that are illustrated in  FIGS.  1  and  2 A- 2 B  as elements of “state preparation” may instead be characterized as elements of gate application. Conversely, for example, some or all of the components and operations that are illustrated in  FIGS.  1  and  2 A- 2 B  as elements of “gate application” may instead be characterized as elements of state preparation. As one particular example, the system and method of  FIGS.  1  and  2 A- 2 B  may be characterized as solely performing state preparation followed by measurement, without any gate application, where the elements that are described herein as being part of gate application are instead considered to be part of state preparation. Conversely, for example, the system and method of  FIGS.  1  and  2 A- 2 B  may be characterized as solely performing gate application followed by measurement, without any state preparation, and where the elements that are described herein as being part of state preparation are instead considered to be part of gate application. 
     The quantum computer  102  also includes a measurement unit  110 , which performs one or more measurement operations on the qubits  104  to read out measurement signals  112  (also referred to herein as “measurement results”) from the qubits  104 , where the measurement results  112  are signals representing the states of some or all of the qubits  104 . In practice, the control unit  106  and the measurement unit  110  may be entirely distinct from each other, or contain some components in common with each other, or be implemented using a single unit (i.e., a single unit may implement both the control unit  106  and the measurement unit  110 ). For example, a laser unit may be used both to generate the control signals  108  and to provide stimulus (e.g., one or more laser beams) to the qubits  104  to cause the measurement signals  112  to be generated. 
     In general, the quantum computer  102  may perform various operations described above any number of times. For example, the control unit  106  may generate one or more control signals  108 , thereby causing the qubits  104  to perform one or more quantum gate operations. The measurement unit  110  may then perform one or more measurement operations on the qubits  104  to read out a set of one or more measurement signals  112 . The measurement unit  110  may repeat such measurement operations on the qubits  104  before the control unit  106  generates additional control signals  108 , thereby causing the measurement unit  110  to read out additional measurement signals  112  resulting from the same gate operations that were performed before reading out the previous measurement signals  112 . The measurement unit  110  may repeat this process any number of times to generate any number of measurement signals  112  corresponding to the same gate operations. The quantum computer  102  may then aggregate such multiple measurements of the same gate operations in any of a variety of ways. 
     After the measurement unit  110  has performed one or more measurement operations on the qubits  104  after they have performed one set of gate operations, the control unit  106  may generate one or more additional control signals  108 , which may differ from the previous control signals  108 , thereby causing the qubits  104  to perform one or more additional quantum gate operations, which may differ from the previous set of quantum gate operations. The process described above may then be repeated, with the measurement unit  110  performing one or more measurement operations on the qubits  104  in their new states (resulting from the most recently-performed gate operations). 
     In general, the system  100  may implement a plurality of quantum circuits as follows. For each quantum circuit C in the plurality of quantum circuits ( FIG.  2 A , operation  202 ), the system  100  performs a plurality of “shots” on the qubits  104 . The meaning of a shot will become clear from the description that follows. For each shot S in the plurality of shots ( FIG.  2 A , operation  204 ), the system  100  prepares the state of the qubits  104  ( FIG.  2 A , section  206 ). More specifically, for each quantum gate Gin quantum circuit C ( FIG.  2 A , operation  210 ), the system  100  applies quantum gate G to the qubits  104  ( FIG.  2 A , operations  212  and  214 ). 
     Then, for each of the qubits Q  104  ( FIG.  2 A , operation  216 ), the system  100  measures the qubit Q to produce measurement output representing a current state of qubit Q ( FIG.  2 A , operations  218  and  220 ). 
     The operations described above are repeated for each shot S ( FIG.  2 A , operation  222 ), and circuit C ( FIG.  2 A , operation  224 ). As the description above implies, a single “shot” involves preparing the state of the qubits  104  and applying all of the quantum gates in a circuit to the qubits  104  and then measuring the states of the qubits  104 ; and the system  100  may perform multiple shots for one or more circuits. 
     Referring to  FIG.  3   , a diagram is shown of a hybrid quantum classical computer (HQC)  300  implemented according to one embodiment of the present invention. The HQC  300  includes a quantum computer component  102  (which may, for example, be implemented in the manner shown and described in connection with  FIG.  1   ) and a classical computer component  306 . The classical computer component may be a machine implemented according to the general computing model established by John Von Neumann, in which programs are written in the form of ordered lists of instructions and stored within a classical (e.g., digital) memory  310  and executed by a classical (e.g., digital) processor  308  of the classical computer. The memory  310  is classical in the sense that it stores data in a storage medium in the form of bits, which have a single definite binary state at any point in time. The bits stored in the memory  310  may, for example, represent a computer program. The classical computer component  304  typically includes a bus  314 . The processor  308  may read bits from and write bits to the memory  310  over the bus  314 . For example, the processor  308  may read instructions from the computer program in the memory  310 , and may optionally receive input data  316  from a source external to the computer  302 , such as from a user input device such as a mouse, keyboard, or any other input device. The processor  308  may use instructions that have been read from the memory  310  to perform computations on data read from the memory  310  and/or the input  316 , and generate output from those instructions. The processor  308  may store that output back into the memory  310  and/or provide the output externally as output data  318  via an output device, such as a monitor, speaker, or network device. 
     The quantum computer component  102  may include a plurality of qubits  104 , as described above in connection with  FIG.  1   . A single qubit may represent a one, a zero, or any quantum superposition of those two qubit states. The classical computer component  304  may provide classical state preparation signals  332  to the quantum computer  102 , in response to which the quantum computer  102  may prepare the states of the qubits  104  in any of the ways disclosed herein, such as in any of the ways disclosed in connection with  FIGS.  1  and  2 A- 2 B . 
     Once the qubits  104  have been prepared, the classical processor  308  may provide classical control signals  334  to the quantum computer  102 , in response to which the quantum computer  102  may apply the gate operations specified by the control signals  332  to the qubits  104 , as a result of which the qubits  104  arrive at a final state. The measurement unit  110  in the quantum computer  102  (which may be implemented as described above in connection with  FIGS.  1  and  2 A- 2 B ) may measure the states of the qubits  104  and produce measurement output  338  representing the collapse of the states of the qubits  104  into one of their eigenstates. As a result, the measurement output  338  includes or consists of bits and therefore represents a classical state. The quantum computer  102  provides the measurement output  338  to the classical processor  308 . The classical processor  308  may store data representing the measurement output  338  and/or data derived therefrom in the classical memory  310 . 
     The steps described above may be repeated any number of times, with what is described above as the final state of the qubits  104  serving as the initial state of the next iteration. In this way, the classical computer  304  and the quantum computer  102  may cooperate as co-processors to perform joint computations as a single computer system. 
     Although certain functions may be described herein as being performed by a classical computer and other functions may be described herein as being performed by a quantum computer, these are merely examples and do not constitute limitations of the present invention. A subset of the functions which are disclosed herein as being performed by a quantum computer may instead be performed by a classical computer. For example, a classical computer may execute functionality for emulating a quantum computer and provide a subset of the functionality described herein, albeit with functionality limited by the exponential scaling of the simulation. Functions which are disclosed herein as being performed by a classical computer may instead be performed by a quantum computer. 
     The techniques described above may be implemented, for example, in hardware, in one or more computer programs tangibly stored on one or more computer-readable media, firmware, or any combination thereof, such as solely on a quantum computer, solely on a classical computer, or on a hybrid quantum classical (HQC) computer. The techniques disclosed herein may, for example, be implemented solely on a classical computer, in which the classical computer emulates the quantum computer functions disclosed herein. 
     Any reference herein to the state |0  may alternatively refer to the state |1 , and vice versa. In other words, any role described herein for the states |0  and |1  may be reversed within embodiments of the present invention. More generally, any computational basis state disclosed herein may be replaced with any suitable reference state within embodiments of the present invention. 
     The techniques described above may be implemented in one or more computer programs executing on (or executable by) a programmable computer (such as a classical computer, a quantum computer, or an HQC) including any combination of any number of the following: a processor, a storage medium readable and/or writable by the processor (including, for example, volatile and non-volatile memory and/or storage elements), an input device, and an output device. Program code may be applied to input entered using the input device to perform the functions described and to generate output using the output device. 
     Embodiments of the present invention include features which are only possible and/or feasible to implement with the use of one or more computers, computer processors, and/or other elements of a computer system. Such features are either impossible or impractical to implement mentally and/or manually. For example, embodiments of the present invention include techniques for generating, on a quantum computer, a plurality of quantum state representations including one quantum state representation for at least one word in a word pair set, and for training a quantum correlation between: (1) words in a word pair Xin the pairs of words on the quantum computer using an error function, (2) the numerical value B X  corresponding to the word pair X, and (3) the plurality of quantum state representations. Such functions are inherently rooted in quantum computing technology and cannot be performed mentally or manually, especially when applied to large numbers of word pairs (e.g., N&gt;100,000). 
     Any claims herein which affirmatively require a computer, a processor, a memory, or similar computer-related elements, are intended to require such elements, and should not be interpreted as if such elements are not present in or required by such claims. Such claims are not intended, and should not be interpreted, to cover methods and/or systems which lack the recited computer-related elements. For example, any method claim herein which recites that the claimed method is performed by a computer, a processor, a memory, and/or similar computer-related element, is intended to, and should only be interpreted to, encompass methods which are performed by the recited computer-related element(s). Such a method claim should not be interpreted, for example, to encompass a method that is performed mentally or by hand (e.g., using pencil and paper). Similarly, any product claim herein which recites that the claimed product includes a computer, a processor, a memory, and/or similar computer-related element, is intended to, and should only be interpreted to, encompass products which include the recited computer-related element(s). Such a product claim should not be interpreted, for example, to encompass a product that does not include the recited computer-related element(s). 
     In embodiments in which a classical computing component executes a computer program providing any subset of the functionality within the scope of the claims below, the computer program may be implemented in any programming language, such as assembly language, machine language, a high-level procedural programming language, or an object-oriented programming language. The programming language may, for example, be a compiled or interpreted programming language. 
     Each such computer program may be implemented in a computer program product tangibly embodied in a machine-readable storage device for execution by a computer processor, which may be either a classical processor or a quantum processor. Method steps of the invention may be performed by one or more computer processors executing a program tangibly embodied on a computer-readable medium to perform functions of the invention by operating on input and generating output. Suitable processors include, by way of example, both general and special purpose microprocessors. Generally, the processor receives (reads) instructions and data from a memory (such as a read-only memory and/or a random access memory) and writes (stores) instructions and data to the memory. Storage devices suitable for tangibly embodying computer program instructions and data include, for example, all forms of non-volatile memory, such as semiconductor memory devices, including EPROM, EEPROM, and flash memory devices; magnetic disks such as internal hard disks and removable disks; magneto-optical disks; and CD-ROMs. Any of the foregoing may be supplemented by, or incorporated in, specially-designed ASICs (application-specific integrated circuits) or FPGAs (Field-Programmable Gate Arrays). A classical computer can generally also receive (read) programs and data from, and write (store) programs and data to, a non-transitory computer-readable storage medium such as an internal disk (not shown) or a removable disk. These elements will also be found in a conventional desktop or workstation computer as well as other computers suitable for executing computer programs implementing the methods described herein, which may be used in conjunction with any digital print engine or marking engine, display monitor, or other raster output device capable of producing color or gray scale pixels on paper, film, display screen, or other output medium. 
     Any data disclosed herein may be implemented, for example, in one or more data structures tangibly stored on a non-transitory computer-readable medium (such as a classical computer-readable medium, a quantum computer-readable medium, or an HQC computer-readable medium). Embodiments of the invention may store such data in such data structure(s) and read such data from such data structure(s). 
     Although terms such as “optimize” and “optimal” are used herein, in practice, embodiments of the present invention may include methods which produce outputs that are not optimal, or which are not known to be optimal, but which nevertheless are useful. For example, embodiments of the present invention may produce an output which approximates an optimal solution, within some degree of error. As a result, terms herein such as “optimize” and “optimal” should be understood to refer not only to processes which produce optimal outputs, but also processes which produce outputs that approximate an optimal solution, within some degree of error.