Efficient and intelligent large model cue word engineering method and system
The prompt words generated by feature mapping and parallel optimization algorithm solve the problems of insufficient construction efficiency and quality of prompt words in the existing technology, and realize the efficiency, diversity and semantic consistency of large model input, meet user needs, and serve the large model Provides more flexible support.
Patent Information
- Application Number
- CN202411343163.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-09-25
AI Technical Summary
In the prior art, the construction efficiency and quality of prompt words are difficult to meet the practical application needs of large models, especially in terms of diversity and semantic consistency.
By receiving the task requirements input by the user, an initial set of prompt words is generated, and feature mapping and decomposition is performed. Multi-objective optimization is used to optimize by using parallel optimization algorithms, and finally semantic consistency and generation diversity screening is performed to generate suitable large-model input prompt words.
It improves the efficiency and quality of prompt word construction, realizes intelligent generation and optimization of user task requirements, and provides more flexible support for large models.
Smart Images

Figure CN119227691A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular to an efficient and intelligent large-model prompt word engineering method and system. Background Art
[0002] With the rapid development of artificial intelligence technology, especially in the field of natural language processing, the widespread application of large models (such as GPT, BERT, etc.) has enabled people to achieve efficient interaction between humans and machines in a variety of scenarios. Prompt word engineering refers to the design and optimization of input prompts for large models to maximize their generation and context understanding capabilities. Effective prompt words can help large models understand user intent more accurately and generate high-quality output results. However, how to effectively utilize these powerful large models, especially in the construction of prompt words, remains a challenging research topic. Summary of the invention The purpose of the present invention is to provide an efficient and intelligent large-model prompt word engineering method and system to address the deficiencies in the prior art, to achieve intelligent generation and optimization of prompt word sets based on user task requirements, to improve the efficiency and quality of prompt word construction, and to provide more flexible support for the practical application of large models.
[0003] An embodiment of the present application provides an efficient and intelligent large model prompt word engineering method, the method comprising: 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; 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, wherein each feature vector represents a multi-dimensional feature attribute of the corresponding initial prompt word; Performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimization prompt word set, wherein the parallel optimization algorithm optimizes each preset goal in parallel through multi-threading; The optimized prompt word set is screened for semantic consistency and generation diversity, and a number of final prompt words are determined as inputs of a large model corresponding to task requirements.
[0004] 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, includes: Obtaining a feature description of the task requirement, and quantifying the feature description into a target feature vector; Select text segments related to the task requirements from external corpora to build an initial corpus; Based on the initial corpus, extracting a corpus set related to the target feature vector; 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 using the latent space to generate a set of initial prompt words, ensuring that each initial prompt word has a diverse semantic representation; 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; According to the cosine similarity and the importance, a final initial prompt word set is screened and obtained.
[0005] 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 a plurality of sub-feature vectors, including: 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 context information of each prompt word; 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; 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; The two sub-matrices are analyzed collaboratively to extract the specific representation of each prompt word in different feature dimensions and obtain a set of sub-feature vectors; Each sub-feature vector in the sub-feature vector set is subjected to sparse processing to obtain a sparse sub-feature vector.
[0006] Optionally, the step of screening the optimized prompt word set for semantic consistency and generation diversity to determine a number of final prompt words includes: 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 the 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; Select the prompt words in each cluster whose distance from the center is less than the preset distance as representative prompt words.
[0007] Another embodiment of the present application provides an efficient and intelligent large model prompt word engineering system, the system comprising: 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 feature dimension of the task; 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 a number 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; An optimization module, used to perform multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimization prompt word set, wherein the parallel optimization algorithm optimizes each preset goal in parallel through multi-threading; 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 a large model input corresponding to the task requirements.
[0008] 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 running.
[0009] Yet another embodiment of the present application provides an electronic device, including 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 methods described above.
[0010] Compared with the prior art, the present invention provides an efficient and intelligent large model prompt word engineering method, which receives task requirements input by users for interacting with the 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 a number of sub-feature vectors to capture 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; performs semantic consistency and generation diversity screening on the optimized prompt word set, determines a number of final prompt words, and uses them as large model inputs corresponding to the task requirements, thereby realizing intelligent generation and optimization of the prompt word set according to the user's task requirements, improving the efficiency and quality of prompt word construction, and providing more flexible support for the practical application of the large model. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 A hardware structure block diagram of a computer terminal for an efficient and intelligent large model prompt word engineering method provided by an embodiment of the present invention; Figure 2 A schematic diagram of a process flow of an efficient and intelligent large model prompt word engineering method provided by an embodiment of the present invention; Figure 3 A schematic diagram of the structure of an efficient and intelligent large model prompt word engineering system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0012] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, but should not be construed as limiting the present invention.
[0013] The embodiment of the present invention firstly provides an efficient and intelligent large model prompt word engineering method, which can be applied to electronic devices such as computer terminals, specifically ordinary computers, etc.
[0014] 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 an efficient and intelligent 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 in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as 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 can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0015] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / modules corresponding to the efficient and intelligent 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, to implement the above 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 examples, the memory 104 may further include a memory remotely arranged 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.
[0016] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0017] See also Figure 2 , an embodiment of the present invention provides an efficient and intelligent large model prompt word engineering method, which may include the following steps: 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 feature dimension of the task; The user input needs to be captured first, that is, the specific task requirements that the user wants to interact with the large model. The nature of the task may be diverse, such as text generation, question answering, data analysis, etc. The user input needs to be preprocessed here to ensure that the subsequent process can accurately understand and interpret the user's intention. This step ensures that the generated prompt words are directly related to the user's expectations and needs, enhancing personalization and targeting.
[0018] Receive clear task requirement information from the user and generate a set of initial prompt words based on this information. These prompt words will be associated with the characteristic dimensions of the specific task to ensure that the generated prompt words can accurately reflect the core of the task that the user needs to perform.
[0019] Specifically, a feature description of the task requirement may be obtained, and the feature description may be quantified into a target feature vector; In this phase, the system first extracts key features from the user's input, which may include factors such as the topic, importance, and expected style of the task. These features are then converted into target feature vectors in numerical form for subsequent processing. Quantified features enable the system to perform effective calculations and matching in mathematical space, so that machine learning algorithms can be used for subsequent processing.
[0020] 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.
[0021] Select text segments related to the task requirements from external corpora to build an initial corpus; This step involves screening large amounts of text data, selecting text segments that are relevant to user needs, and forming a preliminary corpus. Building an initial corpus can provide a diverse semantic background for subsequent prompt word generation, ensuring that the generated prompt words have rich contextual information.
[0022] 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.
[0023] Based on the initial corpus, extracting a corpus set related to the target feature vector; In this phase, the system needs to analyze the initial corpus and extract text segments that match the target feature vector to form a more accurate corpus set. This step ensures that the generated prompt words can accurately reflect the user's needs and enhance the pertinence and effectiveness of the corpus.
[0024] 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 highly relevant corpus set.
[0025] Encoding the semantic information of the corpus set into a latent space, and generating a latent semantic vector associated with the latent space; The system uses deep learning technology to map the extracted corpus into a latent space and generate a latent semantic vector. The latent space helps capture the deep semantic relationship between texts and provides a richer information basis for the subsequent generation of prompt words.
[0026] The extracted corpus can be mapped to the latent space using a variational autoencoder (VAE) to generate rich latent semantic vectors.
[0027] Decoding the latent semantic vector, and using the latent space to generate a set of initial prompt words, ensuring that each initial prompt word has a diverse semantic representation; By using variational autoencoders and decoding latent semantic vectors, the system generates a diverse set of initial prompt words, each of which reflects different semantic features. Diverse prompt words can attract users' attention and enhance the richness and attractiveness of subsequent generated content.
[0028] 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; The system evaluates the relevance by calculating the cosine similarity between the initial prompt word and the target feature vector. At the same time, the TF-IDF (term frequency-inverse document frequency) algorithm is used to measure the importance of each prompt word in the corpus. This measure ensures that a single prompt word is not only relevant to the user's task, but also highly representative, improving the subsequent processing effect.
[0029] According to the cosine similarity and the importance, a final initial prompt word set is screened and obtained.
[0030] The system finally selects a set of suitable initial prompt words, which perform well in the evaluation of cosine similarity and TF-IDF. Through fine screening, the final set of initial prompt words can better meet user needs and provide strong support for the execution of subsequent tasks. The initial prompt words with cosine similarity higher than the preset pre-similarity and importance greater than the preset importance threshold can be selected as the final set of initial prompt words.
[0031] S202, 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 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; The initial prompt word set provided by the user is converted into a feature vector set to facilitate in-depth analysis and mining of the various dimensional characteristics of the prompt words. First, feature mapping is performed on each prompt word to generate high-dimensional feature vectors, which can not only capture the basic semantic information of the prompt word, but also contain more complex contextual relationships, emotional tendencies, and grammatical structures. Then, 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.
[0032] Specifically, each prompt word in the final initial prompt word set may be context-aware encoded 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 context information of each prompt word; We can use context-aware models based on deep learning (such as BERT, GPT, etc.) to encode each prompt word and generate a high-dimensional feature vector. This process not only considers the meaning of the prompt word itself, but also incorporates its meaning in a specific context, thereby providing richer semantic information.
[0033] Deep semantic understanding: makes the semantics of each prompt word more precise and can effectively capture its relationship with the context; Enhanced generation capabilities: provides a deeper and broader information foundation for subsequent content generation.
[0034] 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; This step organizes the high-dimensional feature vector set into a feature matrix, where each row of the matrix corresponds to a high-dimensional vector of a prompt word. This structure facilitates subsequent mathematical calculations and analysis. The encoded high-dimensional vectors of each prompt word are arranged into a feature matrix, and numpy or similar tools are used for efficient storage.
[0035] 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; This step decomposes the feature matrix into two sub-matrices: the feature base matrix and the coefficient matrix. The feature base matrix represents the basic pattern of the features, while the coefficient matrix reflects the specific expression of these features in different prompt words.
[0036] Feature extraction: Enhance the analysis of prompt word features and identify the main factors affecting the performance of prompt words; Reduce dimension: Reduce computational complexity through matrix decomposition, thereby improving efficiency.
[0037] 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.
[0038] The two sub-matrices are analyzed collaboratively to extract the specific representation of each prompt word in different feature dimensions and obtain a set of sub-feature vectors; By collaboratively analyzing the decomposed feature base matrix and coefficient matrix, the system can extract the specific representation of each prompt word in different feature dimensions. Independent component analysis (ICA) technology can be used to collaboratively analyze the two sub-matrices to extract the features that are most clearly associated with the prompt word, ensuring that not only the main features are extracted, but also the independent features related to the task requirements are identified.
[0039] Each sub-feature vector in the sub-feature vector set is subjected to sparse processing to obtain a sparse sub-feature vector.
[0040] Each sub-feature vector is sparsified to reduce 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 performed on the extracted sub-feature vectors to compress the coefficients of unimportant features to near zero, ensuring that the final sparse vector retains only the features that have the greatest impact on the task.
[0041] 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; Taking advantage of the parallel optimization algorithm, the sub-feature vectors are optimized for multiple objectives, and a more accurate and effective set of optimized prompt words is generated by optimizing multiple preset objectives at the same time. This process involves mapping the sub-feature vectors to different objective functions, such as improving the relevance, attractiveness, and diversity of the prompt words, thereby ensuring that the generated prompt words have good performance in multiple dimensions.
[0042] Specifically, first, multiple objective functions can be defined, such as: 1) improving the relevance of prompt words (combining the context with the needs of the target audience); 2) enhancing the attractiveness of prompt words (combining sentiment analysis results with user preferences); 3) increasing the diversity of prompt words (measured using distribution and information entropy models).
[0043] The above objective function is transformed into a computable scoring mechanism using a fuzzy logic system to adapt to the fuzziness of each objective and the characteristic uncertainty associated with it. The degree of achievement of each objective will be represented by a fuzzy set, thus achieving a more flexible and accurate evaluation. Divide the sub-feature vector set into several groups, and each group constitutes a subtask for parallel processing. For example, it can be divided according to different prompt word categories (such as verbs, nouns, adjectives), ensuring that each subtask focuses on a specific type of optimization.
[0044] Multithreading technology is used to assign an independent thread to each subtask. Each thread is optimized for a certain objective function. Here, existing evolutionary algorithms (such as genetic algorithms) or particle swarm optimization (PSO) methods can be used to perform multiple iterations in each thread to quickly find the optimal solution for the relevant features, which is not described in detail in this application. Within each thread, an adaptive convergence judgment mechanism is used to evaluate the current optimization effect based on the results of each round of iteration. When the objective function reaches stability within the set tolerance, the thread automatically terminates, thus avoiding unnecessary waste of computing resources. Once all threads have completed their optimization tasks, the results of each thread are integrated. The optimization results of each objective function are weighted averaged to ensure that the contribution of each objective is reflected. Finally, a set of optimization hints is generated, which contains the best balance of all preset objectives. The generated optimized prompt word set is subjected to redundancy detection to remove prompt words with too high similarity to ensure diversity. This step can use the hierarchical clustering algorithm, combined with the previously defined diversity goal, for further screening and adjustment. Through the above steps, effective parallel optimization can be achieved, and an accurate and diverse set of optimization prompt words can be generated, thus improving the overall quality and effect of the generated tasks. This multi-objective optimization approach has great potential and flexibility when dealing with complex tasks, especially when there are high requirements for the diversity of user needs.
[0045] S204, screening the optimized prompt word set for semantic consistency and generation diversity, and determining a number of final prompt words as a large model input corresponding to task requirements.
[0046] By screening the optimized prompt word set for semantic consistency and generative diversity, we ensure that the final selected prompt word can better correspond to the task requirements input by the user. This process involves multiple core links, including semantic vectorization of the prompt word, calculating its similarity with the feature vector of the task requirement, and ensuring its diversity and representativeness through clustering.
[0047] Specifically, semantic vectorization processing may be performed on each prompt word in the optimized prompt word set to generate a corresponding semantic vector; This step converts the optimized prompt words into semantic vectors so that they can be represented in numerical space, which is convenient for subsequent similarity calculations. This enables direct comparison between the prompt words and the task requirement feature vectors, providing basic data for semantic consistency screening.
[0048] Calculating the semantic similarity between the semantic vector and the feature vector corresponding to the task requirement; Using cosine similarity or other similarity measurement methods, calculate the similarity between the semantic vector of each prompt word and the feature vector required by the given task. Through the quantitative similarity index, the relevance of the prompt word and the target task can be effectively judged, providing a basis for the subsequent screening process.
[0049] 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.
[0050] Filtering the 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; According to the calculated similarity value, select the prompt words that exceed the set threshold to ensure that these words are highly consistent with the user's task requirements in terms of semantics. Ensure that the final selected prompt words are semantically consistent with user needs, thereby improving the accuracy and practicality of the generated content.
[0051] 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; Use clustering algorithms (such as K-means or hierarchical clustering) to group the selected prompt words so that the prompt words in each group are semantically similar, but there are obvious differences between groups. Integrate similar prompt words to form a set of semantic fields, which is convenient for selecting diverse and representative prompt words. The spectral clustering algorithm can more effectively process nonlinearly separable data, while optimizing the stability of clustering, making the clustering results more reasonable.
[0052] Select the prompt words in each cluster whose distance from the center is less than the preset distance as representative prompt words.
[0053] By calculating the distance between each prompt word and the cluster center, we ensure that the selected prompt word can semantically represent the characteristics of each cluster. We extract the most representative prompt word from each cluster to ensure the diversity and effectiveness of the final prompt word set. In the selection of representative prompt words, we can also combine the principle of maximum information entropy to ensure that the selected prompt words are sufficient and informative, and avoid duplication and redundancy of information.
[0054] It can be seen that the task requirements for interacting with the big model input by the user are received, 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 a number of 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 a number of 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 actual application of the big model.
[0055] Another embodiment of the present invention provides an efficient and intelligent large model prompt word engineering system, see Figure 3 , the system may include: A receiving module 301 is used 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 feature dimension of the task; A 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 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; An optimization module 303 is used to perform multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimization prompt word set, wherein the parallel optimization algorithm optimizes each preset objective in parallel through multi-threading; 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 a large model input corresponding to the task requirements.
[0056] It can be seen that the task requirements for interacting with the big model input by the user are received, 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 a number of 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 a number of 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 actual application of the big model.
[0057] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0058] Specifically, in this embodiment, the above storage medium may be configured to store a computer program for performing the following steps: 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 feature dimension of the task; S202, 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 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; 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; S204, screening the optimized prompt word set for semantic consistency and generation diversity, and determining a number of final prompt words as a large model input corresponding to task requirements.
[0059] It can be seen that the task requirements for interacting with the big model input by the user are received, 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 a number of 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 a number of 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 actual application of the big model.
[0060] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0061] 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.
[0062] Specifically, in this embodiment, the processor may be configured to perform the following steps through a computer program: 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 feature dimension of the task; S202, 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 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; 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; S204, screening the optimized prompt word set for semantic consistency and generation diversity, and determining a number of final prompt words as a large model input corresponding to task requirements.
[0063] It can be seen that the task requirements for interacting with the big model input by the user are received, 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 a number of 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 a number of 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 actual application of the big model.
[0064] 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 present invention is not limited to the scope of implementation shown in the drawings. Any changes made according to the concept of the present invention, or modifications to equivalent embodiments with equivalent changes, which still do not exceed the spirit covered by the description and drawings, should be within the protection scope of the present invention.
Claims
1. An efficient and intelligent large model prompt word engineering method, characterized in that: The method comprises: 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; 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, wherein each feature vector represents a multi-dimensional feature attribute of the corresponding initial prompt word; Performing multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimization prompt word set, wherein the parallel optimization algorithm optimizes each preset goal in parallel through multi-threading; The optimized prompt word set is screened for semantic consistency and generation diversity, and a number of final prompt words are determined as inputs of 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, comprises: Obtaining a feature description of the task requirement, and quantifying the feature description into a target feature vector; Select text segments related to the task requirements from external corpora to build an initial corpus; Based on the initial corpus, extracting a corpus set related to the target feature vector; 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 using the latent space to generate a set of initial prompt words, ensuring that each initial prompt word has a diverse semantic representation; 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; According to the cosine similarity and the importance, a final initial prompt word set is screened and obtained.
3. The method according to claim 2, characterized in that 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 a plurality of sub-feature vectors, including: 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 context information of each prompt word; 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; 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; The two sub-matrices are analyzed collaboratively to extract the specific representation of each prompt word in different feature dimensions and obtain a set of sub-feature vectors; Each sub-feature vector in the sub-feature vector set is subjected to sparse processing to obtain a sparse sub-feature vector.
4. The method according to claim 3, characterized in that The optimization 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 the 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; Select the prompt words in each cluster whose distance from the center is less than the preset distance as representative prompt words.
5. An efficient and intelligent 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 feature dimension of the task; 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 a number 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; An optimization module, used to perform multi-objective optimization on the sub-feature vectors using a parallel optimization algorithm to generate an optimization prompt word set, wherein the parallel optimization algorithm optimizes each preset goal in parallel through multi-threading; 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 a large model input corresponding to the task requirements.
6. The system according to claim 5, characterized in that The receiving module is specifically used for: Obtaining a feature description of the task requirement, and quantifying the feature description into a target feature vector; Select text segments related to the task requirements from external corpora to build an initial corpus; Based on the initial corpus, extracting a corpus set related to the target feature vector; 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 using the latent space to generate a set of initial prompt words, ensuring that each initial prompt word has a diverse semantic representation; 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; According to the cosine similarity and the importance, a final initial prompt word set is screened and obtained.
7. The system according to claim 6, characterized in that The decomposition module is specifically used for: 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 context information of each prompt word; 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; 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; The two sub-matrices are analyzed collaboratively to extract the specific representation of each prompt word in different feature dimensions and obtain a set of sub-feature vectors; Each sub-feature vector in the sub-feature vector set is subjected to sparse processing to obtain a sparse sub-feature vector.
8. The system according to claim 7, 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 the 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; Select the prompt words in each cluster whose distance from the center is less than the preset distance as representative prompt words.
9. 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 4 when executed.
10. 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 4.
Citation Information
Patent Citations
Robot language instruction analysis method and system based on Chinese named entity recognition
CN112883737A
Recognition method and device for prompt words and sentences and electronic equipment
CN116756312A
Text-to-SQL (Structured Query Language) method and system based on large model and multiple dimensions
CN118585532A
Time factor feature generation system, time factor feature generation method and time factor feature generation program
US20080103853A1
Systems and methods for generating a dynamic list of hint words for automated speech recognition
US20230030830A1
Cited By
Traditional Chinese medicine clinical research scheme generation method and system
CN119580904A
Model task classification method and device, model selection method and electronic equipment
CN121093185A
Cue word generation method and system based on user habits and documents
CN121478946A
A method and system for generating prompts based on user habits and documents
CN121478946B
