Large model prompt word engineering method and system

By receiving user task requirements, performing feature mapping and decomposition, and using parallel optimization algorithms to generate optimized prompt words, the problem of lack of intelligence in prompt word construction is solved, and the generation ability and context understanding of the big model are improved.

CN119227691BActive Publication Date: 2025-08-15GUANGZHOU ZHONGCHANG KANGDA INFORMATION TECH

Patent Information

Application Number
CN202411343163.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-08-15
Estimated Expiration
2044-09-25

AI Technical Summary

Technical Problem

In the prior art, the method of constructing prompt words lacks intelligence, resulting in insufficient effective utilization of large models in generation ability and context understanding ability, and it is difficult to meet the diverse task needs of users.

Method used

By receiving the task requirements input by the user, an initial set of prompt words is generated, feature mapping and decomposition is performed, multi-objective optimization is used to use parallel optimization algorithms, and semantic consistency and generation diversity screening are performed to generate the final prompt words.

Benefits of technology

The intelligent generation and optimization of prompt word collection is realized, the efficiency and quality of prompt word construction is improved, and more flexible support is provided for the practical application of large models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227691B_ABST
    Figure CN119227691B_ABST
Patent Text Reader

Abstract

The present invention discloses a large model prompt word engineering method and system, the method comprising: receiving a task requirement input by a user for interacting with a large model, generating a set of initial prompt word sets based on the task requirement; performing feature mapping on the initial prompt word set, constructing a prompt word feature vector set, decomposing the feature vectors in the prompt word feature vector set into a number of sub-feature vectors to capture the different characteristics of the prompt words; performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set; screening the optimized prompt word set for semantic consistency and generation diversity, and determining a number of final prompt words as the large model input corresponding to the task requirement. By using the embodiments of the present invention, it is possible to realize the intelligent generation and optimization of the prompt word set according to the user's task requirement, improve the efficiency and quality of prompt word construction, and provide more flexible support for the practical application of the large model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular to a large model prompt word engineering method and system. Background Art

[0002] With the rapid development of artificial intelligence (AI), particularly in natural language processing (NLP), the widespread use of large models (such as GPT and BERT) has enabled efficient human-machine interaction in a variety of scenarios. Cue word engineering involves designing and optimizing input prompts for large models to maximize their generative and contextual understanding capabilities. Effective cues can help large models more accurately understand user intent and generate high-quality output. However, effectively utilizing these powerful large models, particularly in the construction of cues, remains a challenging research topic. Summary of the Invention

[0003] The purpose of the present invention is to provide a large-scale model prompt word engineering method and system to address the deficiencies in the existing technology. It can realize the intelligent generation and optimization of prompt word sets according to the user's task requirements, improve the efficiency and quality of prompt word construction, and provide more flexible support for the practical application of large models.

[0004] One embodiment of the present application provides a large model prompt word engineering method, the method comprising:

[0005] receiving a task requirement input by a user for interacting with the large model, and generating a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task;

[0006] Perform feature mapping on the initial prompt word set to construct a prompt word feature vector set. Decompose the feature vectors in the prompt word feature vector set into several sub-feature vectors to capture the different characteristics of the prompt words, where each feature vector represents the multi-dimensional feature attributes of the corresponding initial prompt word.

[0007] Performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads;

[0008] The optimized prompt word set is screened for semantic consistency and generative diversity to determine a number of final prompt words as inputs to a large model corresponding to task requirements.

[0009] Optionally, the receiving of a task requirement input by a user for interacting with the large model and generating a set of initial prompt words based on the task requirement include:

[0010] Obtaining a feature description of the task requirements, and quantifying the feature description into a target feature vector;

[0011] Select text fragments related to the task requirements from the external corpus to build the initial corpus;

[0012] Extracting a corpus set related to the target feature vector based on the initial corpus;

[0013] Encoding the semantic information of the corpus set into a latent space, and generating a latent semantic vector associated with the latent space;

[0014] Decoding the latent semantic vector and generating a set of initial prompt words using the latent space to ensure that each initial prompt word has diverse semantic expressions;

[0015] Calculate the cosine similarity between each initial prompt word and the target feature vector, and use TF-IDF to calculate the importance of each initial prompt word in the corpus set;

