Two-segment cue generation method for large model

By establishing a model phrase library and word segmentation analysis, and combining preset rules to extract core keywords, the existing two-parameter prompt generation method relies on manual experience and lack of automatic adaptation, achieving efficient and accurate prompt generation, improving user experience and system flexibility.

CN119807369AActive Publication Date: 2025-04-11北京致链科技有限责任公司
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411875940.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-11
Estimated Expiration
2044-12-19

AI Technical Summary

Technical Problem

The existing two-stage prompt generation method relies on manual experience in design, lacks systematicity and consistency, and cannot automatically adapt to the needs of different users or application scenarios, resulting in inefficient generation and poor user experience.

Method used

By establishing a model phrase library and word segmentation analysis, the legality verification and type recognition of user input are realized, and the core keywords are extracted using preset rules to generate prompts in diverse output formats.

Benefits of technology

It improves the efficiency and accuracy of input processing, and the generated prompts are more in line with user needs, improving the flexibility and adaptability of the user experience and system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807369A_ABST
    Figure CN119807369A_ABST
Patent Text Reader

Abstract

The invention provides a two-segment cue generation method for a large model, which comprises the following steps of: establishing a model phrase library, after a user inputs information, comparing the input information with statements in the model phrase library, judging whether the input is illegal, the input is null or the input content coincides with the model phrase library or not, and if yes, generating a cue. If the judgment result is illegal, the input is null or the content coincides, the operation is stopped, and a response prompt is output to the user; if the input content is legal, the input is not empty, and the content does not coincide with the model phrase library, the user input is read, and the type of the user input is analyzed; if the type input by the user is a special instruction, directly outputting a response prompt to the user; when the type input by the user is question inquiry, word segmentation is carried out; and after word segmentation, judging the type of the question after word segmentation, and if the question has a corresponding knowledge point answer, obtaining the answer of the question from the knowledge base.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of model prompts, and in particular relates to a two-segment prompt generation method for a large model. Background Art

[0002] At present, the application of large models has made significant progress in the fields of artificial intelligence and natural language processing. With their powerful learning ability and rich knowledge reserves, large models are able to generate high-quality text, conduct complex conversations, and solve a variety of tasks. However, in order to effectively interact with these large models, prompt design becomes crucial. In recent years, two-part prompt generation methods have gradually attracted attention. This method guides the model to generate more accurate and relevant responses by dividing the input information into two parts. Although this method has improved the response quality of the model to a certain extent, the current technology still has some significant defects, which limits its effectiveness and flexibility in practical applications. Current two-part prompt generation methods often rely on manual experience and expert knowledge in the design of prompts, which leads to a lack of systematicity and consistency in the generated prompts. Different users or application scenarios may require different prompts, but existing methods cannot automatically adapt to these changes, resulting in low efficiency in prompt generation and often failing to meet the needs of specific tasks.

[0003] Existing methods still do not perform well enough when dealing with complex tasks. For some tasks that require multiple rounds of dialogue or in-depth reasoning, simple two-segment prompts often fail to provide enough contextual information, so that the responses generated by the model may lack depth and accuracy. This limitation may lead to poor user experience in practical applications and fail to meet user expectations. In addition, the current two-segment prompt generation method is also insufficient in scalability. With the continuous expansion of application scenarios, how to quickly generate prompts that meet different needs has become a major challenge. Existing systems often require manual adjustment and optimization when expanding, which increases maintenance costs and manpower investment.

[0004] Existing prompt generation methods are generally low in intelligence and lack the ability to self-learn and optimize. Most methods cannot be improved based on historical interaction data, resulting in the generated prompts gradually losing their effectiveness during long-term use. Systems that lack intelligence are also unable to respond to changes in user needs in a timely manner, limiting the flexibility and adaptability of applications.

[0005] Existing two-part prompt generation methods also face challenges in semantic understanding and context preservation. Although large models have made some progress in natural language understanding, when dealing with ambiguous or complex prompts, the model may still not be able to accurately understand the user's intent, resulting in the generated response not being relevant or effective enough.

