Prompt word template generation method and device, equipment, medium and product

By generating a prompt template containing the target variable identification, the problem of the prompt template and the business engineering code matching efficiency in the existing technology are solved, and the efficient application of language models in business applications is realized.

CN119378522APending Publication Date: 2025-01-28BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411546604.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-28

Smart Images

  • Figure CN119378522A_ABST
    Figure CN119378522A_ABST
Patent Text Reader

Abstract

The invention provides a cue word template generation method and apparatus, a device, a medium and a product. The method comprises the steps of obtaining input information related to a target task and attribute information related to a target language model; generating a first prompt word; wherein the first cue word comprises input information related to the target task, attribute information related to the target language model and information used for indicating to generate a cue word template comprising a variable identifier; sending the first cue word to a first language model, and receiving a target cue word template returned by the first language model; wherein the target cue word template comprises at least one target variable identifier related to the target task. In the method, the generated cue word template comprises the target variable identifier related to the target task, and the target variable identifier can be directly applied to the business engineering code, so that the efficiency of converting the cue word template into the business engineering code is improved, and the language model can be quickly applied to the business.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for generating a prompt word template. Background Art

[0002] With the continuous development of computer technology and natural language processing (NLP) technology, the scale of language models has gradually expanded. In order to obtain better model reasoning effects, prompt learning came into being.

[0003] Prompt learning refers to transforming downstream tasks through prompt words without changing the parameters of the pre-trained language model, so that the pre-trained language model can better understand the downstream tasks and thus obtain better model reasoning results. The prompt words can be generated by input text and prompt word templates.

[0004] The language model can be widely used in various businesses. Specifically, by configuring the prompt word template in the business engineering code, executing the business engineering code in the actual business application, calling the language model based on the prompt word template and input text in the business engineering code, and using the language model to complete business-related tasks.

[0005] However, configuring prompt word templates and developing business engineering codes are usually two processes. In the above method, in order to make the generated prompt word templates meet both business requirements and engineering code specifications and be able to be executed in business applications, it takes a lot of time to match the prompt word templates with the business engineering codes, and the efficiency of applying language models to business is low. Summary of the invention

[0006] The present application provides a method for generating a prompt word template. The method can improve the efficiency of converting the prompt word template into a business engineering code, and can quickly apply the language model to the business. The present application also provides a device, an electronic device, a computer-readable storage medium, and a computer program product corresponding to the above method.

[0007] In a first aspect, the present application provides a method for generating a prompt word template, the method comprising:

[0008] Acquire input information related to a target task and attribute information related to a target language model; wherein the target language model is used to process the target task;

[0009] Generate a first prompt word; wherein the first prompt word includes the input information related to the target task, the attribute information related to the target language model, and information for instructing to generate a prompt word template including a variable identifier;

[0010] The first prompt word is sent to a first language model, and a target prompt word template returned by the first language model is received; wherein the target prompt word template includes at least one target variable identifier related to the target task, and the target prompt word template is used to assist the target language model in processing the target task.

[0011] In some possible implementations, the method further includes:

[0012] An interface calling code is generated according to the target prompt word template; wherein the interface calling code is used to call the target language model, and the calling variable indicated by the interface calling code includes the at least one target variable identifier.

[0013] In some possible implementations, the method further includes:

[0014] The interface calling code is executed with the at least one target variable identifier as a calling variable, so that the target language model processes the target task based on a target prompt word, wherein the target prompt word is composed of the target prompt word template and data indicated by the at least one target variable identifier.

[0015] In some possible implementations, sending the first prompt word to a first language model and receiving a target prompt word template returned by the first language model includes:

[0016] sending, to the first language model, a first prompt word indicating to extract key information from the input information related to the target task and the attribute information related to the target language model; wherein the key information includes at least one of the following: task elements of the target task, task objectives of the target task, constraints of the target task, model parameters of the target language model, or application scope of the target language model;

[0017] A target prompt word template generated by the first language model based on the extracted key information is received.

[0018] In some possible implementations, sending the first prompt word to a first language model and receiving a target prompt word template returned by the first language model includes:

[0019] sending the first prompt word of the plurality of prompt word template examples including the target language model to the first language model;

[0020] Receive a target prompt word template returned by the first language model and matching the format of the plurality of prompt word template samples.

[0021] In some possible implementations, the obtaining of input information related to the target task and attribute information related to the target language model includes:

[0022] Present the task configuration page;

[0023] Receiving a task configuration operation triggered in the task configuration page, the task configuration operation including an input operation for a target task and a selection operation for a target language model;

[0024] According to the task configuration operation, input information related to the target task and attribute information related to the target language model are determined.

[0025] In some possible implementations, the method further includes:

[0026] receiving a modification operation on the target prompt word template;