[0016] A final set of initial prompt words is obtained by screening according to the cosine similarity and the importance.

[0017] Optionally, the feature mapping is performed on the initial prompt word set to construct a prompt word feature vector set, and the feature vector in the prompt word feature vector set is decomposed into several sub-feature vectors, including:

[0018] Performing context-aware encoding on each cue word in the final initial cue word set to generate an initial high-dimensional feature vector set as the cue word feature vector set, where each high-dimensional feature vector captures the deep semantics and contextual information of each cue word;

[0019] The high-dimensional feature vector set is used to form a feature matrix, wherein each row of the feature matrix represents a vector of a prompt word;

[0020] Decomposing the feature matrix into two sub-matrices, wherein the sub-matrices include a feature basis matrix and a coefficient matrix, and each sub-matrix captures different aspects of the prompt word features;

[0021] Perform collaborative analysis on the two sub-matrices to extract the specific representation of each prompt word in different feature dimensions and obtain a set of sub-feature vectors;

[0022] A sparse processing is performed on each sub-feature vector in the sub-feature vector set to obtain a sparse sub-feature vector.

[0023] Optionally, the optimized prompt word set is screened for semantic consistency and generation diversity to determine a number of final prompt words, including:

[0024] Performing semantic vectorization processing on each prompt word in the optimized prompt word set to generate a corresponding semantic vector;

[0025] Calculating the semantic similarity between the semantic vector and the feature vector corresponding to the task requirement;

[0026] Filtering prompt words corresponding to the semantic vectors whose semantic similarity is higher than a preset threshold, so that the filtered prompt words are semantically consistent with the task requirements, and obtaining a semantically consistent prompt word set;

[0027] Clustering the semantic vectors of the prompt words in the semantically consistent prompt word set so that each cluster center can represent a different semantic field;

[0028] The prompt words in each cluster whose distance from the center is less than the preset distance are selected as representative prompt words.

[0029] Another embodiment of the present application provides a large model prompt word engineering system, the system comprising:

[0030] a receiving module, configured to receive a task requirement input by a user for interacting with the large model, and generate a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task;

[0031] A decomposition module is used to perform feature mapping on the initial prompt word set, construct a prompt word feature vector set, and decompose the feature vectors in the prompt word feature vector set into several sub-feature vectors to capture different characteristics of the prompt words, where each feature vector represents a multi-dimensional feature attribute of the corresponding initial prompt word;

[0032] an optimization module, configured to perform multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads;

[0033] The screening module is used to screen the optimized prompt word set for semantic consistency and generation diversity, and determine a number of final prompt words as inputs of a large model corresponding to task requirements.

[0034] Yet another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, wherein the computer program is configured to execute any of the above methods when run.

[0035] Yet another embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any of the above methods.

[0036] Compared with the prior art, the present invention provides a large model prompt word engineering method, which receives task requirements input by a user for interacting with a large model, generates a set of initial prompt word sets based on the task requirements, performs feature mapping on the initial prompt word set, constructs a prompt word feature vector set, and decomposes the feature vectors in the prompt word feature vector set into several sub-feature vectors to capture the different characteristics of the prompt words; uses a parallel optimization algorithm to perform multi-objective optimization on the sub-feature vectors to generate an optimized prompt word set; screens the optimized prompt word set for semantic consistency and generation diversity, and determines several final prompt words as inputs to the large model corresponding to the task requirements. This enables intelligent generation and optimization of the prompt word set based on the user's task requirements, improves the efficiency and quality of prompt word construction, and provides more flexible support for the practical application of large models. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A hardware structure block diagram of a computer terminal for a large model prompt word engineering method provided by an embodiment of the present invention;

[0038] Figure 2 A schematic diagram of a flow chart of a large model prompt word engineering method provided by an embodiment of the present invention;

[0039] Figure 3 A schematic structural diagram of a large model prompt word engineering system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limiting the present invention.

[0041] The embodiment of the present invention first provides a large model prompt word engineering method, which can be applied to electronic devices such as computer terminals, specifically ordinary computers, etc.

