A cultural relics knowledge processing method and related device

By improving the quantum spin optimization and inter-layer nonlinear coupling constraint loss function of the Transformer model, the problem that traditional methods are difficult to handle large-scale, multi-dimensional cultural relic knowledge is solved, and efficient and stable automatic processing of cultural relic knowledge is achieved.

CN120409475BActive Publication Date: 2025-09-16HUNAN MANGO DIGITAL INTELLIGENCE ART TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510907795.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2025-09-16
Estimated Expiration
2045-07-02

AI Technical Summary

Technical Problem

Traditional methods of processing cultural relic knowledge are unable to cope with large-scale, multi-dimensional cultural relic knowledge, have low processing efficiency and are difficult to meet modern research needs.

Method used

Pre-trained word vectors are used to embed the cultural relic text data and processed using an improved Transformer model. The improved Transformer model initializes the weights of the feedforward network through a quantum spin optimization algorithm, and adopts an inter-layer nonlinear coupling constrained loss function and a quantum accelerated gradient update mechanism to improve processing speed and accuracy.

Benefits of technology

It achieves efficient and automatic processing of large-scale, multi-dimensional cultural relic knowledge, improves the stability and processing speed of the model, and enhances the ability to express multi-dimensional features in cultural relic text data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409475B_ABST
    Figure CN120409475B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and related device for processing cultural relic knowledge, which relates to the field of big data, including: obtaining cultural relic text data corresponding to the cultural relic knowledge to be processed, using pre-trained word vectors to perform text embedding on the cultural relic text data to obtain cultural relic word vectors, inputting the cultural relic word vectors into the encoder of a pre-trained improved Transformer model, mapping them into a set of context-aware target word vectors, and inputting the target word vectors into the decoder of the improved Transformer model for decoding to obtain the cultural relic knowledge processing results. The present invention realizes the automatic processing of cultural relic knowledge, ensures the stability of weight initialization by initializing the weights of the feedforward network using a quantum spin optimization algorithm, uses an inter-layer nonlinear coupling constraint loss function to process the multidimensional features in the cultural relic text data, and uses a quantum accelerated gradient update mechanism to speed up the processing speed, thereby being able to efficiently process large-scale, multi-dimensional cultural relic knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data technology, and more specifically, to a cultural relics knowledge processing method and related devices. Background Art

[0002] The comprehensiveness and complexity of cultural relic knowledge make its processing and analysis extremely difficult. Traditional cultural relic knowledge processing typically relies on manual analysis. However, with the increasing demand for cultural relic research and the development of big data technology, traditional cultural relic knowledge processing methods are unable to cope with large-scale, multi-dimensional cultural relic knowledge. Summary of the Invention

[0003] In view of this, the present invention discloses a cultural relic knowledge processing method and related devices to solve the problem that traditional cultural relic knowledge processing methods are difficult to cope with large-scale, multi-dimensional cultural relic knowledge.

[0004] A method for processing cultural relics knowledge, comprising:

[0005] Obtain cultural relic text data corresponding to the cultural relic knowledge to be processed;

[0006] Using pre-trained word vectors to perform text embedding on the cultural relic text data, and converting the cultural relic text data into cultural relic word vectors;

[0007] Inputting the cultural relic word vectors into the encoder of a pre-trained improved Transformer model to map them into a set of context-aware target word vectors. The improved Transformer model is trained using a quantum spin optimization algorithm to initialize the weights of the feedforward network, employing an inter-layer nonlinear coupling constraint loss function, and a quantum accelerated gradient update mechanism to speed up processing.

[0008] The target word vector is input into the decoder of the improved Transformer model for decoding to obtain the cultural relic knowledge processing result.

[0009] Optionally, during the training of the improved Transformer model, the process of initializing the weights of the feedforward network using the quantum spin optimization algorithm includes:

[0010] The product of the quantum optimization operator and the original weight matrix of the feedforward network is calculated to obtain the weight matrix of the feedforward network, wherein the weight matrix is ​​a matrix after the original weight matrix is ​​initialized, and the quantum optimization operator represents the quantum spin rotation operation and is determined based on the quantum spin rotation angle.

[0011] Optionally, the process of determining the quantum spin rotation angle includes:

[0012] Calculating the product of the cultural relic word vector in the cultural relic text data and the original weight matrix to obtain an inner product representing the initial correlation strength between the cultural relic word vector and the original weight matrix;

[0013] The quantum spin rotation angle is obtained based on the inner product, the initial offset compensation of the sparse features in the cultural relic text data, and the adjustment factor.

[0014] Optionally, the training process of the improved Transformer model further includes:

[0015] Based on the weight matrix of the feedforward network, the inter-layer nonlinear coupling constraint loss function is determined.

[0016] Optionally, determining the inter-layer nonlinear coupling constraint loss function based on the weight matrix of the feedforward network includes:

[0017] Determine a first nonlinear function corresponding to a weight matrix of an i-th layer of the feedforward network, a second nonlinear function corresponding to a weight matrix of an i+1-th layer of the feedforward network, and a coupling coefficient of the i-th layer;

[0018] The product of the first nonlinear function, the second nonlinear function and the i-th layer coupling degree coefficient is determined as the inter-layer nonlinear coupling constraint loss function.

[0019] Optionally, the process of determining the coupling degree coefficient of the i-th layer includes:

[0020] The coupling degree coefficient of the i-th layer is obtained according to the correlation between the activation value of the i-th layer and the activation value of the i+1-th layer of the feedforward network, as well as the cultural relic word vectors and the number of training samples used as training samples.

[0021] Optionally, the training process of the improved Transformer model further includes:

[0022] Based on the inter-layer nonlinear coupling constraint loss function, a quantum feedback mechanism is adopted to dynamically update the weight matrix of the feedforward network.

[0023] Optionally, based on the inter-layer nonlinear coupling constraint loss function, a quantum feedback mechanism is used to dynamically update the weight matrix of the feedforward network, including:

[0024] Based on the learning rate, weight gradient, quantum acceleration gradient, the gradient of the inter-layer nonlinear coupling constraint loss function with respect to the weight, the quantum spin optimization feedback adjustment coefficient, and the weight adjustment brought about by quantum spin feedback that characterize the update step size of each iteration, the weight matrix of the feedforward network of the tth iteration is updated to obtain the weight matrix of the feedforward network of the t+1th iteration.

[0025] Optionally, the learning rate determination process includes:

[0026] The learning rate is obtained based on the weight gradient, the feedback gain factor and the quantum spin feedback amount.

[0027] Optionally, the process of determining the quantum acceleration gradient includes:

[0028] The quantum acceleration gradient is obtained based on the quantum acceleration factor, the quantum optimization operator representing the quantum spin rotation operation, the artifact word vector as the training sample, and the gradient of the cross entropy loss function for the nth training sample.