[0027] According to the modification operation, the target prompt word template is updated.

[0028] In some possible implementations, the input information related to the target task includes the name of the target task and / or description information of the target task.

[0029] In a second aspect, the present application provides a device for generating a prompt word template, the device comprising:

[0030] An acquisition module, used to acquire input information related to a target task and attribute information related to a target language model; wherein the target language model is used to process the target task;

[0031] A first generating module, configured to generate a first prompt word; wherein the first prompt word includes the input information related to the target task, the attribute information related to the target language model, and information for instructing to generate a prompt word template including a variable identifier;

[0032] The second generating module is used to send the first prompt word to the first language model, and receive the target prompt word template returned by the first language model; wherein the target prompt word template includes at least one target variable identifier related to the target task, and the target prompt word template is used to assist the target language model in processing the target task.

[0033] In some possible implementations, the apparatus further includes a third generating module, and the third generating module is configured to:

[0034] An interface calling code is generated according to the target prompt word template; wherein the interface calling code is used to call the target language model, and the calling variable indicated by the interface calling code includes the at least one target variable identifier.

[0035] In some possible implementations, the apparatus further includes an execution module, wherein the execution module is configured to:

[0036] The interface calling code is executed with the at least one target variable identifier as a calling variable, so that the target language model processes the target task based on a target prompt word, wherein the target prompt word is composed of the target prompt word template and data indicated by the at least one target variable identifier.

[0037] In some possible implementations, the second generating module is specifically configured to:

[0038] sending, to the first language model, a first prompt word indicating to extract key information from the input information related to the target task and the attribute information related to the target language model; wherein the key information includes at least one of the following: task elements of the target task, task objectives of the target task, constraints of the target task, model parameters of the target language model, or application scope of the target language model;

[0039] A target prompt word template generated by the first language model based on the extracted key information is received.

[0040] In some possible implementations, the second generating module is specifically configured to:

[0041] sending the first prompt word of the plurality of prompt word template examples including the target language model to the first language model;

[0042] Receive a target prompt word template returned by the first language model and matching the format of the plurality of prompt word template samples.

[0043] In some possible implementations, the acquisition module is specifically used to:

[0044] Present the task configuration page;

[0045] Receiving a task configuration operation triggered in the task configuration page, the task configuration operation including an input operation for a target task and a selection operation for a target language model;

[0046] According to the task configuration operation, input information related to the target task and attribute information related to the target language model are determined.

[0047] In some possible implementations, the apparatus further includes an updating module, wherein the updating module is configured to:

[0048] receiving a modification operation on the target prompt word template;

[0049] According to the modification operation, the target prompt word template is updated.

[0050] In some possible implementations, the input information related to the target task includes the name of the target task and / or description information of the target task.

[0051] In a third aspect, the present application provides an electronic device, the electronic device comprising a processor and a memory. The processor and the memory communicate with each other. The processor is used to execute instructions stored in the memory, so that the electronic device executes the method for generating a prompt word template as in the first aspect or any implementation of the first aspect.

[0052] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, wherein the instructions instruct an electronic device to execute the method for generating a prompt word template described in the first aspect or any one of the implementations of the first aspect.

[0053] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method for generating a prompt word template as described in the first aspect or any one of the implementations of the first aspect.

[0054] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations.

[0055] It can be seen from the above technical solutions that this application has the following advantages:

[0056] The present application provides a method for generating a prompt word template. The method first obtains input information related to a target task and attribute information related to a target language model, wherein the target language model is used to process the target task. Next, a first prompt word is generated, wherein the first prompt word includes the input information related to the target task, the attribute information related to the target language model, and information used to indicate the generation of a prompt word template including a variable identifier. The first prompt word is sent to the first language model, and a target prompt word template returned by the first language model is received, wherein the target prompt word template includes at least one target variable identifier related to the target task, and the target prompt word template is used to assist the target language model in processing the target task.

[0057] In the method, for the generation process of the prompt word template, the prompt word template is generated by combining the input information related to the target task and the attribute information of the target language model used to process the target task, so that the generated prompt word template meets the actual needs of the target task. In addition, since the first prompt word used to generate the prompt word template includes information for indicating the generation of the prompt word template including the variable identifier, the generated prompt word template includes the target variable identifier related to the target task, and the target variable identifier can be directly applied to the business engineering code, thereby improving the efficiency of converting the prompt word template into the business engineering code, and being able to quickly apply the language model to the business. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.

[0059] Figure 1 A schematic diagram of a flow chart of a method for generating a prompt word template provided in an embodiment of the present application;

[0060] Figure 2A and Figure 2B A schematic diagram of a page related to generating a prompt word template provided in an embodiment of the present application;