[0042] The following describes it in detail by taking running on a computer terminal as an example. Figure 1 The hardware structure block diagram of a computer terminal for a large model prompt word engineering method provided by an embodiment of the present invention. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer terminal may also include a transmission device 106 for communication functions and an input and output device 108. It will be understood by those skilled in the art that Figure 1The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0043] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / modules corresponding to the large model prompt word engineering method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0044] Transmission device 106 is used to receive or transmit data via a network. A specific example of such a network may include a wireless network provided by a computer terminal's communications provider. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0045] See also Figure 2 , an embodiment of the present invention provides a large model prompt word engineering method, which may include the following steps:

[0046] S201, receiving a task requirement input by a user for interacting with a large model, and generating a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task;

[0047] First, we need to capture user input—the specific task requirements they wish to perform when interacting with the large model. These tasks can be diverse, such as text generation, question answering, and data analysis. Preprocessing the user input is necessary to ensure that subsequent processes can accurately understand and interpret the user's intent. This step ensures that the generated prompts are directly relevant to the user's expectations and needs, enhancing personalization and targeting.

[0048] After receiving explicit task requirements from the user, an initial set of prompt words is generated based on this information. These prompt words are associated with the characteristic dimensions of the specific task, ensuring that the generated prompt words accurately reflect the core task that the user needs to perform.

[0049] Specifically, a feature description of the task requirement may be obtained, and the feature description may be quantified into a target feature vector;

[0050] In this phase, the system first extracts key features from the user's input, which may include factors such as the task's topic, importance, and desired style. These features are then converted into numerical target feature vectors for subsequent processing. Quantified features enable efficient calculation and matching within a mathematical space, enabling subsequent processing using machine learning algorithms.

[0051] The Transformer model can be used to perform contextual analysis on user input, extract feature descriptions, and quantize them into target feature vectors through the pre-trained BERT model.

[0052] Select text fragments related to the task requirements from the external corpus to build the initial corpus;

[0053] This step involves sifting through large amounts of text data, selecting text snippets relevant to user needs, and forming a preliminary corpus. Building this initial corpus provides a diverse semantic context for subsequent prompt word generation, ensuring that generated prompt words are rich in contextual information.

[0054] Clustering algorithms can be used to cluster external corpora, and the required fields for each task can be selected based on the cluster centers to ensure that the selected text fragments have more comprehensive field coverage.

[0055] Extracting a corpus set related to the target feature vector based on the initial corpus;

[0056] In this phase, the system analyzes the initial corpus and extracts text segments that match the target feature vectors to form a more accurate corpus. This step ensures that the generated prompts accurately reflect user needs and enhances the relevance and effectiveness of the corpus.

[0057] The LDA (Latent Dirichlet Allocation) model can be used to extract topic words related to the target feature vector from the initial corpus to form a corpus collection with high relevance.

[0058] Encoding the semantic information of the corpus set into a latent space, and generating a latent semantic vector associated with the latent space;

[0059] The system uses deep learning technology to map the extracted corpus into a latent space and generate latent semantic vectors. The latent space helps capture the deep semantic relationships between texts, providing a richer information foundation for the subsequent generation of prompt words.

[0060] The extracted corpus can be mapped to the latent space using a variational autoencoder (VAE) to generate rich latent semantic vectors.

[0061] Decoding the latent semantic vector and generating a set of initial prompt words using the latent space to ensure that each initial prompt word has diverse semantic expressions;

[0062] By using a variational autoencoder and decoding latent semantic vectors, the system generates a diverse set of initial prompt words, each reflecting different semantic characteristics. This diverse set of prompt words attracts user attention and enhances the richness and appeal of subsequent generated content.

[0063] Calculate the cosine similarity between each initial prompt word and the target feature vector, and use TF-IDF to calculate the importance of each initial prompt word in the corpus set;

[0064] The system evaluates relevance by calculating the cosine similarity between the initial prompt word and the target feature vector. It also uses the TF-IDF (Term Frequency-Inverse Document Frequency) algorithm to measure the importance of each prompt word within the corpus. This approach ensures that each prompt word is not only relevant to the user's task but also highly representative, improving subsequent processing.

[0065] A final set of initial prompt words is obtained by screening according to the cosine similarity and the importance.