[0029] A cultural relic knowledge processing device, comprising:

[0030] An acquisition unit, used to acquire cultural relic text data corresponding to the cultural relic knowledge to be processed;

[0031] A vector conversion unit, configured to perform text embedding on the cultural relic text data using pre-trained word vectors, and convert the cultural relic text data into cultural relic word vectors;

[0032] An encoding unit, configured to input the cultural relic word vectors into an encoder of a pre-trained improved Transformer model to map them into a set of context-aware target word vectors, wherein the improved Transformer model is trained using a quantum spin optimization algorithm to initialize the weights of the feedforward network, an inter-layer nonlinear coupling constrained loss function, and a quantum accelerated gradient update mechanism to accelerate processing;

[0033] A decoding unit is used to input the target word vector into the decoder of the improved Transformer model for decoding to obtain a cultural relic knowledge processing result.

[0034] A computer storage medium stores at least one instruction, wherein the at least one instruction implements any cultural relic knowledge processing method when executed by a processor.

[0035] An electronic device, comprising: a memory and a processor;

[0036] The memory is used to store at least one instruction;

[0037] The processor is configured to execute the at least one instruction to implement any one of the cultural relic knowledge processing methods.

[0038] From the above technical solutions, it can be seen that the present invention discloses a method and related devices for processing cultural relics knowledge, obtaining cultural relics text data corresponding to the cultural relics knowledge to be processed, using pre-trained word vectors to perform text embedding on the cultural relics text data, converting the cultural relics text data into cultural relics word vectors, inputting the cultural relics word vectors into the encoder of the pre-trained improved Transformer model, mapping them into a set of context-aware target word vectors, and inputting the target word vectors into the decoder of the improved Transformer model for decoding to obtain the cultural relics knowledge processing results. The present invention realizes the automatic processing of cultural relics knowledge by improving the Transformer model. The improved Transformer model uses a quantum spin optimization algorithm to initialize the weights of the feedforward network to ensure the stability of weight initialization, uses an inter-layer nonlinear coupling constraint loss function to better process the multi-dimensional features in the cultural relics text data, and uses a quantum accelerated gradient update mechanism to speed up the processing speed, so that large-scale, multi-dimensional cultural relics knowledge can be efficiently processed. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.

[0040] Figure 1 This is a schematic diagram of the architecture of the traditional Transformer model;

[0041] Figure 2 A flow chart of a method for processing cultural relics knowledge disclosed in an embodiment of the present invention;

[0042] Figure 3 A weight distribution comparison diagram of a quantum-initialized feedforward network weight and a traditional randomly-initialized feedforward network weight disclosed in an embodiment of the present invention;

[0043] Figure 4 A comparison diagram of a gradient flow field with interlayer coupling constraint and a gradient flow field without coupling constraint disclosed in an embodiment of the present invention;

[0044] Figure 5 A schematic diagram comparing a quantum feedback path and a traditional optimization path disclosed in an embodiment of the present invention;

[0045] Figure 6 A schematic structural diagram of a cultural relics knowledge processing device disclosed in an embodiment of the present invention;

[0046] Figure 7 The figure is a schematic structural diagram of an electronic device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The improved Transformer model used in the cultural relics knowledge processing method disclosed in the present invention is obtained by improving the traditional Transformer model. To facilitate understanding of the working principle of the improved Transformer model, the structure and working principle of the traditional Transformer model are first described as follows:

[0048] See also Figure 1 The figure shows the architecture of the traditional Transformer model. The Transformer model mainly consists of two parts: the encoder and the decoder. The encoder maps the input into a series of context-aware vector representations, and the decoder gradually decodes these vector representations into target features.

[0049] Specifically, the encoder part is composed of N trans The same coding layers, N trans Indicates the number of coding layers, for example, N trans The value of is 5. Each encoding layer consists of two sublayers: a multi-head attention mechanism sublayer and a feedforward network sublayer. The encoder adds a residual connection after each sublayer ( Figure 1 ) and normalization operations.

[0050] The multi-head attention sublayer is implemented using the multi-head self-attention mechanism, a core module of the encoder. It is responsible for learning the importance of each position from the input features and combining information from all positions to derive a global contextual representation, thereby improving the model's performance and generalization. Specifically, the multi-head self-attention sublayer is implemented as follows: the input features pass through three different linear transformation layers to generate "query," "key," and "value" vectors, respectively. The linear transformations are achieved by multiplying them by a weight matrix. Furthermore, the generated query, key, and value vectors are split into multiple smaller parts, or "heads," allowing the model to process multiple different representation subspaces in parallel, thereby capturing the diversity of information in the input data. Furthermore, for each head, the dot product of the query and key vectors is calculated to obtain an attention score, which reflects the relative importance of different positions in the sequence. In order to stabilize the value of the attention score, the score is divided by a scaling factor, which can be the square root of the key vector dimension. Furthermore, the attention score is processed using the Softmax function to obtain the attention weight of each position. The Softmax function ensures that all weights add up to 1, so that it can be treated as a probability distribution, which is expressed as:

[0051] (1);

[0052] In the formula, head i is the attention weight of the i-th head, Q i is the query vector of the i-th head, K i is the key vector of the i-th head, K i T is the transpose of the key vector of the i-th head, d ks is the dimension of the input feature, h ks is the number of attention heads, V i is the value vector of the i-th head, and Sof() is the Softmax function.

[0053] Furthermore, the obtained attention weights are used to perform a weighted summation on the value vector to obtain the output vector. The output vectors of all heads are concatenated together and then passed through a linear transformation layer to generate the output of the final multi-head self-attention mechanism sub-layer.

[0054] The feedforward network sublayer consists of two fully connected layers and an activation function, which is used to perform nonlinear transformation on the vector at each position. In the feedforward network sublayer, the input vector first passes through the first fully connected layer for linear transformation, then passes through a ReLU activation function for nonlinear transformation, and finally passes through the second fully connected layer for linear transformation to improve the expressiveness and generalization capabilities of the model, so that the model can better handle complex input data.