[0061] Figure 3 A schematic diagram of the structure of a device for generating a prompt word template provided in an embodiment of the present application;

[0062] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] The terms "first" and "second" in the embodiments of the present application are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.

[0064] First, some technical terms and application scenarios involved in the embodiments of this application are introduced.

[0065] Natural language processing (NLP) is a machine learning technology that enables computing devices to interpret, process, and understand human language. Computing devices can complete a variety of tasks based on natural language processing, including but not limited to part-of-speech tagging, word sense disambiguation, speech recognition, machine translation, sentiment analysis, etc.

[0066] With the continuous development of natural language processing technology, the industry has seen the emergence of a natural language processing paradigm of "pre-training + prompt + prediction". The "pre-training + prompt + prediction" paradigm uses a pre-trained language model based on prompt learning to perform natural language processing. There is no need to apply the pre-trained language model to downstream tasks for parameter fine-tuning, that is, the parameters of the pre-trained language model are not changed, and the downstream tasks are transformed through prompt words, so that the pre-trained language model can better understand the downstream tasks.

[0067] Specifically, the prompt word is usually generated by the input text and the prompt word template, and the input text is filled into the prompt word template to form a complete prompt word. Taking the downstream task of "text classification" as an example, the pre-trained language model needs to analyze the input text and output the classification result of the input text. For example, the input text is "the plot is smooth, the actors' acting skills are good, and the special effects are also very good", and the prompt word template is "the user thinks that this movie {{xxx}}, so what is the user's evaluation of this movie." The pre-trained language model is prompted by the prompt word to perform text classification, so that the pre-trained language model can output the classification result of the input text (such as a positive evaluation category or a negative evaluation category). In this way, the pre-trained language model can better understand the downstream tasks and generate accurate model outputs.

[0068] As prompt learning technology matures, language models can be widely used in various businesses. Usually, for specific business needs, prompt word templates are configured in business engineering codes, and in actual business applications, business engineering codes are executed, and language models are called based on prompt word templates and input text in the business engineering codes, and business-related tasks are completed using language models.

[0069] For example, when language models are applied to security protection products, there is a business requirement of "determining whether the alarm information has risks". In this case, a prompt word template is configured in the business engineering code, for example, "the alarm information is {{xxx}}, so whether this alarm has risks". In the actual operation of the security protection product, when the alarm information is generated, the business engineering code is executed, and the prompt words are generated from the generated alarm information and the prompt word template, and the language model is called. The language model returns an output result indicating whether the alarm has risks or not.

[0070] However, since configuring prompt word templates requires deep professional knowledge and rich experience, understanding the working principles and characteristics of language models, and an in-depth understanding of the tasks to be solved, in actual business development, configuring prompt word templates is usually the responsibility of professionals, that is, configuring prompt word templates and developing business engineering codes are usually two processes, and different people are responsible for configuring prompt word templates and developing business engineering codes.

[0071] In order to make the generated prompt word template meet both business requirements and engineering code specifications and be able to be executed in business applications, it takes a lot of time to match the prompt word template with the business engineering code. The personnel responsible for configuring the prompt word template and the personnel responsible for developing the business engineering code need to interact multiple times, and the efficiency of applying the language model to the business is low.

[0072] In view of this, the present application provides a method for generating a prompt word template, which method first obtains input information related to a target task and attribute information related to a target language model, wherein the target language model is used to process the target task, then generates a first prompt word, the first prompt word includes input information related to the target task, attribute information related to the target language model, and information used to indicate the generation of a prompt word template including a variable identifier, sends the first prompt word to the first language model, and receives a target prompt word template returned by the first language model, wherein the target prompt word template includes at least one target variable identifier related to the target task, and the target prompt word template is used to assist the target language model in processing the target task.

[0073] In the method, for the generation process of the prompt word template, the prompt word template is generated by combining the input information related to the target task and the attribute information of the target language model used to process the target task, so that the generated prompt word template meets the actual needs of the target task. In addition, since the first prompt word used to generate the prompt word template includes information for indicating the generation of the prompt word template including the variable identifier, the generated prompt word template includes the target variable identifier related to the target task, and the target variable identifier can be directly applied to the business engineering code, thereby improving the efficiency of converting the prompt word template into the business engineering code, and being able to quickly apply the language model to the business.

[0074] To facilitate understanding of the technical solution provided by the embodiments of the present application, it will be described below with reference to the accompanying drawings.

[0075] See also Figure 1 The flowchart of a method for generating a prompt word template provided in an embodiment of the present application is shown, and the method specifically includes:

[0076] S101: Acquire input information related to a target task and attribute information related to a target language model.