[0006] Current prompt generation methods also need to be improved in terms of user-friendliness. Many users lack sufficient understanding of the design of prompts, which causes them to face difficulties when interacting with the model. Existing systems often fail to provide sufficient guidance or feedback, and users may feel confused when entering prompts, affecting the overall user experience. Therefore, in order to solve the above problems, there is an urgent need for a new two-stage prompt generation method that can realize automated and intelligent prompt design, with good scalability and user-friendliness, to improve the performance and user experience of large models in various application scenarios.

[0007] Therefore, there is an urgent need for a two-part prompt generation method for large models. Summary of the invention

[0008] The present invention proposes a two-segment prompt generation method for a large model, which solves the problems of legitimacy verification, input type recognition and diversified output when the large model processes user input. By establishing a model phrase library and word segmentation analysis, it ensures that the generated response prompt is accurate and meets user needs.

[0009] The technical solution of the present invention is implemented as follows: a two-segment prompt generation method for a large model, the method comprising the following steps:

[0010] Establish a model phrase library. After the user inputs information, compare the input information with the sentences in the model phrase library to determine whether the input is illegal, empty, or the input content overlaps with the model phrase library. If it is determined to be illegal, empty, or the content overlaps, terminate the operation and output a response prompt to the user; if the input content is legal, the input is not empty, and the content does not overlap with the model phrase library, read the user input and analyze the type of the user input; if the type of the user input is a special instruction, directly output a response prompt to the user;

[0011] When the user input type is a question, it is segmented; after the word segmentation, the question type is determined. If there is a corresponding knowledge point answer for the question, the answer to the question is obtained from the knowledge base; if there is a special output for the question, the user input information is sent to a specific training model to predict the output content; if the output is formatted text, the corresponding content of the formatted text prompt response is output; if the output is an image, the corresponding content of the image prompt response is output;

[0012] Before word segmentation, determine whether the user input information contains special symbols. If it does not contain special symbols, directly perform word segmentation. If it contains special symbols, locate the special symbols, and then perform natural language word segmentation on the content before the special symbols to obtain the first category of word groups, and perform natural language word segmentation on the content after the special symbols to obtain the second category of word groups.

[0013] Then, based on the preset rules, core keywords are obtained from the second category of word groups, the core keywords are synthesized with the first category of word groups to obtain the corresponding content of the final output prompt, and the final output prompt is output in a user-specified format.

[0014] It has significant advantages in input validity verification and processing flow. Traditional prompt generation systems often lack comprehensive verification of user input and are prone to accepting illegal or repeated input, resulting in inaccurate or invalid responses. However, this method can effectively determine whether the input is legal, empty, or overlaps with existing content by establishing a model phrase library and comparing user input. If the input is illegal, the system will terminate the operation and output a response prompt to the user in a timely manner, thereby avoiding the processing of invalid requests and improving the user experience.

[0015] This method achieves a more detailed classification in input type analysis and processing. The existing technology usually treats user input as a single type for processing, lacks in-depth analysis of the input content, and fails to provide corresponding responses for different types of requests. However, this method analyzes the type of user input and divides it into multiple types such as special instructions, question inquiries, formatted text output, and image output. In this way, the system can adopt corresponding processing strategies according to different input types to ensure that the generated prompts can accurately meet user needs.

[0016] The word segmentation strategy of this method is also innovative. When processing user input, first determine whether it contains special symbols. If it does not contain special symbols, then directly perform word segmentation; if it contains special symbols, locate its position and perform word segmentation on the content before and after the special symbols. This word segmentation strategy can better understand user intentions, thereby extracting more accurate keywords and generating more targeted prompts. Traditional methods often ignore the impact of special symbols on semantics, resulting in inaccurate word segmentation results. This method significantly improves the effect of word segmentation by processing special symbols.

[0017] This method introduces preset rules in keyword extraction and output generation, and calculates core keywords by counting word frequency and text frequency index. This data-driven keyword extraction method can more scientifically obtain the most important information in user input and ensure that the generated prompts have higher relevance and practicality. Traditional methods often rely on simple rules or manual settings, lacking flexibility and accuracy, while the algorithmic processing of this method can effectively improve the effect of keyword extraction.