[0055] The decoder consists of N trans The decoding layer is composed of the same decoding layers. The difference from the encoding layer is that each decoding layer has an additional multi-head attention mechanism sub-layer, that is, the decoding layer contains two multi-head attention mechanism sub-layers and one feed-forward network sub-layer. In addition, the second multi-head attention mechanism sub-layer of the decoding layer (i.e. Figure 1 The masked multi-head attention layer in is implemented through a multi-head cross-attention mechanism, which is a mechanism for information exchange between the encoder and the decoder. It takes the encoder's output features and the decoder's input features as input, and uses the attention mechanism to perform cross-attention calculations on the inputs, thereby obtaining a set of weighted decoder output features.

[0056] Among them, both the encoder and the decoder use position encoding to mark the position of each generated token (word segmentation).

[0057] It should be noted that in the encoder and decoder of the Transformer model, the output of each sub-layer is the result of layer normalization and residual connection, expressed as:

[0058] (2);

[0059] Where y cgyis the feature output after layer normalization, LNc() is the layer normalization function, x trans is the input of the sublayer, and Sublayer() is the output of the residual-connected sublayer.

[0060] The improved Transformer model of the present invention, based on the traditional Transformer model, uses a quantum spin optimization algorithm to initialize the weights of the feedforward network (including the feedforward network sublayer in the encoder and the feedforward network sublayer in the decoder). This reduces the weight initialization instability and error caused by the random initialization method used in traditional feedforward networks, as well as the gradient vanishing or gradient exploding phenomena caused by it. The improved Transformer model of the present invention uses an inter-layer nonlinear coupling constraint loss function, enabling the improved Transformer model to better handle the multidimensional features (such as vocabulary, syntax, and semantics) in cultural relic text data, enhancing the model's expressive power and generalization capabilities. The improved Transformer model of the present invention uses a quantum accelerated gradient update mechanism to speed up processing and significantly increase the speed of gradient calculation, thereby significantly improving model training efficiency when processing cultural relic text data.

[0061] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0062] The embodiment of the present invention discloses a method and related device for processing cultural relic knowledge, which obtains cultural relic text data corresponding to the cultural relic knowledge to be processed, uses pre-trained word vectors to perform text embedding on the cultural relic text data, converts the cultural relic text data into cultural relic word vectors, inputs the cultural relic word vectors into the encoder of the pre-trained improved Transformer model, maps them into a set of context-aware target word vectors, and inputs the target word vectors into the decoder of the improved Transformer model for decoding to obtain the cultural relic knowledge processing results. The present invention realizes automatic processing of cultural relic knowledge by improving the Transformer model. The improved Transformer model uses a quantum spin optimization algorithm to initialize the weights of the feedforward network to ensure the stability of weight initialization, uses an inter-layer nonlinear coupling constraint loss function to better process the multi-dimensional features in the cultural relic text data, and uses a quantum accelerated gradient update mechanism to speed up the processing speed, so that large-scale, multi-dimensional cultural relic knowledge can be efficiently processed.

[0063] See also Figure 2 , an embodiment of the present invention discloses a flow chart of a method for processing cultural relics knowledge, the method comprising:

[0064] Step S101: Acquire cultural relic text data corresponding to the cultural relic knowledge to be processed.

[0065] The knowledge of cultural relics to be processed includes but is not limited to multi-dimensional content such as the historical background, cultural connotation, text description, and unearthed information of the cultural relics, and the knowledge of cultural relics to be processed has high precision and high reliability.

[0066] Step S102: Use pre-trained word vectors to perform text embedding on the cultural relic text data, and convert the cultural relic text data into cultural relic word vectors.

[0067] Since the input of the improved Transformer model is an embedding vector, it is necessary to convert the cultural relic text data into a vector representation suitable for the improved Transformer model to ensure that the cultural relic text data can be effectively processed by the model. In this paper, pre-trained word vectors are used to embed the cultural relic text data, obtaining cultural relic word vectors suitable for the improved Transformer model.

[0068] Pre-trained word vectors include BERT (Bidirectional Encoder Representations from Transformers), GPT (Generative Pre-trained Transformer), etc.

[0069] In practical applications, before using pre-trained word vectors to embed cultural relic text data, the data can be pre-processed, including denoising, standardization, and normalization, to provide clear and consistent data for subsequent data analysis. Pre-trained word vectors are then used to embed the pre-processed cultural relic text data, converting it into cultural relic word vectors.

[0070] Step S103: Input the cultural relic word vector into the encoder of the pre-trained improved Transformer model and map it into a set of context-aware target word vectors.

[0071] The encoder of the pre-trained improved Transformer model maps the input cultural relic word vectors into a set of context-aware vector representations, namely the target word vectors, based on the learned cultural relic features and context information.

[0072] It should be noted that the pre-trained improved Transformer model in the present invention is actually a large cultural relic knowledge model used to realize the processing of cultural relic knowledge.

[0073] Step S104: input the target word vector into the decoder of the improved Transformer model for decoding to obtain a cultural relic knowledge processing result.

[0074] Among them, the cultural relic knowledge processing results obtained by decoding can be text classification labels, feature extraction results or speech analysis results, etc.

[0075] The improved Transformer model in the present invention is a pre-trained knowledge question-answering model, and the output result of the improved Transformer model is related to the input question.

[0076] It should be noted that during inference, the improved Transformer model utilizes a multi-head attention mechanism between each layer to capture important information in the text and processes the input data based on the optimized weight matrix. Furthermore, the inference process does not involve any new parameter updates. Instead, it leverages the artifact knowledge acquired during training to generate processing results for the input data through inference.

[0077] In summary, the present invention discloses a method for processing cultural relic knowledge, which obtains cultural relic text data corresponding to the cultural relic knowledge to be processed, uses pre-trained word vectors to perform text embedding on the cultural relic text data, converts the cultural relic text data into cultural relic word vectors, inputs the cultural relic word vectors into the encoder of the pre-trained improved Transformer model, maps them into a set of context-aware target word vectors, and inputs the target word vectors into the decoder of the improved Transformer model for decoding to obtain the cultural relic knowledge processing results. The present invention realizes automatic processing of cultural relic knowledge by improving the Transformer model. The improved Transformer model uses a quantum spin optimization algorithm to initialize the weights of the feedforward network to ensure the stability of weight initialization, uses an inter-layer nonlinear coupling constraint loss function to better process the multi-dimensional features in the cultural relic text data, and uses a quantum accelerated gradient update mechanism to speed up the processing speed, so that large-scale, multi-dimensional cultural relic knowledge can be efficiently processed.

[0078] The training process of the improved Transformer model in this invention mainly includes the following units:

[0079] (1) Data acquisition unit

[0080] The data collection unit is used to obtain and organize cultural relic text data of cultural relic knowledge to ensure the comprehensiveness and quality of cultural relic text data.

[0081] The functions of the data collection unit include collecting cultural relics text data, covering multi-dimensional content such as the historical background, cultural connotation, text description, and unearthed information of the cultural relics, and the cultural relics text data should be highly accurate and reliable.

[0082] The data collection unit also includes data preprocessing functions, which perform operations such as denoising, standardization, and normalization on the collected original cultural relic text data to provide clear and consistent input data for subsequent data analysis and modeling.