[0077] In the embodiment of the present application, the target task can be understood as a natural language task for which a prompt word template is to be configured. The target task can be related to the business. For example, in the alarm handling business, the target task can be a natural language task for analyzing alarm information, a natural language task for generating alarm handling strategies, etc. For another example, in the document management business, the target task can be a natural language task for summarizing document content, a natural language task for retrieving documents that meet the conditions, etc.

[0078] The input information related to the target task can be understood as information used to describe the target task. In the embodiment of the present application, the input information related to the target task can represent natural language content, that is, the input information related to the target task can be information described in natural language.

[0079] The input information related to the target task may be information describing the target task from at least one aspect. In other words, the target task may be understood from different aspects through the input information related to the target task. In some embodiments, the input information related to the target task may include the name of the target task and / or the description information of the target task.

[0080] In the embodiments of the present application, the target language model can be used to process the target task. That is, the target language model can be understood as a language model that performs the target task. Among them, the language model can be understood as a model that has the ability to understand and generate natural language and can process different natural language tasks. For example, the language model can be a deep learning model trained using text data.

[0081] The embodiments of the present application do not limit the target language model. For example, the target language model can be a language model of any version and for any scenario.

[0082] The attribute information related to the target language model can be understood as model parameter information related to the target language model's natural language processing tasks. For example, the attribute information related to the target language model may include one or more of the model architecture parameters (such as the number of neurons, the type of layer, the type of activation function), optimizer parameters (such as learning rate, momentum), loss function parameters (such as the weight of the mean square error, the temperature parameter of the cross entropy loss), regularization parameters, and hyperparameters (such as batch size, iteration order, learning rate).

[0083] In some possible implementations, input information related to the target task and attribute information related to the target language model can be obtained through a visualization page. Specifically, a task configuration page is presented, and a task configuration operation triggered in the task configuration page is received, wherein the task configuration operation includes an input operation for the target task and a selection operation for the target language model, and then, according to the task configuration operation, the input information related to the target task and the attribute information related to the target language model are determined.

[0084] Among them, the task configuration page can be understood as a page for configuring information related to the target task. In some embodiments, the task configuration page can be provided by the prompt engineering platform, and the user can configure the prompt word templates of different tasks in the prompt engineering platform. In other words, when the user has a need to configure a prompt word template for a certain task, the user can enter the prompt engineering platform and configure the information related to the target task in the task configuration page provided by the prompt engineering platform.

[0085] The task configuration operation can be understood as an operation for configuring information related to the target task. In the embodiment of the present application, the task configuration operation includes an input operation for the target task and a selection operation for the target language model.

[0086] Among them, the input operation for the target task can be understood as an operation for determining the input information related to the target task. For example, the input operation for the target task can be a one-time operation of inputting complete input information related to the target task, that is, the input information related to the target task is determined by a single input operation for the target task. For another example, the task configuration page can provide input areas for input information related to the target task in different aspects. In this case, the input operation for the target task can also be multiple operations of inputting input information related to the target task in different aspects, that is, the input information related to the target task is determined by multiple input operations for the target task.

[0087] The selection operation for the target language model can be understood as an operation for determining the attribute information related to the target language model. Considering that the attribute information of the language model is usually difficult to modify manually, and the prompt engineering platform is usually connected to multiple language models, the user does not need to manually input the attribute information related to the target language model, and only needs to trigger the selection operation for the target language model. After the target language model is determined, the attribute information related to the target language model can be automatically determined.

[0088] By obtaining input information related to the target task and attribute information related to the target language model, we can understand the goals and requirements of the target task and the characteristics of the target language model used to process the target task, and then combine

[0089] S102: Generate a first prompt word.

[0090] Among them, the first prompt word can be understood as a prompt word for generating a prompt word template for the target task. That is to say, in the embodiment of the present application, the prompt word template for the target task can be generated based on the prompt learning method. By configuring the first prompt word, the language model is helped to understand the background and requirements of the task, and the language model can handle different types of natural language processing tasks without the need to retrain the language model, thereby increasing the scalability and flexibility of the language model.

[0091] In the embodiment of the present application, the first prompt word includes input information related to the target task, attribute information related to the target language model, and information for instructing to generate a prompt word template including a variable identifier.

[0092] That is, the prompt word template of the first prompt word may include information for indicating the generation of a prompt word template including a variable identifier, and the first prompt word is generated by combining input information related to the target task, attribute information related to the target language model and the prompt word template of the first prompt word.

[0093] Since the first prompt word includes input information related to the target task and attribute information related to the target language model, when subsequently generating a prompt word template for the target task, it is possible to combine the actual requirements of the target task and the model characteristics of the target language model used to process the target task to generate a prompt word template that matches the target task and meets the business requirements. Since the first prompt word includes information for instructing to generate a prompt word template including a variable identifier, when subsequently generating a prompt word template for the target task, it is possible to generate a prompt word template including a variable identifier.