[0018] This method supports a variety of output formats, including JSON format text, image format, and table. The existing technology can only output responses in a single format, which limits the application scenarios of the system. However, this method outputs in a user-specified format, so that the generated prompts can better adapt to different usage scenarios and requirements, improving the flexibility and usability of the system.

[0019] As a preferred implementation, the pre-set rule is to calculate the core keywords by counting word frequency and text frequency index. When outputting, the output formatted prompt response content includes text prompt response content and picture prompt response content, and the output format includes JSON format text, image format and table.

[0020] As a preferred implementation, user information is input, and after input, it is determined whether the input information contains special symbols. If it contains special symbols, the content before the special symbol is used as the first keyword, and the content after the special symbol is used as the second keyword. If it does not contain special symbols, the entire input content is directly used as the first keyword and the second keyword. Content without special symbols includes empty input or input information that is the same as the preset phrase in the model phrase library. Based on the first keyword and the second keyword, a first paragraph of prompt response content is output to the user. After the first paragraph of prompt response content is output, if the first keyword or the second keyword is already included in the knowledge base, a second paragraph of prompt response content generated based on the first keyword and the second keyword is output to the input subject. Otherwise, the entire input content is segmented, and a core keyword group is obtained after segmentation. After the second paragraph of prompt response content and the core keyword group are output, information is sorted and sorted based on the core keyword group to obtain information synthesis logic. Based on the information synthesis logic, the first paragraph of response content and the second paragraph of response content are synthesized, and formatted output is performed. Finally, the formatted content is output.

[0021] As a preferred implementation, a knowledge base search is performed based on the first keyword and the second keyword to obtain corresponding information as the second prompt response content. When keywords exist therein, the data is expanded based on the data corresponding to the keywords, and the expanded content is used as the second prompt response content; an overall search is performed based on the first keyword and the second keyword to obtain the search data; the search data is used as paragraph points and synthesized according to the first prompt response content as the second prompt response content.

[0022] As a preferred implementation, the special symbols include a colon, a comma, a semicolon and a quotation mark, and the content before the special symbol is the content before the special symbol in the input information.

[0023] After adopting the above technical solution, the beneficial effect of the present invention is that by establishing a model phrase library and performing input legitimacy verification, the system can quickly identify invalid input and avoid unnecessary processing procedures. After the user enters information, the system can immediately feedback the legitimacy of the input, thereby improving the fluency of the interaction. This efficient input processing mechanism enables users to have a better experience during use and reduces the frustration caused by input errors.

[0024] The system's multi-level input type analysis capability makes response generation more accurate. By identifying the specific type of user input, the system can provide corresponding prompts in a targeted manner. For example, for the processing of special instructions, the system can directly output responses, and for question inquiries, it generates answers through word segmentation and knowledge base queries. This targeted response mechanism can effectively improve user satisfaction and enable users to obtain the required information or services more quickly.

[0025] The innovation of word segmentation strategy improves the system's ability to understand user intent. By processing special symbols, the system can more accurately extract key information from user input and ensure that the generated prompts are highly relevant to user intent. This accurate intent recognition not only improves the quality of generated content, but also reduces the user's confusion caused by information mismatch, thereby enhancing user trust and usage stickiness.

[0026] The algorithmic processing of keyword extraction provides a more scientific basis for the system. By counting word frequency and text frequency index, the system can extract the most representative core keywords from user input, ensuring that the generated prompts are highly relevant and practical. The limitation of traditional methods is that keyword extraction relies on experience and subjective judgment, while the algorithmic processing of this method makes keyword extraction more objective and accurate, thereby improving the effectiveness of information transmission.

[0027] The design supports a variety of output formats, so that the system can better meet the needs of different users. Whether it is a user who wants to obtain information in text form or a user who needs a response in the form of an image or table, the system can provide the corresponding output format. This flexibility enables the system to be widely used in different scenarios, improving its commercial value and user acceptance. By meeting the preferences of different users, the system can enhance user participation and improve the overall usage experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0029] Figure 1 is a flow chart of the method of the present invention;