[0066] The system ultimately selects a suitable set of initial prompt words that perform well in cosine similarity and TF-IDF evaluations. Through careful screening, the final set of initial prompt words can better meet user needs and provide strong support for subsequent tasks. Initial prompt words with a cosine similarity higher than a preset pre-similarity and an importance greater than a preset importance threshold can be selected as the final set of initial prompt words.

[0067] S202, performing feature mapping on the initial prompt word set to construct a prompt word feature vector set, decomposing the feature vectors in the prompt word feature vector set into a plurality of sub-feature vectors to capture different characteristics of the prompt words, wherein each feature vector represents a multi-dimensional feature attribute of the corresponding initial prompt word;

[0068] The initial set of prompt words provided by the user is converted into a set of feature vectors to facilitate in-depth analysis and exploration of the various dimensions of the prompt words. First, feature mapping is performed on each prompt word to generate high-dimensional feature vectors. These feature vectors not only capture the basic semantic information of the prompt word, but also include more complex contextual relationships, sentiment, and grammatical structure. Next, these high-dimensional feature vectors are further decomposed into several sub-feature vectors to clarify the performance of the prompt word in different feature dimensions.

[0069] Specifically, context-aware encoding can be performed on each prompt word in the final initial prompt word set to generate an initial high-dimensional feature vector set as the prompt word feature vector set, wherein each high-dimensional feature vector captures the deep semantics and context information of each prompt word;

[0070] We can use context-aware deep learning models (such as BERT and GPT) to encode each cue word and generate a high-dimensional feature vector. This process not only considers the meaning of the cue word itself, but also incorporates its meaning in the specific context, providing richer semantic information.

[0071] Deep semantic understanding: makes the semantics of each prompt word more precise and can effectively capture its relationship with the context; enhances generation capabilities: provides a deeper and broader information foundation for subsequent content generation.

[0072] The high-dimensional feature vector set is used to form a feature matrix, wherein each row of the feature matrix represents a vector of a prompt word;

[0073] This step organizes the high-dimensional feature vectors into a feature matrix, where each row corresponds to a high-dimensional vector for a cue word. This structure facilitates subsequent mathematical calculations and analysis. The encoded high-dimensional vectors for each cue word are arranged into a feature matrix, using NumPy or a similar tool for efficient storage.

[0074] Decomposing the feature matrix into two sub-matrices, wherein the sub-matrices include a feature basis matrix and a coefficient matrix, and each sub-matrix captures different aspects of the prompt word features;

[0075] This step decomposes the feature matrix into two sub-matrices: the feature basis matrix and the coefficient matrix. The feature basis matrix represents the basic pattern of features, while the coefficient matrix reflects the specific expression of these features in different prompt words.

[0076] Feature extraction: Enhance the analysis of prompt word features and identify the main factors affecting the performance of prompt words; Dimension reduction: Reduce computational complexity through matrix decomposition, thereby improving efficiency.

[0077] The non-negative matrix factorization (NMF) method can be used to decompose the feature matrix into a feature basis matrix and a coefficient matrix. This method is particularly suitable for processing features with positive semantics and has strong adaptability.

[0078] Perform collaborative analysis on the two sub-matrices to extract the specific representation of each prompt word in different feature dimensions and obtain a set of sub-feature vectors;

[0079] By collaboratively analyzing the decomposed feature base matrix and coefficient matrix, the system can extract the specific representation of each cue word across different feature dimensions. Independent component analysis (ICA) can be used to collaboratively analyze the two sub-matrices to extract the features that most clearly represent the cue word, ensuring that not only the primary features are extracted, but also independent features relevant to the task are identified.

[0080] A sparse processing is performed on each sub-feature vector in the sub-feature vector set to obtain a sparse sub-feature vector.

[0081] Each sub-feature vector is sparsified, reducing the weight of unimportant components in the vector to emphasize more critical features. Sparsification can be achieved using techniques such as L1 regularization. Lasso regression (L1 regularization) is applied to the extracted sub-feature vectors to compress the coefficients of unimportant features to near zero, ensuring that the resulting sparse vector retains only the most influential features for the task.

[0082] S203, performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads;