[0094] Furthermore, in order to enhance the prompt effect of the first prompt word, in some embodiments, the first prompt word also includes information indicating that key information is extracted from the input information related to the target task and the attribute information related to the target language model. In this way, when subsequently generating a prompt word template for the target task, the prompt word template for the target task is generated in combination with the extracted key information, so that the prompt word template for the target task is more suitable for the target task.

[0095] Furthermore, considering that different target language models may have different prompt word template styles, in some embodiments, the first prompt word also includes multiple prompt word template examples of the target language model. The multiple prompt word template examples of the target language model can be understood as prompt word templates with excellent model inference effect after being applied to the target language model.

[0096] Since the first prompt word includes multiple prompt word template examples of the target language model, when the prompt word template of the target task is subsequently generated, the prompt word template style of the target language model can be combined to generate a prompt word template that matches the target language model, thereby further improving the prompt ability of the prompt word template in the target language model.

[0097] S103: Send the first prompt word to the first language model, and receive the target prompt word template returned by the first language model.

[0098] Among them, the target prompt word template can be understood as a prompt word template corresponding to the target task, that is, the target prompt word template can be used to assist the target language model in processing the target task. The first language model can be understood as a language model used to generate the target prompt word template. For example, the first language model can be any language model accessed by the prompt engineering platform, and the embodiment of the present application does not limit this.

[0099] In an embodiment of the present application, the target prompt word template includes at least one target variable identifier related to the target task. Among them, the target variable identifier can be understood as a call variable related to the target task in the business engineering code, and the target variable identifier can indicate business data. For example, in the alarm handling business, the target task is a natural language task for analyzing alarm information. In this case, the target variable identifier can be a call variable indicating the alarm information. For another example, in the document management business, the target task is a natural language task for summarizing the content of the document. In this case, the target variable identifier can be a call variable indicating the document.

[0100] By sending the first prompt word to the first language model, the first language model can generate a target prompt word template based on the prompt capability of the first prompt word. In some embodiments, the first prompt word also includes information indicating the extraction of key information from the input information related to the target task and the attribute information related to the target language model. In specific implementation, the first language model can generate the target prompt word template through the following steps: sending the first prompt word also including the information indicating the extraction of key information from the input information related to the target task and the attribute information related to the target language model to the first language model, and receiving the target prompt word template generated by the first language model based on the extracted key information.

[0101] That is, by configuring information indicating extraction of key information in the first prompt word, the first language model can determine the key information from the input information related to the target task and the attribute information related to the target language model, and generate a target prompt word template based on the key information.

[0102] Among them, the key information includes at least one of the following: task elements of the target task, task objectives of the target task, constraints of the target task, model parameters of the target language model, or the applicable scope of the target language model.

[0103] In this way, the first language model constructs a comprehensive and complete task portrait and model portrait by identifying and analyzing input information related to the target task and attribute information related to the target language model, and combines the generation requirements of prompt word templates including variable identifiers to generate a target prompt word template that matches the target task and target language model and includes a target variable identifier.

[0104] In some other embodiments, the first prompt word also includes multiple prompt word template examples of the target language model. In specific implementation, the first prompt word that also includes multiple prompt word template examples of the target language model is sent to the first language model, and the target prompt word template returned by the first language model that matches the format of the multiple prompt word template examples is received.

[0105] That is, by configuring a plurality of prompt word template examples in the first prompt word, the first language model can generate a target prompt word template that matches the prompt word template format of the target language model according to the plurality of prompt word template examples.

[0106] In this way, the first language model improves the prompting ability of the target prompting word template after being applied to the target language model by learning multiple prompting word template examples of the target language model, thereby enhancing the reasoning performance of the target language model.

[0107] Furthermore, the user can also modify and optimize the target prompt word template. Specifically, a modification operation for the target prompt word template is received, and the target prompt word template is updated according to the modification operation.

[0108] That is to say, the target prompt word template generated by the first language model can be used as a prompt word template for reference. Based on the target prompt word template generated by the first language model, the user can fine-tune the target prompt word template in combination with actual needs, so that the target prompt word template is more in line with business needs and the prompt ability of the target prompt word template is improved. In this way, the user does not need to configure the prompt word template from scratch, but only needs to optimize it based on the target prompt word template generated by the first language model. Moreover, by generating the target prompt word template through the first language model, the user can clearly understand the configuration direction and focus of the target prompt word template, saving time and cost.