[0030] Figure 2 This is a schematic diagram of an example in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0032] Example:

[0033] like Figures 1-2 As shown, a two-segment prompt generation method for a large model comprises the following steps:

[0034] Establish a model phrase library. After the user inputs information, compare the input information with the sentences in the model phrase library to determine whether the input is illegal, empty, or the input content overlaps with the model phrase library. If it is determined to be illegal, empty, or the content overlaps, terminate the operation and output a response prompt to the user; if the input content is legal, the input is not empty, and the content does not overlap with the model phrase library, read the user input and analyze the type of the user input; if the type of the user input is a special instruction, directly output a response prompt to the user;

[0035] When the user input type is a question, it is segmented; after the word segmentation, the question type is determined. If there is a corresponding knowledge point answer for the question, the answer to the question is obtained from the knowledge base; if there is a special output for the question, the user input information is sent to a specific training model to predict the output content; if the output is formatted text, the corresponding content of the formatted text prompt response is output; if the output is an image, the corresponding content of the image prompt response is output;

[0036] Before word segmentation, determine whether the user input information contains special symbols. If it does not contain special symbols, directly perform word segmentation. If it contains special symbols, locate the special symbols, and then perform natural language word segmentation on the content before the special symbols to obtain the first category of word groups, and perform natural language word segmentation on the content after the special symbols to obtain the second category of word groups.

[0037] Then, based on the preset rules, core keywords are obtained from the second category of word groups, the core keywords are synthesized with the first category of word groups to obtain the corresponding content of the final output prompt, and the final output prompt is output in a user-specified format.

[0038] This method aims to generate a response prompt that meets the user's needs by analyzing and processing the user's input information. Its working principle and workflow can be divided into several main steps. The specific operation steps are as follows.

[0039] First, the system establishes a model phrase library, which is the basis of this method. The model phrase library contains a large number of predefined sentences and phrases for comparing the information input by the user. After the user enters the information, the system first compares the user's input with the sentences in the model phrase library to determine whether the input is legal. If the system detects that the input is illegal, the input is empty, or the content entered by the user coincides with the content in the model phrase library, the system will terminate the operation and output a corresponding prompt to the user to inform the user that there is a problem with his input. This process ensures that the user's input is first effectively verified before entering the subsequent processing link of the system, avoiding the invalidity of subsequent processing.

[0040] When the user input is judged to be legal and not empty, and does not overlap with the model phrase library, the system will read the user input and analyze the input type. At this time, the system will determine the type of user input, which may include special instructions, question inquiries, formatted text requests, or image requests. If the user input type is a special instruction, the system will directly output the corresponding response prompt to the user without further analysis and processing. This design is intended to improve the system's response efficiency and ensure that users can quickly obtain the information they need.

[0041] If the user input type is determined to be a question, the system will perform word segmentation. Word segmentation is an important step in natural language processing, which aims to break down the user's input information into smaller semantic units for subsequent analysis. After the word segmentation is completed, the system will determine the type of question after word segmentation. If the system recognizes that there is a corresponding knowledge point answer to the question, it will obtain the answer to the question from the knowledge base and return it directly to the user.

[0042] If the system recognizes that the user's question has special output requirements, such as the need to use a specific training model for predictive output, the system will send the user's input information to the corresponding model for processing to generate output content that meets the user's needs. In addition, when the user requests formatted text output, the system will generate a formatted text prompt based on the user's input and output the corresponding content; if the user requests image output, the system will generate or extract relevant images based on the input information and return them to the user.

[0043] Before tokenization, the system will first check whether the information input by the user contains special symbols. If the user input does not contain special symbols, the system will directly perform tokenization; if it contains special symbols, the system will locate the position of the special symbols and perform natural language tokenization on the content before the symbols to generate the first type of word group; subsequently, tokenize the content after the special symbols to obtain the second type of word group. This processing method enables the system to better understand the structure and intention of the user input.

[0044] The system extracts core keywords from the second type of word group based on pre-set rules. These core keywords will be combined with the first type of word group to generate the final output prompt. The combination process involves relevant algorithms of natural language generation to ensure that the generated prompt not only conforms to grammar rules but also conveys the information required by the user.