[0083] Leveraging the power of parallel optimization algorithms, we perform multi-objective optimization on sub-feature vectors. By simultaneously optimizing multiple preset objectives, we generate a more accurate and effective set of optimized prompt words. This process involves mapping sub-feature vectors to different objective functions, such as improving the relevance, appeal, and diversity of prompt words, thereby ensuring that the generated prompt words perform well across multiple dimensions.

[0084] Specifically, first, multiple objective functions can be defined, such as: 1) improving the relevance of prompt words (combining the context and the needs of the target audience); 2) enhancing the attractiveness of prompt words (combining sentiment analysis results and user preferences); 3) increasing the diversity of prompt words (measured using distribution and information entropy models).

[0085] A fuzzy logic system is used to transform the above objective function into a computable scoring mechanism to accommodate the fuzziness of each objective and the uncertainty associated with its characteristics. The degree of achievement of each objective is represented by a fuzzy set, enabling a more flexible and accurate assessment.

[0086] Divide the sub-feature vectors into several groups, each forming a subtask for parallel processing. For example, you can divide them into different prompt word categories (such as verbs, nouns, and adjectives) to ensure that each subtask focuses on a specific type of optimization.

[0087] Using multithreading technology, each subtask is assigned an independent thread. Each thread optimizes a specific objective function. Existing evolutionary algorithms (such as genetic algorithms) or particle swarm optimization (PSO) methods can be used to perform multiple iterations within each thread to quickly find the optimal solution for the relevant features. This application does not elaborate on these methods here.

[0088] Within each thread, an adaptive convergence judgment mechanism is used to evaluate the current optimization effect based on the results of each iteration. When the objective function reaches stability within the set tolerance, the thread automatically terminates, avoiding unnecessary waste of computing resources.

[0089] Once all threads have completed their optimization tasks, the results from each thread are combined. A weighted average is taken of the optimization results for each objective function to ensure that the contribution of each objective is reflected. Finally, a set of optimization hints is generated that represents the optimal balance across all predefined objectives.

[0090] The generated optimized prompt word set is checked for redundancy, and words with excessive similarity are removed to ensure diversity. This step can be further screened and adjusted using a hierarchical clustering algorithm, combined with the previously defined diversity goal.

[0091] Through the above steps, we can achieve effective parallel optimization, generate a precise and diverse set of optimized prompts, and improve the overall quality and effectiveness of the generation task. This multi-objective optimization approach has great potential and flexibility when handling complex tasks, especially those with diverse user needs.

[0092] S204 , screening the optimized prompt word set for semantic consistency and generation diversity, and determining a number of final prompt words as inputs to a large model corresponding to task requirements.

[0093] By screening the optimized prompt word set for semantic consistency and generative diversity, we ensure that the final selected prompt word best corresponds to the task requirements entered by the user. This process involves multiple key steps, including semantic vectorization of the prompt word, calculating its similarity with the task requirement feature vector, and ensuring its diversity and representativeness through clustering.

[0094] Specifically, semantic vectorization processing may be performed on each prompt word in the optimized prompt word set to generate a corresponding semantic vector;

[0095] This step converts the optimized prompt word into a semantic vector, allowing it to be represented in a numerical space, facilitating subsequent similarity calculations. This enables direct comparison between the prompt word and the task requirement feature vector, providing basic data for semantic consistency screening.

[0096] Calculating the semantic similarity between the semantic vector and the feature vector corresponding to the task requirement;

[0097] Using cosine similarity or other similarity metrics, we calculate the similarity between the semantic vector of each prompt word and the feature vector required by the given task. This quantitative similarity metric can effectively determine the relevance of the prompt word to the target task, providing a basis for the subsequent screening process.

[0098] In addition to directly using cosine similarity, we can also use the similarity calculation method based on the subspace perspective to consider semantic information at different levels to improve the robustness of the similarity calculation.

[0099] Filtering prompt words corresponding to the semantic vectors whose semantic similarity is higher than a preset threshold, so that the filtered prompt words are semantically consistent with the task requirements, and obtaining a semantically consistent prompt word set;

[0100] Based on the calculated similarity values, we select prompt words that exceed a set threshold to ensure that these words are semantically consistent with the user's task requirements. This ensures that the final selected prompt words are semantically consistent with user needs, thereby improving the accuracy and practicality of the generated content.