[0109] Through the above method, the difficulty of users writing prompt word templates is effectively reduced. For users who lack experience in configuring prompt word templates, they can quickly get started and use the natural language processing capabilities of the language model to improve the efficiency of generating prompt word templates. In addition, through the assistance and guidance of the first prompt word to the first language model, the quality of the target prompt word template generated by the first language model is effectively guaranteed. After the target prompt word template is applied to the target language model to process the target task, the output accuracy and reliability of the target language model can be improved, providing strong support for actual business applications.

[0110] In the embodiment of the present application, since the target prompt word template includes at least one target variable identifier related to the target task, the target variable identifier can be directly applied to the business engineering code, that is, the target variable identifier can be used as a call variable in the business engineering code and used in the business engineering code. In this way, the automatically generated target prompt word template can be directly written into the business engineering code.

[0111] In some possible implementations, an interface call code may be generated according to the target prompt word template, wherein the interface call code may be understood as a code in the business engineering code for calling the target language model, and the call variable indicated by the interface call code includes at least one target variable identifier.

[0112] That is to say, the target variable identifier in the target prompt word template can be directly called in the business engineering code. For example, the calling variable indicated by the interface calling code can be the target variable identifier itself, or the calling variable indicated by the interface calling code can also be a pointer corresponding to the target variable identifier.

[0113] For example, the interface calling code can be:

[0114]

[0115] Among them, the target variable identifiers are XXX, YYY and ZZZ. In this way, the target variable identifiers that meet the target task and the target language model are designed in the target prompt word template. In actual business applications, when executing business engineering codes, the target scalar identifier is used as the input parameter of the interface call code, the target language model is called, and the language model is applied to the processing of the target task.

[0116] Specifically, at least one target variable identifier is used as a calling variable to execute the interface calling code so that the target language model processes the target task based on the target prompt word, wherein the target prompt word is composed of a target prompt word template and data indicated by at least one target variable identifier.

[0117] That is to say, the interface calling code is executed through at least one target variable identifier, the data indicated by at least one target variable identifier (for example, business data) is filled into the target prompt word template to form a complete target prompt word, and the target prompt word is input into the target language model, so that the target language model can process the target task related to the data indicated by at least one target variable identifier under the prompt capability of the target prompt word.

[0118] For example, when at least one target variable is identified as {{question_list}}, the data indicated by at least one target variable identifier may be a question list. With {{question_list}} as the calling variable, the interface calling code is executed, and the question list is filled into the position of {{question_list}} in the target prompt word template to form the target prompt word. The target prompt word is input into the target language model, so that the target language model processes the question list corresponding to the target task under the prompt capability of the target prompt word.

[0119] In the method, for the generation process of the prompt word template, the prompt word template is generated by combining the input information related to the target task and the attribute information of the target language model used to process the target task, so that the generated prompt word template meets the actual needs of the target task. In addition, since the first prompt word used to generate the prompt word template includes information for indicating the generation of the prompt word template including the variable identifier, the generated prompt word template includes the target variable identifier related to the target task, and the target variable identifier can be directly applied to the business engineering code, thereby improving the efficiency of converting the prompt word template into the business engineering code, and being able to quickly apply the language model to the business.

[0120] The foregoing describes the method for generating a prompt word template provided in the embodiment of the present application, which will be further introduced below in conjunction with a specific scenario.

[0121] See also Figure 2A and Figure 2B The schematic diagram of the page related to generating the prompt word template is shown in FIG. Figure 2AA task configuration page is provided, in which the user can trigger a task configuration operation. Specifically, considering the uniqueness of the target task, the user can trigger an input operation for a task identity (ID) in the first area 201 of the task configuration page 20. Further, the user can trigger an input operation for the target task in the second area 201 and the third area 203 of the task configuration page 20, such as an operation for inputting a task name of the target task and an operation for inputting description information of the target task. The user can also trigger a selection operation for a target language model in the fourth area 204 of the task configuration page 20, thereby determining input information related to the target task and attribute information related to the target language model.

[0122] exist Figure 2A In the example, the task ID is "problem.classify.test", the task name is "problem classification", the task description is "read the question list and classify the questions into different topics according to the content of the questions", and the target language model is "language model A".

[0123] Then, when the user places the focus (such as the cursor) on the new task control, a control 205 for creating and automatically generating a prompt word template may be presented. The user may trigger the control 205 to create a new target task and generate a target prompt word template for the target task.

[0124] Figure 2B A prompt word presentation page is provided. In the prompt word presentation page 21, input information related to the target task is presented, such as the task name of the target task and the description information of the target task. In addition, in the prompt word template display area 211 of the prompt word presentation page 21, a target prompt word template of the target task is presented. For example, the target prompt word template is:

[0125] “###Role: Question Classification Expert

[0126] ##Target

[0127] Read the following list of questions and then classify them into different topics based on their content. Topics include but are not limited to: technology, education, art, sports, etc.