[0045] The system outputs the finally generated output prompt in the format specified by the user. The flexibility of this step enables the user to choose different output methods according to their own needs, such as text, image or other formats, enhancing the adaptability of the system and the user experience.

[0046] In the current applicable scenarios, most of the original training datasets of large models are in text form, that is, there are more without special formats and fewer with formatted datasets. When it is necessary to enrich the content and also need to bring complex formats, it is very difficult for the model to generate. Often, the generated content with formats is not very appropriate and tends to be simplified. For example, the probability of the model predicting and outputting "What is half of the number if two-fifths of the number is one-fourth" and predicting and outputting "[{What is half of the number if two-fifths of the number is one-fourth}]" is inconsistent. For example, the generalization ability of predicting the second character for the first character "[" or "一" is different.

[0047] Applicable models: Pay special attention to the fact that the current domestic model development level is at the same level as GPT3.5, that is to say, at this level, when the model understanding level is not high, including vertical field models, this method is very easy to use, reducing customer interaction and achieving a one-time result. The disadvantage of the existing technology (multi-turn dialogue technical method) is that after the page returns the result, it needs to wait for the customer's input again to make corrections and returns, and the customer needs to correct the result multiple times by himself. This application document is designed for this situation, especially when industrial processing is required later, and the one-time processing (text result + format) model cannot be successfully output, it is very appropriate to use the method of this application document.

[0048] Specifically, core requirements are extracted from user input, such as generating questions or format requirements. The input is semantically analyzed using an NLP model to determine content generation goals and formatting requirements; The first prompt (content generation prompt): guides the model to generate core content through the initial prompt. The initial prompt focuses on content generation, such as "generate 2 elementary school math questions including answers." The second prompt (formatting prompt): After the core content is generated, the formatting prompt is used to redirect the model to output the generated content in a user-specified format (such as JSON). For example, "format the above results into JSON format." Two-stage output management, the initially generated content is output under the content generation prompt, not displayed to the outside, and enters the background pending state. Call the formatting prompt to generate the output result in the target format, and display it to the user as the final result output.

[0049] Assume: U is the user input content, P1 is the content generation prompt, P2 is the formatting prompt, and O is the output result.

[0050] 1. Content generation: C = Model (U + P1); C is the core content generated.

[0051] 2. Formatted output: O = Model (C + P2); the final output O is a result that conforms to the format specified by the user, can be completed in a single round of dialogue at one time, and meets specific format requirements such as JSON.

[0052] Large model prompts (often also called "prompts") are input texts used in the field of artificial intelligence, especially in large language models (LLM) and natural language processing (NLP), to trigger or guide large language models to produce specific responses or behaviors. As a means of interaction, it helps users communicate with the model more effectively to obtain the required information or perform specific tasks. The traditional one-time input text makes the model respond or output text very limited;

[0053] like Figure 2 As shown, for example: user input: "Generate 2 elementary school math problems including answers" system integrated prompt words: "Generate 2 elementary school math problems. Output in JSON format." The model responds with the output text: "1. Question: (2 / 5) of a number is (1 / 4), what is (1 / 2) of this number. Answer: 5 / 8 2. Question: (3 / 4) of a number is 12, what is (1 / 2) of this number. Answer: 8" The result is obviously not in JSON format. This method can be used for a single round of replies through the iForm system. The underlying design of the iForm system belongs to the Java system architecture, and the requirements for the result format of the model are relatively strict. The output text needs to be in JSON format. For example, the following output is obtained: "[{"Question":"(2 / 5) of a number is (1 / 4), what is (1 / 2) of this number.","Answer":"5 / 8"},{"Question":"(3 / 4) of a number is 12, what is (1 / 2) of this number.","Answer":8}]". In other words, it is difficult to get an output text in JSON format at one time, so this method can be used to get an output text in JSON format.

[0054] The preset rule is to calculate the core keywords by counting word frequency and text frequency index. When outputting, the output formatted prompt response content includes text prompt response content and picture prompt response content. The output format includes JSON format text, image format and table.