[0083] Furthermore, the collected cultural relic text data is constructed into a training set. Taking the improved Transformer model as the basic architecture of the large model, for example, in order to train the improved Transformer model, cultural relic text data containing cultural relic knowledge needs to be prepared. Specifically, the cultural relic text data needs to be annotated and classified by dimensions such as subject, time, and region (annotated according to different classification dimensions) to ensure data structure so that the model can understand different categories and contextual relationships. In addition, the collected cultural relic text data should be of sufficient diversity and scale to ensure that it can support the deep learning requirements of the improved Transformer model.

[0084] Since the input of the improved Transformer model is an embedding vector, the cultural relic text data needs to be encoded. The present invention uses pre-trained word vectors for text embedding, converting the cultural relic text data into a vector representation suitable for the improved Transformer model, namely, the cultural relic word vector, to ensure that the cultural relic knowledge can be effectively understood by the model.

[0085] Furthermore, the cultural relics text data are divided into training set, validation set and test set according to a certain ratio to ensure that the model performance can be effectively evaluated during the training process.

[0086] The training set is used for model learning, the validation set is used for model parameter adjustment, and the test set is used to evaluate the generalization ability of the final model.

[0087] Furthermore, because the improved Transformer model relies on input sequence data for self-attention calculations, cultural relic text data needs to be segmented by sequence. Based on the characteristics of cultural relic knowledge, the data acquisition unit can set an appropriate maximum sequence length to ensure that each input sequence contains sufficient contextual information to avoid information loss.

[0088] (2) Data storage unit

[0089] The data storage unit is used to store and manage large-scale cultural relic text data, ensuring efficient access and security of cultural relic text data.

[0090] The functions of the data storage unit include long-term storage and fast query of cultural relics text data, and data is stored through a database or distributed storage system.

[0091] The data storage unit should also support high-concurrency data access and be able to ensure data backup, recovery and data consistency to ensure the integrity and security of cultural relics text data.

[0092] (3) Machine Learning Modeling Unit

[0093] The machine learning modeling unit is used to analyze and model the collected cultural relics text data through machine learning algorithms, and to discover the potential patterns and knowledge in the data.

[0094] The functions of the machine learning modeling unit include selecting appropriate natural language processing algorithms for modeling, such as word vector models (Word2Vec), long short-term memory networks (LSTM), transformers, etc., and using training sets to optimize the models so that they can perform tasks such as automatic classification, feature extraction, and semantic analysis of cultural relics knowledge.

[0095] The machine learning modeling unit also includes model validation and evaluation functions, which use cross-validation, accuracy, recall and other evaluation methods to comprehensively evaluate the accuracy, robustness and generalization ability of the model.

[0096] Taking the improved Transformer model as the basic architecture of the large model, the machine learning modeling unit builds and trains the improved Transformer model, and uses the trained improved Transformer model to process cultural relics knowledge.

[0097] (IV) Model deployment and application unit

[0098] The model deployment and application unit is used to apply the trained improved Transformer model to actual tasks and provide users with intelligent services related to cultural relics knowledge.

[0099] The Model Deployment and Application Unit deploys trained models into production environments and interacts with users through APIs (Application Programming Interfaces) and front-end interfaces. It also includes real-time inference capabilities, enabling real-time analysis of user-submitted cultural relic text and providing classification, recognition, or recommendation results.

[0100] (V) Knowledge Update and Management Unit

[0101] Knowledge updating and management are used to continuously update the cultural relics knowledge base and maintain the timeliness and accuracy of cultural relics-related knowledge.

[0102] The functions of the knowledge updating and management unit include fine-tuning the existing model based on new cultural relics knowledge text data or knowledge reasoning results to ensure that the model can adapt to new data changes.

[0103] The knowledge updating and management unit also includes knowledge management functions, which classify, store and retrieve cultural relics knowledge, support intelligent knowledge updating and version management, and provide continuous and effective cultural relics information support.

[0104] (6) Evaluation and Feedback Unit

[0105] The evaluation and feedback unit is used to monitor and evaluate the effectiveness of the trained improved Transformer model in real time to ensure continuous optimization and efficient operation of the model.

[0106] The functions of the evaluation and feedback unit include evaluating the model through indicators such as user feedback and prediction accuracy, analyzing the performance of the model in actual applications, and promptly discovering and fixing potential problems.

[0107] The evaluation and feedback unit also includes a model retraining mechanism, which retrains the model based on the feedback results to continuously improve the model's performance and adaptability.

[0108] It should be noted that the feedforward network of the Transformer model is a neural network structure composed of neurons, which plays a role in enhancing the model's nonlinear processing capabilities. The neural network structure includes weights and bias parameters. To avoid the gradient vanishing and gradient descent phenomena caused by the traditional neural network using the gradient descent method to update parameters, as well as to avoid the phenomenon of parameters falling into the local optimal solution after training, the present invention adopts a training method based on the quantum feedback mechanism when training the feedforward network during the training process of the improved Transformer model. The training process is as follows:

[0109] (1) The weights of the feedforward network are initialized using the quantum spin optimization algorithm.

[0110] In the training of cultural relic text data, the optimization of weight initialization can significantly reduce the gradient vanishing or gradient exploding phenomena caused by random initialization. The present invention optimizes the initial weights of the feedforward network to avoid the instability and error problems caused by the random initialization of the traditional feedforward network, while improving the convergence speed of the feedforward network training. By initializing the weights of the feedforward network through the quantum spin optimization algorithm, it can more accurately approach the global optimal solution and avoid falling into the local minimum.

[0111] Therefore, in the training process of the improved Transformer model, the process of initializing the weights of the feedforward network using the quantum spin optimization algorithm includes:

[0112] Calculate the product of the quantum optimization operator and the original weight matrix of the feedforward network to obtain the weight matrix of the feedforward network.

[0113] Among them, the weight matrix is ​​the matrix after the original weight matrix is ​​initialized, and the quantum optimization operator represents the quantum spin rotation operation and is determined based on the quantum spin rotation angle.

[0114] The expression of the weight matrix of the feedforward network is as follows:

[0115] (3);

[0116] Where W is the weight matrix of the feedforward network, which represents the connection strength between neurons and is used to adjust the influence between neurons in the network model, directly affecting the feature learning and representation ability of cultural relic text data. is the quantum optimization operator, representing the quantum spin rotation operation, is the quantum spin rotation angle, which represents the adjustment parameter of quantum optimization; R is the original weight matrix in the feedforward network, which represents the initialization weight of the traditional feedforward network.

[0117] The quantum spin optimization algorithm adjusts the weight matrix of the feedforward network using the quantum spin rotation angle, calculated by the inner product of the input data and the weight matrix. Because the diversity and complexity of cultural relic text data require more precise initialization to avoid instability in model training, learning features from cultural relic text data is particularly important.

[0118] The process of determining the quantum spin rotation angle in the present invention includes:

[0119] Calculate the product of the cultural relic word vector in the cultural relic text data and the original weight matrix to obtain the inner product representing the initial correlation strength between the cultural relic word vector and the original weight matrix;