[0101] Clustering the semantic vectors of the prompt words in the semantically consistent prompt word set so that each cluster center can represent a different semantic field;

[0102] Use a clustering algorithm (such as K-means or hierarchical clustering) to group the selected prompt words, ensuring that the prompt words within each group are semantically similar while maintaining clear differences between groups. By integrating similar prompt words into a set of semantic domains, it is easier to select diverse and representative prompt words. Using a spectral clustering algorithm can more effectively handle nonlinearly separable data while optimizing clustering stability, resulting in more reasonable clustering results.

[0103] The prompt words in each cluster whose distance from the center is less than the preset distance are selected as representative prompt words.

[0104] By calculating the distance between each prompt word and the cluster center, we ensure that the selected prompt words semantically represent the characteristics of each cluster. We then extract the most representative prompt words from each cluster to ensure the diversity and effectiveness of the final prompt word set. The selection of representative prompt words can also be combined with the principle of maximum information entropy to ensure that the selected prompt words are comprehensive and informative, avoiding duplication and redundancy.

[0105] It can be seen that the task requirements for interacting with the big model are received from the user, and a set of initial prompt word sets are generated based on the task requirements; feature mapping is performed on the initial prompt word set to construct a prompt word feature vector set, and the feature vectors in the prompt word feature vector set are decomposed into several sub-feature vectors to capture the different characteristics of the prompt words; multi-objective optimization is performed on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set; the optimized prompt word set is screened for semantic consistency and generation diversity, and several final prompt words are determined as the big model input corresponding to the task requirements, so that the prompt word set can be intelligently generated and optimized according to the user's task requirements, the efficiency and quality of prompt word construction can be improved, and more flexible support can be provided for the practical application of the big model.

[0106] Another embodiment of the present invention provides a large model prompt word engineering system, see Figure 3 , the system may include:

[0107] A receiving module 301 is configured to receive a task requirement input by a user for interacting with a large model, and generate a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task;

[0108] Decomposition module 302 is used to perform feature mapping on the initial prompt word set, construct a prompt word feature vector set, and decompose the feature vectors in the prompt word feature vector set into a number of sub-feature vectors to capture different characteristics of the prompt words, where each feature vector represents a multi-dimensional feature attribute of the corresponding initial prompt word;

[0109] An optimization module 303 is configured to perform multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads;

[0110] The screening module 304 is used to screen the optimized prompt word set for semantic consistency and generation diversity, and determine a number of final prompt words as inputs of a large model corresponding to task requirements.

[0111] It can be seen that the task requirements for interacting with the big model are received from the user, and a set of initial prompt word sets are generated based on the task requirements; feature mapping is performed on the initial prompt word set to construct a prompt word feature vector set, and the feature vectors in the prompt word feature vector set are decomposed into several sub-feature vectors to capture the different characteristics of the prompt words; multi-objective optimization is performed on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set; the optimized prompt word set is screened for semantic consistency and generation diversity, and several final prompt words are determined as the big model input corresponding to the task requirements, so that the prompt word set can be intelligently generated and optimized according to the user's task requirements, the efficiency and quality of prompt word construction can be improved, and more flexible support can be provided for the practical application of the big model.

[0112] An embodiment of the present invention further provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.

[0113] Specifically, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:

[0114] S201, receiving a task requirement input by a user for interacting with a large model, and generating a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task;

[0115] S202, performing feature mapping on the initial prompt word set to construct a prompt word feature vector set, decomposing the feature vectors in the prompt word feature vector set into a plurality of sub-feature vectors to capture different characteristics of the prompt words, wherein each feature vector represents a multi-dimensional feature attribute of the corresponding initial prompt word;

[0116] S203, performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads;

[0117] S204 , screening the optimized prompt word set for semantic consistency and generation diversity, and determining a number of final prompt words as inputs to a large model corresponding to task requirements.