[0055] In this technical solution, the pre-set rules calculate the core keywords by counting the word frequency and text frequency index. Compared with the prior art, this method embodies a more accurate and systematic keyword extraction process. The prior art usually adopts a relatively simple keyword extraction method, which often relies on fixed rules or patterns, which may lead to less than ideal keyword extraction results and cannot adapt to diverse user inputs. In contrast, this solution can better reflect the importance of keywords in the text by combining word frequency and text frequency index, thereby improving the accuracy and effectiveness of keyword extraction. In addition, this solution also supports the output of formatted prompt response content, covering text prompts and picture prompts. The output format includes JSON format text, image format and table. This diversified output method enables users to obtain information in different forms according to their needs, enhancing the flexibility and applicability of the system. However, the prior art usually only focuses on a single output format, lacks comprehensive consideration of user needs, and limits the efficiency and diversity of information transmission.

[0056] Input user information, and after input, determine whether the input information contains special symbols. If it contains special symbols, the content before the special symbol is used as the first keyword, and the content after the special symbol is used as the second keyword. If there is no special symbol, the entire input content is directly used as the first keyword and the second keyword. The content without special symbols includes empty input or the input information is the same as the preset phrase in the model phrase library. Based on the first keyword and the second keyword, the first paragraph of prompt response content is output to the user. After the first paragraph of prompt response content is output, if the first keyword or the second keyword is already included in the knowledge base, the second paragraph of prompt response content generated based on the first keyword and the second keyword is output to the input topic. Otherwise, the entire input content is segmented, and the core keyword group is obtained after the segmentation. After the second paragraph of prompt response content and the core keyword group are output, the information is sorted and sorted based on the core keyword group to obtain the information synthesis logic. Based on the information synthesis logic, the first paragraph of response content and the second paragraph of response content are synthesized, and formatted output is performed. Finally, the formatted content is output.

[0057] In the process of processing user input information, this solution further improves the system's ability to understand user input by judging whether the input content contains special symbols. If the input content contains special symbols, the content before and after the special symbols will be processed as the first keyword and the second keyword respectively; if there are no special symbols, the entire input will be regarded as the first and second keywords. This flexible processing method is in sharp contrast to the existing technology, which often lacks a detailed analysis of the user input structure and easily leads to one-sided information processing. By identifying and separating special symbols, this solution can better capture user intentions and output the first paragraph of prompt response content on this basis. This process not only improves the response speed of the system, but also ensures the accurate delivery of the information required by the user. Subsequently, if there is information corresponding to the first keyword or the second keyword in the knowledge base, the system will generate the second paragraph of prompt response content based on these keywords, further improving the relevance and practicality of the information.

[0058] Based on the first keyword and the second keyword, a knowledge base search is performed to obtain corresponding information as the second paragraph prompt response content. When keywords exist therein, the data is expanded based on the corresponding data of the keywords, and the expanded content is used as the second paragraph prompt response content; an overall search is performed based on the first keyword and the second keyword to obtain the search data; the search data is used as paragraph points and synthesized according to the first paragraph prompt response content as the second paragraph prompt response content.

[0059] In the knowledge base search process, this solution can effectively obtain information directly related to the user input based on the search of the first keyword and the second keyword, which is often poorly performed in the existing technology. Existing systems may only rely on simple matching of keywords during retrieval, resulting in low relevance of retrieval results. However, this solution can more comprehensively obtain information related to the user input topic through keyword expansion and overall retrieval, and use this information as paragraph points to organize and synthesize information. The introduction of this method makes the integration of information more systematic, and the final generated second paragraph prompt response content is more in line with user needs, enhancing the user experience.

[0060] The special symbols include colons, commas, semicolons and quotation marks, and the content before the special symbol is the content before the special symbol in the input information.

[0061] This solution defines special symbols, including colons, commas, semicolons, and quotation marks, which provide a clear framework for the system's input processing. On the one hand, this clarifies the structure of user input information, and on the other hand, it also makes the keyword extraction and information processing process more standardized. In the prior art, there is often a lack of clear regulations on special symbols, which leads to an insufficiently rigorous processing process for input content, which can easily cause ambiguity or misunderstanding of information. Through the specific definition and processing of special symbols, this solution enables the system to accurately identify and parse user input, ensuring that the final output content can accurately reflect the user's intentions. This innovation has significantly improved the accuracy of information processing and user experience of this technical solution compared to the prior art.