[0120] The quantum spin rotation angle is obtained based on the inner product, the initial offset compensation of the sparse features in the cultural relic text data, and the adjustment factor.

[0121] Quantum spin rotation angle The expression is as follows:

[0122] (4);

[0123] Where, is X i is the i-th training sample, representing the input data, where N is the number of training samples in the cultural relics text data processing task, X i is the cultural relic word vector; R i is the i-th weight matrix element, indicating the value of the corresponding position in the original weight matrix, X i ·R iis the inner product of the training sample and the original weight matrix, representing the initial correlation strength between the cultural relic word vector and the original weight matrix; is a constant bias term, which characterizes the initial offset in the quantum optimization process, specifically the initial offset compensation of sparse features in cultural relic text data; To adjust the factor, control the scale of the quantum rotation angle, and prevent the inner product value caused by the high-dimensional word vector of the artifact from being too large (to avoid gradient explosion). Preferably, Set to 0.2.

[0124] In one embodiment, the parameters Figure 3 This paper presents a comparison of the weight distributions of a quantum-initialized feedforward network weights and a traditional randomly initialized feedforward network weights. To verify the effectiveness of the quantum spin optimization algorithm initialization method (referred to as "quantum initialization") in improving the stability of the weight matrix, by comparing it with the traditional random initialization method (referred to as "traditional initialization"), it is shown that the weight values ​​of the present invention exhibit a multi-peak clustered distribution characteristic, rather than the dispersed unimodal Gaussian distribution used in the traditional method. Experimental results demonstrate that the quantum rotation operation precisely controls the initial position of the weights, bringing the weight matrix closer to the neighborhood of multiple potential global optimal solutions. This avoids the problem of excessively wide weight distribution caused by the randomness of the traditional random initialization method, confirming the optimization effect of quantum initialization on gradient stability and convergence direction from a mathematical distribution perspective.

[0125] (2) Calculate the inter-layer nonlinear coupling constraint loss function.

[0126] In practical applications, the training process of the improved Transformer model also includes:

[0127] Based on the weight matrix of the feedforward network, the inter-layer nonlinear coupling constraint loss function is determined.

[0128] The training of traditional feedforward networks usually assumes that the weight adjustments between each layer are performed independently. However, in complex data scenarios, the coupling relationship between parameters is often ignored, which may lead to insufficient model fitting ability for the data. In order to improve the performance of feedforward networks when processing complex and nonlinear data, the present invention adopts nonlinear coupling constraints to ensure that the parameter adjustments between the layers of the feedforward network can affect each other, avoiding the degradation of model performance caused by ignoring the interaction between layers. The nonlinear coupling constraints are constrained during the training process through the loss function. In the processing of cultural relics text data, it helps to improve the feedforward network's ability to express multidimensional features such as vocabulary, syntax and semantics.

[0129] In the present invention, based on the weight matrix of the feedforward network, the inter-layer nonlinear coupling constraint loss function is determined, including:

[0130] Determine a first nonlinear function corresponding to a weight matrix of an i-th layer of the feedforward network, a second nonlinear function corresponding to a weight matrix of an i+1-th layer of the feedforward network, and a coupling coefficient of the i-th layer;

[0131] The product of the first nonlinear function, the second nonlinear function and the i-th layer coupling degree coefficient is determined as the inter-layer nonlinear coupling constraint loss function.

[0132] The expression of the inter-layer nonlinear coupling constraint loss function is as follows:

[0133] (5);

[0134] Where, L cou is the inter-layer nonlinear coupling constraint loss function, which is used to control the coupling relationship between layers. In the task of processing cultural relics text data, cultural relics text data usually has a multi-level structure (such as vocabulary, syntax, and semantics), and inter-layer coupling helps to improve the model's ability to express these multi-dimensional features; W i is the weight matrix of the i-th layer of the feedforward network, W i+1 is the weight matrix of the i+1th layer of the feedforward network, W i and W i+1 Indicates the connection strength between two adjacent layers in the feedforward network. f(W) is a nonlinear function that characterizes the nonlinear transformation of the feedforward network weights. f(W) can use the Sigmoid nonlinear activation function. i ) represents the first nonlinear function corresponding to the weight matrix of the i-th layer of the feedforward network, f(W i+1 ) The second nonlinear function corresponding to the weight matrix of the i+1th layer of the feedforward network, is the coupling coefficient of the i-th layer.

[0135] Furthermore, the coupling coefficient of the i-th layer The determination process includes:

[0136] According to the correlation between the activation values ​​of the i-th layer and the activation values ​​of the i+1-th layer of the feedforward network, as well as the cultural relic word vectors and the number of training samples, the coupling degree coefficient of the i-th layer is obtained.

[0137] In order to accurately reflect the nonlinear relationship between layers, adjusting the coupling coefficient of each layer can effectively capture the nonlinear relationship between input features and activation, and improve the model's processing ability on complex, high-dimensional cultural relics knowledge text data. The calculation expression of the coupling coefficient of the i-th layer is as follows:

[0138] (6);

[0139] Where A i is the activation value of the i-th layer of the feedforward network, Ai+1 is the activation value of the i+1th layer of the feedforward network, A i and A i+1 Both represent the layer output of the feedforward network, A T i+1 A i+1 The transpose of A i ·A T i+1 Characterizes the correlation between the activation values ​​of the i-th layer and the activation values ​​of the i+1-th layer of the feedforward network, capturing the hierarchical features of vocabulary → syntax → semantics in the cultural relic text, X j is the jth training sample, representing the input features, specifically the cultural relic word vector in the cultural relic text data, X T j For X j is the transpose of , and M is the number of training samples.

[0140] In one embodiment, to analyze the enhancement mechanism of inter-layer nonlinear coupling constraint loss function on inter-layer information transmission, see Figure 4 , a comparison diagram of a gradient flow field with interlayer coupling constraint and a gradient flow field without coupling constraint provided by an embodiment of the present invention, wherein (a) is a schematic diagram of the gradient flow field with interlayer coupling constraint, and (b) is a schematic diagram of the gradient flow field without coupling constraint, Figure 4 The horizontal axis represents weight dimension 1, the vertical axis represents weight dimension 2, and the gradient strength is shown. Comparing the propagation direction and strength of the gradient flow field with interlayer coupling constraints and the gradient flow field without coupling constraints reveals that the gradient flow field with interlayer coupling constraints exhibits a clear vortex structure and directional consistency, while the gradient flow direction of the traditional gradient flow field without coupling constraints is turbulent and divergent. Experimental results demonstrate that interlayer coupling constraints, by establishing nonlinear associations between interlayer parameters, guide the gradient flow field to propagate along the hierarchical direction of feature expression, thereby significantly improving the Transformer model's ability to collaboratively extract lexical, syntactic, and semantic features from text, and addressing the feature transfer attenuation problem caused by interlayer isolation in traditional feedforward networks.