[0118] It can be seen that the task requirements for interacting with the big model are received from the user, and a set of initial prompt word sets are generated based on the task requirements; feature mapping is performed on the initial prompt word set to construct a prompt word feature vector set, and the feature vectors in the prompt word feature vector set are decomposed into several sub-feature vectors to capture the different characteristics of the prompt words; multi-objective optimization is performed on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set; the optimized prompt word set is screened for semantic consistency and generation diversity, and several final prompt words are determined as the big model input corresponding to the task requirements, so that the prompt word set can be intelligently generated and optimized according to the user's task requirements, the efficiency and quality of prompt word construction can be improved, and more flexible support can be provided for the practical application of the big model.

[0119] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.

[0120] Specifically, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0121] Specifically, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0122] S201, receiving a task requirement input by a user for interacting with a large model, and generating a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task;

[0123] S202, performing feature mapping on the initial prompt word set to construct a prompt word feature vector set, decomposing the feature vectors in the prompt word feature vector set into a plurality of sub-feature vectors to capture different characteristics of the prompt words, wherein each feature vector represents a multi-dimensional feature attribute of the corresponding initial prompt word;

[0124] S203, performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads;

[0125] S204 , screening the optimized prompt word set for semantic consistency and generation diversity, and determining a number of final prompt words as inputs to a large model corresponding to task requirements.

[0126] It can be seen that the task requirements for interacting with the big model are received from the user, and a set of initial prompt word sets are generated based on the task requirements; feature mapping is performed on the initial prompt word set to construct a prompt word feature vector set, and the feature vectors in the prompt word feature vector set are decomposed into several sub-feature vectors to capture the different characteristics of the prompt words; multi-objective optimization is performed on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set; the optimized prompt word set is screened for semantic consistency and generation diversity, and several final prompt words are determined as the big model input corresponding to the task requirements, so that the prompt word set can be intelligently generated and optimized according to the user's task requirements, the efficiency and quality of prompt word construction can be improved, and more flexible support can be provided for the practical application of the big model.

[0127] The above describes in detail the structure, features and effects of the present invention based on the embodiments shown in the drawings. The above is only a preferred embodiment of the present invention, but the scope of implementation of the present invention is not limited to what is shown in the drawings. Any changes made in accordance with the concept of the present invention, or modifications to equivalent embodiments with equivalent changes, which do not exceed the spirit covered by the description and drawings, should be within the scope of protection of the present invention.

Claims

1. A large model prompt word engineering method, characterized in that: The method comprises: receiving a task requirement input by a user for interacting with the large model, and generating a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task; Perform feature mapping on the initial prompt word set, construct a prompt word feature vector set, and decompose the feature vectors in the prompt word feature vector set into several sub-feature vectors to capture the different characteristics of the prompt words, where each feature vector represents the multi-dimensional feature attribute of the corresponding initial prompt word; Performing context-aware encoding on each prompt word in the final initial prompt word set to generate an initial high-dimensional feature vector set as a prompt word feature vector set, wherein each high-dimensional feature vector captures the deep semantics and contextual information of each prompt word; constructing a feature matrix from the high-dimensional feature vector set, wherein each row of the feature matrix represents a vector of a prompt word; decomposing the feature matrix into two sub-matrices, wherein the sub-matrices include a feature basis matrix and a coefficient matrix, and each sub-matrix captures different aspects of the prompt word features; performing collaborative analysis on the two sub-matrices to extract the specific representation of each prompt word in different feature dimensions to obtain a sub-feature vector set; performing sparse processing on each sub-feature vector in the sub-feature vector set to obtain a sparse sub-feature vector; Performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads; The optimized prompt word set is screened for semantic consistency and generative diversity to determine a number of final prompt words as inputs to a large model corresponding to task requirements.

2. The method according to claim 1, characterized in that The receiving of a task requirement input by a user for interacting with the large model and generating a set of initial prompt words based on the task requirement include: Obtaining a feature description of the task requirements, and quantifying the feature description into a target feature vector; Select text fragments related to the task requirements from the external corpus to build the initial corpus; Extracting a corpus set related to the target feature vector based on the initial corpus; Encoding the semantic information of the corpus set into a latent space, and generating a latent semantic vector associated with the latent space; Decoding the latent semantic vector and generating a set of initial prompt words using the latent space to ensure that each initial prompt word has diverse semantic expressions; Calculate the cosine similarity between each initial prompt word and the target feature vector, and use TF-IDF to calculate the importance of each initial prompt word in the corpus set; A final set of initial prompt words is obtained by screening according to the cosine similarity and the importance.