[0062] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A two-segment prompt generation method for a large model, characterized in that: The method comprises the following steps: Establish a model phrase library. After the user inputs information, compare the input information with the sentences in the model phrase library to determine whether the input is illegal, empty, or the input content overlaps with the model phrase library. If it is determined to be illegal, empty, or the content overlaps, terminate the operation and output a response prompt to the user; if the input content is legal, the input is not empty, and the content does not overlap with the model phrase library, read the user input and analyze the type of the user input; if the type of the user input is a special instruction, directly output a response prompt to the user; When the user input type is a question, it is segmented; after the word segmentation, the question type is determined. If there is a corresponding knowledge point answer for the question, the answer to the question is obtained from the knowledge base; if there is a special output for the question, the user input information is sent to a specific training model to predict the output content; if the output is formatted text, the corresponding content of the formatted text prompt response is output; if the output is an image, the corresponding content of the image prompt response is output; Before word segmentation, determine whether the user input information contains special symbols. If it does not contain special symbols, directly perform word segmentation. If it contains special symbols, locate the special symbols, and then perform natural language word segmentation on the content before the special symbols to obtain the first category of word groups, and perform natural language word segmentation on the content after the special symbols to obtain the second category of word groups. Then, based on the preset rules, core keywords are obtained from the second category of word groups, the core keywords are synthesized with the first category of word groups to obtain the corresponding content of the final output prompt, and the final output prompt is output in a user-specified format.

2. A two-segment prompt generation method for a large model as claimed in claim 1, characterized in that: The preset rule is to calculate the core keywords by counting word frequency and text frequency index. When outputting, the output formatted prompt response content includes text prompt response content and picture prompt response content. The output format includes JSON format text, image format and table.

3. A two-segment prompt generation method for a large model as claimed in claim 1, characterized in that: Enter user information, and after entering, determine whether the input information contains special symbols. If it contains special symbols, use the content before the special symbol as the first keyword and the content after the special symbol as the second keyword; If there is no special symbol content, the entire input content is directly regarded as the first keyword and the second keyword. If there is no special symbol content, the input is empty or the input information is the same as the preset phrase in the model phrase library. Based on the first keyword and the second keyword, the first prompt response content is output to the user. After the first prompt response content is output, if the first keyword or the second keyword is already included in the knowledge base, the second prompt response content generated based on the first keyword and the second keyword is output to the input topic; Otherwise, the entire input content is segmented, and the core keyword group is obtained after segmentation; After the second prompt response content and core keyword group are output, the information is sorted and sorted based on the core keyword group to obtain the information synthesis logic; based on the information synthesis logic, the first response content and the second response content are synthesized, and formatted output is performed; and finally the formatted content is output.

4. A two-segment prompt generation method for a large model as claimed in claim 3, characterized in that: Based on the first keyword and the second keyword, a knowledge base search is performed to obtain corresponding information as the second paragraph prompt response content. When keywords exist therein, the data is expanded based on the corresponding data of the keywords, and the expanded content is used as the second paragraph prompt response content; an overall search is performed based on the first keyword and the second keyword to obtain the search data; the search data is used as paragraph points and synthesized according to the first paragraph prompt response content as the second paragraph prompt response content.

5. A two-segment prompt generation method for a large model as claimed in claim 3, characterized in that: The special symbols include colons, commas, semicolons and quotation marks, and the content before the special symbol is the content before the special symbol in the input information.

Citation Information

Patent Citations

  • Knowledge base question and answer method and device based on large language model under mass information

    CN117312509A

  • Data processing method and device, equipment and storage medium

    CN117520523A

  • Document generation system, method and equipment based on knowledge base and large model and medium

    CN117556010A

  • Response text generation method based on large language model, electronic equipment and medium

    CN117932010A

  • Statement response method and device, intelligent robot and storage medium

    CN117933263A