[0141] (3) Use quantum feedback mechanism to dynamically update weights.

[0142] To improve optimization accuracy and avoid local minima, the present invention adopts the feedback mechanism of quantum spin optimization. During the quantum spin optimization process, the adjustment of the optimization path is not static, but dynamically adjusted through the feedback mechanism, ensuring that during the training process, each optimization can gradually approach the optimal solution, avoiding the possible local minima in the traditional gradient descent method. In the cultural relic text data, the quantum feedback mechanism enables the model to adjust the weights in real time during the training process, more accurately fitting the complex patterns in the cultural relic text data.

[0143] Therefore, the training process of improving the Transformer model also includes:

[0144] Based on the inter-layer nonlinear coupling constraint loss function, a quantum feedback mechanism is used to dynamically update the weight matrix of the feedforward network.

[0145] Specifically: based on the learning rate, weight gradient, quantum acceleration gradient, the gradient of the inter-layer nonlinear coupling constraint loss function with respect to the weight, the quantum spin optimization feedback adjustment coefficient, and the weight adjustment brought by quantum spin feedback that characterize the update step size of each iteration, the weight matrix of the feedforward network of the tth iteration is updated to obtain the weight matrix of the feedforward network of the t+1th iteration.

[0146] In quantum spin optimization, the feedback mechanism is implemented as follows:

[0147] (7);

[0148] Where W t+1 is the weight matrix of the feedforward network at the t+1th iteration, W t is the weight matrix of the feedforward network at the tth iteration, To characterize the learning rate of each iterative update step, is the weight gradient, which represents the partial derivative of the loss function with respect to the weight, is the quantum acceleration gradient, is the gradient of the inter-layer nonlinear coupling constraint loss function with respect to the weights, Optimize the feedback regulation coefficient for quantum spin, Weight adjustment due to quantum spin feedback,

[0149] Preferably, The value of is 0.2.

[0150] In one embodiment, the learning rate determination process includes:

[0151] The learning rate is obtained based on the weight gradient, feedback gain factor and quantum spin feedback amount.

[0152] It should be noted that the quantum feedback mechanism enhances the optimization accuracy by adopting the learning rate, which depends on the difference between the current gradient and the feedback information. The expression is as follows:

[0153] (8);

[0154] Where, is the feedback gain factor, which controls the strength of the feedback effect. For example, the training error of the current iteration can be selected as the value of the feedback gain factor to adapt to the gradient fluctuation caused by noisy annotations (such as fuzzy descriptions) in the cultural relics text data. L is the cross entropy loss function. is the weight gradient, which represents the partial derivative of the loss function with respect to the weight, The quantum spin feedback quantity represents the feedback adjustment given by quantum computing. The loss change is used to capture the non-stationary nature of text features (such as the difference in gradient direction between different types of cultural relics). For example, the change in the loss function between the current iteration and the previous iteration can be selected as the value of the quantum spin feedback quantity.

[0155] In one embodiment, see Figure 5 , a schematic diagram comparing a quantum feedback path and a traditional optimization path disclosed in an embodiment of the present invention, wherein, in order to analyze the dynamic control ability of the quantum feedback mechanism on the path optimization process, on a complex non-convex loss surface, the traditional optimization path exhibits irregular oscillations and falls into a local minimum area, while the quantum feedback path accurately approaches the global optimal point in the form of a spiral descent, indicating that the feedback mechanism effectively overcomes the "overshoot" or "stagnation" phenomenon caused by the fixed learning rate of the traditional gradient descent method by dynamically adjusting the parameter update step size and direction through real-time fusion of quantum gradient and classical gradient information, proving the adaptive advantage of quantum feedback in feature learning of complex cultural relics text data.

[0156] (4) Determine the quantum acceleration gradient.

[0157] In order to solve the problem of large computational complexity caused by traditional gradient descent methods, the present invention adopts a quantum accelerated gradient update mechanism, which uses the parallel capability of quantum computing to significantly speed up the gradient calculation speed, and can significantly improve the training efficiency when processing cultural relic text data.

[0158] The process of determining the quantum acceleration gradient includes: obtaining the quantum acceleration gradient based on the quantum acceleration factor, the quantum optimization operator representing the quantum spin rotation operation, the artifact word vector as the training sample, and the gradient of the cross entropy loss function for the nth training sample.

[0159] The expression of quantum acceleration gradient is as follows:

[0160] (9);

[0161] Where, is the quantum acceleration gradient, is the quantum acceleration factor, which reduces the weight of high-gradient samples (such as named entities of cultural relics) and suppresses the interference of abnormal samples (such as incomplete text) on training. n is the nth input sample, specifically the cultural relic word vector used as a training sample, For Xn The transpose of is the quantum optimization operator, representing the quantum spin rotation operation, It accelerates the interaction between word vectors and weights for quantum parallel computing, which is suitable for large-scale feature dimensions in cultural relics text data, such as BERT (Bidirectional Encoder Representations from Transformers, a bidirectional encoder representation model based on Transformer) word vectors. is the gradient of the cross entropy loss function for the nth training sample.

[0162] Quantum acceleration factor The expression is as follows:

[0163] (10);

[0164] Where, The parameters affected by the preset quantum acceleration factor, such as The value of is 2.

[0165] (5) Iteration termination determination.

[0166] Repeat iterations (2) to (4) until the preset stop iteration condition is met, which means that the training of the improved Transformer model is completed.

[0167] In one embodiment, the preset condition for stopping iteration is reaching a preset maximum number of iterations. Preferably, the preset maximum number of iterations is set to 1000 times.

[0168] In summary, the present invention ensures that the trained improved Transformer model can effectively learn and understand the potential laws and contextual relationships in cultural relic knowledge through multi-dimensional collection, preprocessing, encoding and reasonable division of training data sets of cultural relic text data, thereby improving the automatic classification, semantic analysis and feature extraction capabilities of cultural relic knowledge. The use of quantum spin optimization algorithm, inter-layer nonlinear coupling constraint loss function and quantum accelerated gradient improves the stability and efficiency of model training, avoids the gradient vanishing, gradient explosion and local minimum problems in the traditional training process, and accelerates the processing of large-scale data sets. The use of quantum spin optimization training method, inter-layer nonlinear coupling constraint loss and feedback mechanism enables the improved Transformer model to better capture the multi-level features in cultural relic text data when processing complex and high-dimensional cultural relic knowledge data, thereby improving the generalization ability and robustness of the model. In addition, the knowledge update and management mechanism ensures the continuous updating and optimization of the cultural relic knowledge base, and the evaluation and feedback mechanism supports real-time monitoring and retraining of the model, enhancing the adaptability of the improved Transformer model and ensuring the long-term efficient operation of the improved Transformer model.