[0128] Question list: {{question_list}}

[0129] Please categorize these questions and output the answers in the following format:

[0130] -Question: Question content:

[0131] -Category: Topics

[0132] ##limit

[0133] Each question should have at least one category. If a question fits more than one category, you can list all the applicable categories.

[0134] If the classification of a question is unclear, it can be classified as "Other".

[0135] Please ensure the correct classification and avoid inappropriate classification. "

[0136] Among them, {{question_list}} is the target identification variable. In this way, for the target task, a matching target prompt word template is automatically generated, and at the same time, the target variable identification is included in the target prompt word template.

[0137] In addition, the user may also trigger a save control in the prompt word presentation page 21 to store the target prompt word template, or trigger a verification control in the prompt word presentation page 21 to verify the prompt capability of the target prompt word template.

[0138] Combination of the above Figure 1 2 and 3 provide a detailed introduction to the method for generating a prompt word template provided in an embodiment of the present application. The following will introduce the apparatus and device provided in an embodiment of the present application in conjunction with the accompanying drawings.

[0139] See also Figure 3 The schematic diagram of the structure of the device for generating the prompt word template shown in FIG. 30 includes:

[0140] An acquisition module 301 is used to acquire input information related to a target task and attribute information related to a target language model; wherein the target language model is used to process the target task;

[0141] A first generating module 302, configured to generate a first prompt word; wherein the first prompt word includes the input information related to the target task, the attribute information related to the target language model, and information for instructing to generate a prompt word template including a variable identifier;

[0142] The second generating module 303 is used to send the first prompt word to the first language model, and receive the target prompt word template returned by the first language model; wherein the target prompt word template includes at least one target variable identifier related to the target task, and the target prompt word template is used to assist the target language model in processing the target task.

[0143] In some possible implementations, the apparatus further includes a third generating module, and the third generating module is configured to:

[0144] An interface calling code is generated according to the target prompt word template; wherein the interface calling code is used to call the target language model, and the calling variable indicated by the interface calling code includes the at least one target variable identifier.

[0145] In some possible implementations, the apparatus further includes an execution module, wherein the execution module is configured to:

[0146] The interface calling code is executed with the at least one target variable identifier as a calling variable, so that the target language model processes the target task based on a target prompt word, wherein the target prompt word is composed of the target prompt word template and data indicated by the at least one target variable identifier.

[0147] In some possible implementations, the second generating module 303 is specifically configured to:

[0148] sending, to the first language model, a first prompt word indicating to extract key information from the input information related to the target task and the attribute information related to the target language model; wherein the key information includes at least one of the following: task elements of the target task, task objectives of the target task, constraints of the target task, model parameters of the target language model, or application scope of the target language model;

[0149] A target prompt word template generated by the first language model based on the extracted key information is received.

[0150] In some possible implementations, the second generating module 303 is specifically configured to:

[0151] sending the first prompt word of the plurality of prompt word template examples including the target language model to the first language model;

[0152] Receive a target prompt word template returned by the first language model and matching the format of the plurality of prompt word template samples.

[0153] In some possible implementations, the acquisition module 301 is specifically used to:

[0154] Present the task configuration page;

[0155] Receiving a task configuration operation triggered in the task configuration page, the task configuration operation including an input operation for a target task and a selection operation for a target language model;

[0156] According to the task configuration operation, input information related to the target task and attribute information related to the target language model are determined.

[0157] In some possible implementations, the apparatus further includes an updating module, wherein the updating module is configured to:

[0158] receiving a modification operation on the target prompt word template;

[0159] According to the modification operation, the target prompt word template is updated.

[0160] In some possible implementations, the input information related to the target task includes the name of the target task and / or description information of the target task.

[0161] The device 30 for generating a prompt word template according to the embodiment of the present application may correspond to the method described in the embodiment of the present application, and the above and other operations and / or functions of each module / unit of the device 30 for generating a prompt word template are respectively to realize Figure 1 For the sake of brevity, the corresponding processes of each method in the illustrated embodiment are not described in detail here.

[0162] The present application also provides an electronic device. The electronic device is specifically used to implement Figure 3 The function of the prompt word template generating device 30 in the illustrated embodiment.

[0163] Figure 4 A schematic diagram of the structure of an electronic device 400 is provided. Figure 4 As shown, the electronic device 400 includes a bus 401, a processor 402, a communication interface 403 and a memory 404. The processor 402, the memory 404 and the communication interface 403 communicate with each other via the bus 401.

[0164] The bus 401 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0165] The processor 402 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0166] The communication interface 403 is used for communicating with the outside. For example, the communication interface 403 can be used for communicating with a terminal.