3. The method according to claim 2, characterized in that The optimized prompt word set is screened for semantic consistency and generation diversity to determine a number of final prompt words, including: Performing semantic vectorization processing on each prompt word in the optimized prompt word set to generate a corresponding semantic vector; Calculating the semantic similarity between the semantic vector and the feature vector corresponding to the task requirement; Filtering prompt words corresponding to the semantic vectors whose semantic similarity is higher than a preset threshold, so that the filtered prompt words are semantically consistent with the task requirements, and obtaining a semantically consistent prompt word set; Clustering the semantic vectors of the prompt words in the semantically consistent prompt word set so that each cluster center can represent a different semantic field; The prompt words in each cluster whose distance from the center is less than the preset distance are selected as representative prompt words.

4. A large model prompt word engineering system, characterized in that: The system comprises: a receiving module, configured to receive a task requirement input by a user for interacting with the large model, and generate a set of initial prompt words based on the task requirement, wherein each initial prompt word is associated with a characteristic dimension of the task; The decomposition module is used to perform feature mapping on the initial prompt word set, construct a prompt word feature vector set, and decompose the feature vectors in the prompt word feature vector set into several sub-feature vectors to capture the different characteristics of the prompt words, where each feature vector represents the multi-dimensional feature attributes of the corresponding initial prompt word; Performing context-aware encoding on each prompt word in the final initial prompt word set to generate an initial high-dimensional feature vector set as a prompt word feature vector set, wherein each high-dimensional feature vector captures the deep semantics and contextual information of each prompt word; constructing a feature matrix from the high-dimensional feature vector set, wherein each row of the feature matrix represents a vector of a prompt word; decomposing the feature matrix into two sub-matrices, wherein the sub-matrices include a feature basis matrix and a coefficient matrix, and each sub-matrix captures different aspects of the prompt word features; performing collaborative analysis on the two sub-matrices to extract the specific representation of each prompt word in different feature dimensions to obtain a sub-feature vector set; performing sparse processing on each sub-feature vector in the sub-feature vector set to obtain a sparse sub-feature vector; an optimization module, configured to perform multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimized prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multiple threads; The screening module is used to screen the optimized prompt word set for semantic consistency and generation diversity, and determine a number of final prompt words as inputs of a large model corresponding to task requirements.

5. The system according to claim 4, characterized in that The receiving module is specifically configured to: Obtaining a feature description of the task requirements, and quantifying the feature description into a target feature vector; Select text fragments related to the task requirements from the external corpus to build the initial corpus; Extracting a corpus set related to the target feature vector based on the initial corpus; Encoding the semantic information of the corpus set into a latent space, and generating a latent semantic vector associated with the latent space; Decoding the latent semantic vector and generating a set of initial prompt words using the latent space to ensure that each initial prompt word has diverse semantic expressions; Calculate the cosine similarity between each initial prompt word and the target feature vector, and use TF-IDF to calculate the importance of each initial prompt word in the corpus set; A final set of initial prompt words is obtained by screening according to the cosine similarity and the importance.

6. The system according to claim 5, characterized in that The screening module is specifically used for: Performing semantic vectorization processing on each prompt word in the optimized prompt word set to generate a corresponding semantic vector; Calculating the semantic similarity between the semantic vector and the feature vector corresponding to the task requirement; Filtering prompt words corresponding to the semantic vectors whose semantic similarity is higher than a preset threshold, so that the filtered prompt words are semantically consistent with the task requirements, and obtaining a semantically consistent prompt word set; Clustering the semantic vectors of the prompt words in the semantically consistent prompt word set so that each cluster center can represent a different semantic field; The prompt words in each cluster whose distance from the center is less than the preset distance are selected as representative prompt words.

7. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 3 when run.

8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Text-to-SQL (Structured Query Language) method and system based on large model and multiple dimensions

    CN118585532A

Cited By

  • Adaptive instruction induction method, system and equipment based on large language model and storage medium

    CN121072788A

  • Adaptive instruction induction method, system, device and storage medium based on large language model

    CN121072788B