[0169] Corresponding to the above method embodiment, the present invention also discloses a cultural relics knowledge processing device.

[0170] See also Figure 6 , a schematic structural diagram of a cultural relics knowledge processing device disclosed in an embodiment of the present invention, the device may include:

[0171] The acquisition unit 201 is used to acquire cultural relic text data corresponding to the cultural relic knowledge to be processed.

[0172] The vector conversion unit 202 is used to use pre-trained word vectors to perform text embedding on the cultural relic text data, and convert the cultural relic text data into cultural relic word vectors.

[0173] The encoding unit 203 is used to input the cultural relic word vector into the encoder of the pre-trained improved Transformer model to map it into a set of context-aware target word vectors.

[0174] Among them, the improved Transformer model uses a quantum spin optimization algorithm to initialize the weights of the feedforward network during training, uses an inter-layer nonlinear coupling constraint loss function, and uses a quantum accelerated gradient update mechanism to speed up processing.

[0175] The decoding unit 204 is used to input the target word vector into the decoder of the improved Transformer model for decoding to obtain a cultural relic knowledge processing result.

[0176] In summary, the present invention discloses a device for processing cultural relics knowledge, which obtains cultural relics text data corresponding to the cultural relics knowledge to be processed, uses pre-trained word vectors to perform text embedding on the cultural relics text data, converts the cultural relics text data into cultural relics word vectors, inputs the cultural relics word vectors into the encoder of the pre-trained improved Transformer model, maps them into a set of context-aware target word vectors, and inputs the target word vectors into the decoder of the improved Transformer model for decoding to obtain the cultural relics knowledge processing results. The present invention realizes the automatic processing of cultural relics knowledge by improving the Transformer model. The improved Transformer model uses a quantum spin optimization algorithm to initialize the weights of the feedforward network to ensure the stability of weight initialization, uses an inter-layer nonlinear coupling constraint loss function to better process the multi-dimensional features in the cultural relics text data, and uses a quantum accelerated gradient update mechanism to speed up the processing speed, so that large-scale, multi-dimensional cultural relics knowledge can be efficiently processed.

[0177] The cultural relics knowledge processing device may further include a model training unit:

[0178] Model training unit, used to train the improved Transformer model.

[0179] In one embodiment, the process of initializing the weights of the feedforward network using the quantum spin optimization algorithm by the model training unit includes:

[0180] The product of the quantum optimization operator and the original weight matrix of the feedforward network is calculated to obtain the weight matrix of the feedforward network, wherein the weight matrix is ​​a matrix after the original weight matrix is ​​initialized, and the quantum optimization operator represents the quantum spin rotation operation and is determined based on the quantum spin rotation angle.

[0181] The process of determining the quantum spin rotation angle includes:

[0182] Calculating the product of the cultural relic word vector in the cultural relic text data and the original weight matrix to obtain an inner product representing the initial correlation strength between the cultural relic word vector and the original weight matrix;

[0183] The quantum spin rotation angle is obtained based on the inner product, the initial offset compensation of the sparse features in the cultural relic text data, and the adjustment factor.

[0184] In one embodiment, the model training unit may be specifically used to:

[0185] Based on the weight matrix of the feedforward network, the inter-layer nonlinear coupling constraint loss function is determined.

[0186] In one embodiment, the process of determining the inter-layer nonlinear coupling constraint loss function by the model training unit based on the weight matrix of the feedforward network includes:

[0187] Determine a first nonlinear function corresponding to a weight matrix of an i-th layer of the feedforward network, a second nonlinear function corresponding to a weight matrix of an i+1-th layer of the feedforward network, and a coupling coefficient of the i-th layer;

[0188] The product of the first nonlinear function, the second nonlinear function and the i-th layer coupling degree coefficient is determined as the inter-layer nonlinear coupling constraint loss function.

[0189] The process of determining the coupling degree coefficient of the i-th layer includes:

[0190] The coupling degree coefficient of the i-th layer is obtained according to the correlation between the activation value of the i-th layer and the activation value of the i+1-th layer of the feedforward network, as well as the cultural relic word vectors and the number of training samples used as training samples.

[0191] In one embodiment, the model training unit may be specifically used to:

[0192] Based on the inter-layer nonlinear coupling constraint loss function, a quantum feedback mechanism is adopted to dynamically update the weight matrix of the feedforward network.

[0193] In one embodiment, the process of the model training unit dynamically updating the weight matrix of the feedforward network using a quantum feedback mechanism based on the inter-layer nonlinear coupling constraint loss function includes:

[0194] Based on the learning rate, weight gradient, quantum acceleration gradient, the gradient of the inter-layer nonlinear coupling constraint loss function with respect to the weight, the quantum spin optimization feedback adjustment coefficient, and the weight adjustment brought about by quantum spin feedback that characterize the update step size of each iteration, the weight matrix of the feedforward network of the tth iteration is updated to obtain the weight matrix of the feedforward network of the t+1th iteration.

[0195] The learning rate determination process includes:

[0196] The learning rate is obtained based on the weight gradient, the feedback gain factor and the quantum spin feedback amount.

[0197] The process of determining the quantum acceleration gradient includes:

[0198] The quantum acceleration gradient is obtained based on the quantum acceleration factor, the quantum optimization operator representing the quantum spin rotation operation, the artifact word vector as the training sample, and the gradient of the cross entropy loss function for the nth training sample.

[0199] It should be noted that, for the specific working principles of the various components in the device embodiment, please refer to the corresponding part of the method embodiment, which will not be repeated here.

[0200] Corresponding to the above embodiment, the present invention further discloses a computer storage medium, which stores at least one instruction. When the at least one instruction is executed by a processor, the steps shown in the embodiment of the cultural relics knowledge processing method are implemented.

[0201] A computer storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer storage medium may be a machine-readable signal medium or a machine-readable storage medium. A computer storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0202] Corresponding to the above embodiment, Figure 7 As shown, the present invention also provides a structural diagram of an electronic device, which may include: a processor 1 and a memory 2;

[0203] The processor 1 and the memory 2 communicate with each other via a communication bus 3.

[0204] Processor 1, configured to execute at least one instruction;

[0205] Memory 2, used to store at least one instruction;

[0206] The processor 1 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.

[0207] The memory 2 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0208] Among them, the processor executes at least one instruction to implement the steps shown in the embodiment of the cultural relics knowledge processing method.