[0167] The memory 404 may include a volatile memory, such as a random access memory (RAM). The memory 404 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0168] The memory 404 stores executable codes, and the processor 402 executes the executable codes to perform the aforementioned method for generating a prompt word template.

[0169] Specifically, in implementing Figure 3 In the case of the embodiment shown, and Figure 3 When each module or unit of the prompt word template generating device 30 described in the embodiment is implemented by software, the execution Figure 3 The software or program code required for the functions of each module / unit in the system may be partially or completely stored in the memory 404. The processor 402 executes the program code corresponding to each unit stored in the memory 404 to execute the aforementioned method for generating the prompt word template.

[0170] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the method for generating a prompt word template of the above-mentioned device 30 for generating a prompt word template.

[0171] The embodiment of the present application further provides a computer program product, which includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in the embodiment of the present application is generated in whole or in part.

[0172] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer or data center to another website, computer or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0173] When the computer program product is executed by a computer, the computer executes any of the aforementioned methods for generating a prompt word template. The computer program product may be a software installation package, and when any of the aforementioned methods for generating a prompt word template is needed, the computer program product may be downloaded and executed on a computer.

[0174] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to each embodiment of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0175] The units involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the unit / module does not, in some cases, constitute a limitation on the unit itself.

[0176] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0177] In the context of the present application embodiment, machine-readable medium can be a tangible medium that can contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable medium can include but is not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0178] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0179] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0180] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0181] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

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

Claims

1. A method for generating a prompt word template, characterized in that: The method comprises: Acquire input information related to a target task and attribute information related to a target language model; wherein the target language model is used to process the target task; Generate a first prompt word; wherein the first prompt word includes the input information related to the target task, the attribute information related to the target language model, and information for instructing to generate a prompt word template including a variable identifier; The first prompt word is sent to a first language model, and a target prompt word template returned by the first language model is received; wherein the target prompt word template includes at least one target variable identifier related to the target task, and the target prompt word template is used to assist the target language model in processing the target task.

2. The method according to claim 1, characterized in that The method further comprises: An interface calling code is generated according to the target prompt word template; wherein the interface calling code is used to call the target language model, and the calling variable indicated by the interface calling code includes the at least one target variable identifier.

3. The method according to claim 2, characterized in that The method further comprises: The interface calling code is executed with the at least one target variable identifier as a calling variable, so that the target language model processes the target task based on a target prompt word, wherein the target prompt word is composed of the target prompt word template and data indicated by the at least one target variable identifier.

4. The method according to claim 1, characterized in that: The sending the first prompt word to the first language model and receiving the target prompt word template returned by the first language model includes: sending, to the first language model, a first prompt word indicating to extract key information from the input information related to the target task and the attribute information related to the target language model; wherein the key information includes at least one of the following: task elements of the target task, task objectives of the target task, constraints of the target task, model parameters of the target language model, or application scope of the target language model; A target prompt word template generated by the first language model based on the extracted key information is received.

5. The method according to claim 1, characterized in that The sending the first prompt word to the first language model and receiving the target prompt word template returned by the first language model includes: sending the first prompt word of the plurality of prompt word template examples including the target language model to the first language model; Receive a target prompt word template returned by the first language model and matching the format of the plurality of prompt word template samples.

6. The method according to claim 1, characterized in that The step of obtaining input information related to the target task and attribute information related to the target language model includes: Present the task configuration page; Receiving a task configuration operation triggered in the task configuration page, the task configuration operation including an input operation for a target task and a selection operation for a target language model; According to the task configuration operation, input information related to the target task and attribute information related to the target language model are determined.

7. The method according to claim 1, characterized in that The method further comprises: receiving a modification operation on the target prompt word template; According to the modification operation, the target prompt word template is updated.

8. The method according to any one of claims 1 to 7, characterized in that: The input information related to the target task includes the name of the target task and / or description information of the target task.

9. A device for generating a prompt word template, characterized in that: The device comprises: An acquisition module, used to acquire input information related to a target task and attribute information related to a target language model; wherein the target language model is used to process the target task; A first generating module, configured to generate a first prompt word; wherein the first prompt word includes the input information related to the target task, the attribute information related to the target language model, and information for instructing to generate a prompt word template including a variable identifier; The second generating module is used to send the first prompt word to the first language model, and receive the target prompt word template returned by the first language model; wherein the target prompt word template includes at least one target variable identifier related to the target task, and the target prompt word template is used to assist the target language model in processing the target task.

10. An electronic device, characterized in that: The electronic device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the electronic device performs the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The method comprises instructions, wherein the instructions instruct an electronic device to execute the method according to any one of claims 1 to 8.

12. A computer program product, characterized in that The computer program product comprises computer readable instructions for implementing the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Page parameter generation method and page parameter generation device for webpage

    CN120256703A