[0209] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0210] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0211] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for processing cultural relics knowledge, characterized in that: include: Obtain cultural relic text data corresponding to the cultural relic knowledge to be processed; Using pre-trained word vectors to perform text embedding on the cultural relic text data, and converting the cultural relic text data into cultural relic word vectors; The cultural relic word vector is input into the encoder of the pre-trained improved Transformer model and mapped into a set of context-aware target word vectors, wherein the improved Transformer model uses a quantum spin optimization algorithm to initialize the weights of the feedforward network during training, uses an inter-layer nonlinear coupling constraint loss function, and uses a quantum accelerated gradient update mechanism to speed up processing; wherein the quantum spin optimization algorithm adjusts the weight matrix of the feedforward network by using a quantum spin rotation angle, and the quantum spin rotation angle is calculated by the inner product of the input data and the weight matrix; the training process of the improved Transformer model also includes: based on the inter-layer nonlinear coupling constraint loss function, using a quantum feedback mechanism to dynamically update the weight matrix of the feedforward network; based on the inter-layer nonlinear coupling constraint loss function, using a quantum feedback mechanism to dynamically update the weight matrix of the feedforward network; The mechanism dynamically updates the weight matrix of the feedforward network, including: based on the learning rate representing the update step size of each iteration, the weight gradient, the quantum acceleration gradient, the gradient of the inter-layer nonlinear coupling constraint loss function with respect to the weight, the quantum spin optimization feedback adjustment coefficient, and the weight adjustment brought by the quantum spin feedback, the weight matrix of the feedforward network of the tth iteration is updated to obtain the weight matrix of the feedforward network of the t+1th iteration; the process of determining the quantum acceleration gradient includes: based on the quantum acceleration factor, the quantum optimization operator representing the quantum spin rotation operation and determined based on the quantum spin rotation angle, the artifact word vector as the training sample, and the gradient of the cross entropy loss function for the nth training sample, obtaining the quantum acceleration gradient; the quantum acceleration factor is determined according to the preset quantum acceleration factor influencing parameter and the gradient of the cross entropy loss function for the nth training sample; The target word vector is input into the decoder of the improved Transformer model for decoding to obtain the cultural relic knowledge processing result.

2. The method for processing cultural relics knowledge according to claim 1, characterized in that: During the training of the improved Transformer model, the process of initializing the weights of the feedforward network using the quantum spin optimization algorithm includes: Calculating the product of the quantum optimization operator and the original weight matrix of the feedforward network to obtain the weight matrix of the feedforward network, wherein the weight matrix is ​​the matrix after the original weight matrix is ​​initialized; The process of determining the quantum spin rotation angle includes: Calculating the product of the cultural relic word vector in the cultural relic text data and the original weight matrix to obtain an inner product representing the initial correlation strength between the cultural relic word vector and the original weight matrix; The quantum spin rotation angle is obtained based on the inner product, the initial offset compensation of the sparse features in the cultural relic text data, and the adjustment factor.

3. The method for processing cultural relics knowledge according to claim 2, characterized in that: The training process of the improved Transformer model also includes: Based on the weight matrix of the feedforward network, the inter-layer nonlinear coupling constraint loss function is determined.

4. The method for processing cultural relics knowledge according to claim 3, characterized in that: Determining the inter-layer nonlinear coupling constraint loss function based on the weight matrix of the feedforward network includes: Determine a first nonlinear function corresponding to a weight matrix of an i-th layer of the feedforward network, a second nonlinear function corresponding to a weight matrix of an i+1-th layer of the feedforward network, and a coupling coefficient of the i-th layer; The product of the first nonlinear function, the second nonlinear function and the i-th layer coupling degree coefficient is determined as the inter-layer nonlinear coupling constraint loss function.

5. The method for processing cultural relics knowledge according to claim 4, characterized in that: The process of determining the coupling degree coefficient of the i-th layer includes: The coupling degree coefficient of the i-th layer is obtained according to the correlation between the activation value of the i-th layer and the activation value of the i+1-th layer of the feedforward network, as well as the cultural relic word vectors and the number of training samples used as training samples.

6. The cultural relics knowledge processing method according to claim 1, characterized in that: The learning rate determination process includes: The learning rate is obtained based on the weight gradient, the feedback gain factor and the quantum spin feedback amount.

7. The method for processing cultural relics knowledge according to claim 1, characterized in that: The process of determining the quantum acceleration factor includes: ; Where, The parameters affecting the preset quantum acceleration factor are: is the gradient of the cross entropy loss function for the nth training sample, is the quantum acceleration factor.

8. A cultural relic knowledge processing device, characterized in that: include: An acquisition unit, used to acquire cultural relic text data corresponding to the cultural relic knowledge to be processed; A vector conversion unit, configured to perform text embedding on the cultural relic text data using pre-trained word vectors, and convert the cultural relic text data into cultural relic word vectors; The encoding unit is used to input the cultural relic word vector into the encoder of the pre-trained improved Transformer model, and map it into a set of context-aware target word vectors, wherein the improved Transformer model uses a quantum spin optimization algorithm to initialize the weights of the feedforward network during training, uses an inter-layer nonlinear coupling constraint loss function, and uses a quantum accelerated gradient update mechanism to speed up the processing speed; wherein the quantum spin optimization algorithm adjusts the weight matrix of the feedforward network by using a quantum spin rotation angle, and the quantum spin rotation angle is calculated by the inner product of the input data and the weight matrix; the training process of the improved Transformer model also includes: based on the inter-layer nonlinear coupling constraint loss function, using a quantum feedback mechanism to dynamically update the weight matrix of the feedforward network; based on the inter-layer nonlinear coupling constraint loss function, using The quantum feedback mechanism dynamically updates the weight matrix of the feedforward network, including: updating the weight matrix of the feedforward network at the tth iteration based on the learning rate representing the update step size of each iteration, the weight gradient, the quantum acceleration gradient, the gradient of the inter-layer nonlinear coupling constraint loss function with respect to the weight, the quantum spin optimization feedback adjustment coefficient, and the weight adjustment brought about by the quantum spin feedback, to obtain the weight matrix of the feedforward network at the t+1th iteration; the process of determining the quantum acceleration gradient includes: obtaining the quantum acceleration gradient based on the quantum acceleration factor, the quantum optimization operator representing the quantum spin rotation operation and determined based on the quantum spin rotation angle, the artifact word vector as the training sample, and the gradient of the cross entropy loss function for the nth training sample; the quantum acceleration factor is determined according to the preset quantum acceleration factor influencing parameter and the gradient of the cross entropy loss function for the nth training sample; A decoding unit is used to input the target word vector into the decoder of the improved Transformer model for decoding to obtain a cultural relic knowledge processing result.

9. A computer storage medium, characterized in that The computer storage medium stores at least one instruction, and when the at least one instruction is executed by the processor, the cultural relics knowledge processing method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: The electronic device includes: a memory and a processor; The memory is used to store at least one instruction; The processor is used to execute the at least one instruction to implement the cultural relics knowledge processing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Task processing method and device based on model quantification, equipment and storage medium

    CN115860068A

  • Sea surface temperature prediction method and system

    CN120146253A