A long-term controllable and optimizable corpus construction method suitable for GPT

By replacing the answers in the open-source question-answering dataset with incompetent responses in the GPT model, and by introducing dialogue templates and user-customized training sets, the problem of invalid question-answering in the GPT model on enterprise question-answering servers is solved, controllable text generation is achieved, and server efficiency and user experience are improved.

CN117009809BActive Publication Date: 2026-05-15GANSU WANWEI INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GANSU WANWEI INFORMATION TECH CO LTD
Filing Date
2023-05-22
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing GPT models contain invalid and irrelevant questions and answers in enterprise question-answering servers, affecting server efficiency and making it difficult to achieve on-demand and controllable text generation, potentially outputting sensitive or useless information.

Method used

By setting all answers in the open-source question-answering dataset to "unable to respond" and introducing dialogue templates into the question-answer pairs, we can perform corpus augmentation training, customize the training set according to user needs, eliminate irrelevant questions, and achieve controllable text generation.

Benefits of technology

This achieves long-term controllability and optimizability of the GPT model, ensuring that the output is relevant to user needs, avoiding the generation of sensitive information, and improving user experience and server efficiency.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The application belongs to the technical field of natural language processing, and particularly relates to a long-term controllable and optimizable corpus construction method suitable for GPT. Controllable text generation mainly reflects that a segment of the beginning of the answer in the question and answer pair is supplemented, and the words related to the important information in the question are guided to answer the actual expected output, so that controllable text generation is realized, and sensitive questions are evaded in the corpus construction by using an evasive answer and the like. Long-term optimization mainly reflects that a user can continuously exclude related questions in an open source data set according to own needs by using an exclusion method, update own training corpus, and thus complete a task required by the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing technology, specifically relating to a method for constructing a long-term controllable and optimizable corpus suitable for GPT. Background Technology

[0002] With the rise of ChatGPT technology, GPT model technology has been widely used. However, in actual use, especially in enterprise question-and-answer servers, there are a large number of invalid and irrelevant questions and answers, which significantly affects the collection of enterprise business information. The GPT model is filled with a lot of useless information, which seriously affects the efficiency of server use. The market urgently needs to realize on-demand and controllable GPT applications, so that the GPT model can become a long-term controllable and optimizable model. Summary of the Invention

[0003] This invention proposes a method to set all answers in open-source question-and-answer datasets to the phrase "Sorry, this question is a bit difficult, I'm still learning!" This ensures that irrelevant questions receive the same response. Then, questions relevant to the user's needs are excluded from the open-source dataset. Through cleverly crafted phrase templates, these questions are corrected to the desired answers. The templates begin the answer section with phrases related to the question, improving the controllability of text generation. Simultaneously, corpus-enhanced training is performed to provide the desired answers. Furthermore, GPT outputs will never generate information that spreads rumors, infringes copyrights, raises ethical concerns, or leaks privacy, thus achieving a long-term optimizable and controllable GPT text generation solution. Without these "unhelpful" answers, uncontrollable effects would occur when user input is not part of the designed question, negatively impacting the user experience.

[0004] A method for constructing a long-term controllable and optimizable corpus suitable for GPT includes the following scheme:

[0005] S1. Collect open-source question-and-answer dataset pairs: Collect open-source question-and-answer dataset pairs, with questions and answers in... <sep>To distinguish them, newline characters were removed from the questions and answers. After processing, a total of 30 million question-and-answer data pairs were placed into the file ori.txt. The separator between the question and answer in each data pair is [insert separator here]. <sep>;

[0006] S2. Set all answers to unanswerable questions: In the initial state, set all answers to unanswerable questions, replace the answers of each question-answer data pair in ori.txt with unanswerable text, and put them into another file open_train.txt;

[0007] S3. Enter the long-term optimization training phase of GPT: Use the GPT question answering model to train open_train.txt. In the training set, the answer label for each question is the text of the unanswered question.

[0008] S4. Construction of a training corpus for user-customized needs: Customize your own question-and-answer dataset. The question-and-answer dataset transmits text in tabular data. A total of 20,000 question-and-answer corpora are built based on the tabular data. The similarity between the 30 million questions in train.txt and the questions in the 20,000 question-and-answer dataset is compared. All questions with a similarity threshold greater than 90% are deleted and saved to user_train.txt.

[0009] It also includes the following steps:

[0010] S5. Long-term optimizable corpus construction: Regularly update the S4 table data.

[0011] In step S2, the text for an unanswerable question is "Sorry, this question is a bit difficult, I'm still working hard to improve!"

[0012] The GPT model is one of the core technologies of ChatGPT, and reinforcement learning is used to align user intent with the target answer. The main innovation of this patent lies in proposing a method for constructing a corpus with long-term optimizable and controllable text generation. Controllable text generation is mainly reflected in the addition of a paragraph related to important information in the question to the beginning of the answer in the question-answer pair, thereby guiding the answer to the actual expected output and achieving controllable text generation. At the same time, sensitive questions are avoided in the corpus construction using methods such as "avoiding answers." Long-term optimizability is mainly reflected in the fact that users can continuously use an elimination method to eliminate relevant questions in the open-source dataset according to their needs, updating their own training corpus to complete the tasks they require. Detailed Implementation

[0013] A method for constructing a long-term controllable and optimizable corpus suitable for GPT includes the following scheme:

[0014] S1. Collect open-source question-and-answer dataset pairs: Collect open-source question-and-answer dataset pairs, with questions and answers in... <sep>To distinguish them, newline characters were removed from the questions and answers. After processing, a total of 30 million question-and-answer data pairs were placed into the file ori.txt. The separator between the question and answer in each data pair is [insert separator here]. <sep>;

[0015] S2. Set all answers to "unable to answer": In the initial state, set all answers to all questions to "unable to answer". Replace all answers in each question-and-answer data pair in ori.txt with the "unable to answer" text and put it into another file open_train.txt. The "unable to answer" text in step S2 is "Sorry, this question is a bit difficult. I am still working hard to improve!".

[0016] S3. Enter the long-term optimization training phase of GPT: Use the GPT question answering model to train open_train.txt. In the training set, the answer label for each question is the text of the unanswered question.

[0017] S4. Construction of training set corpus for user-customized needs: Customize your own question-and-answer dataset. The question-and-answer dataset transmits text in tabular data. A total of 20,000 question-and-answer corpora are built for the tabular data. The similarity between the 30 million questions in train.txt and the questions in the 20,000 question-and-answer dataset is compared. All questions with a similarity threshold greater than 90% are deleted and saved to user_train.txt.

[0018] S5. Long-term optimizable corpus construction: Regularly update the S4 table data.

[0019] The following is an explanation using real-world examples:

[0020] The GPT model is one of the core technologies of ChatGPT, and reinforcement learning is used to align user intent with the target answer. The main innovation of this patent lies in proposing a long-term optimizable and controllable corpus construction scheme for text generation. Controllable text generation is mainly reflected in adding a paragraph related to important information in the question to the beginning of the answer in the question-answer pair, thereby guiding the answer to the actual expected output, achieving controllable text generation. At the same time, sensitive questions are avoided in the corpus construction using methods such as "avoiding answers." Long-term optimizability is mainly reflected in the fact that users can continuously use elimination methods to eliminate relevant questions in the open-source dataset according to their needs, updating their own training corpus to complete the tasks they need to complete. Currently, to achieve the effect of a large-scale GPT model, the common approach is to hire a large number of dedicated annotators to annotate a large amount of task question-answering data, and then train a very large GPT model. This approach is usually labor-intensive, energy-intensive, and costly. To explore the application possibilities of GPT in different companies, this patent proposes a long-term controllable and optimizable corpus construction method suitable for GPT, focusing on the model training corpus construction.

[0021] A method for constructing a long-term controllable and optimizable corpus suitable for GPT, the scheme mainly includes:

[0022] S1. Extensive collection of open-source question-and-answer datasets: Extensive collection of open-source question-and-answer datasets, including questions and answers... <sep>To distinguish them, newline characters were removed from the questions and answers. After processing, there were a total of 30 million question-and-answer pairs, which were placed into the file ori.txt. The separator between the question and answer in each data entry is [insert separator here]. <sep>One data point occupies one row in the training set. For example, a question-and-answer data point might be "What are some good mythological novels to recommend?" <sep>My recommended mythological novel is *Investiture of the Gods*: In the novel, Nezha is sixteen feet tall, possesses great supernatural powers, and has many divine weapons and magical treasures. He wears the Qiankun Ring on his wrist, the Hun Tian Ling (a magical ribbon) around his arm, wields the Fire-Tipped Spear, and rides the Wind-Fire Wheels. After transforming into a three-headed, eight-armed being, he also wields the Nine-Dragon Divine Fire Cover and the Yin-Yang Twin Swords—so powerful! Another example is a question / answer: "How to protect yourself during a flood?" <sep>If you encounter flooding, take the following steps: Move to higher ground or a safe area as far away from the floodwaters as possible. If you cannot escape, climb onto a roof or other high place and wait for rescue. Avoid contact with floodwaters, as they may contain bacteria and harmful substances that could cause health problems.

[0023] S2. All answers are set to "unanswerable": One of the innovations of this patent is that all questions are set to "unanswerable" in the initial state. This ensures that the model will never produce outputs that pose a security or public opinion risk. The method is to replace all answers in each question-and-answer data pair in ori.txt with "Sorry, this question is a bit difficult, I'm still working hard!". For example, in the above question-and-answer data, it would be replaced with "Any good mythological novels you would recommend?" <sep>Sorry, this question is a bit too difficult, I'm still working hard to improve! This is then added to another file, open_train.txt. This operation is equivalent to marking the answer to every question in the training set with "Sorry, this question is a bit too difficult, I'm still working hard to improve!"

[0024] S3. Entering the long-term optimization training phase of GPT: The GPT question-answering model is used to train open_train.txt (this is a mature technology). In the training set, the answer label for each question is "Sorry, this question is a bit difficult, I'm still working hard to improve!". Therefore, after the model is trained, the task that the GPT model can perform is: for any question input by the user, the GPT model always outputs "Sorry, this question is a bit difficult, I'm still working hard to improve!" Such a model does not produce any practical value. However, the answers are always coherent, conveying the message that the model will continue to improve to the user.

[0025] S4. Construction of a Training Corpus for User-Customized Needs: Another innovation of this patent lies in the user-customized question-and-answer dataset. In enterprises, tabular data is a very common data structure. Users typically need to design questions they might ask or knowledge that the table can convey based on the table. Suppose the current user has the following tabular data:

[0026]

[0027] The skill that can be added to this table is "Introduction of Historical Figures," meaning the table can convey information about historical figures. A template for manually edited scripts is available. For the current table, historical figures' names are tagged as `history_person_name`, and their introductions as `history_person_dec`. Scripts for the "Introduction of Historical Figures" skill include:

[0028] 1. "Do you know history_person_name?" <sep>Okay, let me introduce history_person_name: history_person_dec".

[0029] 2. "Introduce history_person_name" <sep>Okay, let me introduce history_person_name: history_person_dec".

[0030] 3. "Could you introduce XXX?" <sep>Okay, let me introduce history_person_name: history_person_dec".

[0031] 4. "Introduce XXX" <sep>Okay, let me introduce history_person_name: history_person_dec".

[0032] 5. "Can you tell me about XXX?" <sep>Okay, let me introduce history_person_name: history_person_dec".

[0033] 6. Could you please tell me about history_person_name? <sep>Okay, let me introduce history_person_name: history_person_dec".

[0034] 7. "I'm very interested in history_person_name. Could you give me a brief introduction to it?" <sep>Okay, let me introduce history_person_name: history_person_dec".

[0035] 8. Could you tell me about the historical figure named history_person_name? <sep>Okay, let me introduce history_person_name: history_person_dec, etc. Then, replace the history_person_name in the template with all the historical figures' names in the table, and replace the history_person_dec with the historical figures' introductions in the template. This patent's proposed corpus construction scheme has two characteristics: multiple question wording options ensure the model's generalization ability, meaning it can almost always answer accurately regardless of how users ask the question; the other characteristic is the use of guiding wording in the answers, ensuring the model's controllability is improved by the guiding wording. Suppose a dataset of 20,000 question-and-answer sentences is constructed based on the above data. All questions in the 30 million questions in train.txt that are similar to those in the constructed 20,000 question-and-answer dataset, based on edit distance similarity (similarity threshold greater than 90%), are deleted. This ensures that the model's generated answers during training will not be something like, "Sorry, this question is a bit difficult, I'm still working on it!" The aforementioned 20,000 question-and-answer dataset is saved in user_train.txt. If the question-and-answer pairs from user_train.txt are directly merged into open_train.txt, they won't truly answer the questions the user wants the model to answer. First, the information related to historical figures in open_train.txt will interfere with the information the user wants to add about historical figures. To ensure each question-and-answer pair in user_train.txt is fully trained in train.txt, a question-and-answer pair from user_train.txt is randomly inserted into train.txt with a probability of 0.1 after each question-and-answer pair in train.txt. Typically, the size of train.txt will rapidly increase to over ten gigabytes. In actual training, train.txt is divided into 100 files, each containing approximately 300,000 question-and-answer pairs, and training is performed by sampling a specific file. Through this model optimization, the model will answer the desired questions based on the skills the user wants to add, while for other questions, GPT will only output "Sorry, this question is a bit difficult, I'm still working on it!" The above-mentioned solution proposed in this patent is also applicable to other tabular data. Users only need their own business tabular data to implement a controllable text generation solution by referring to the above solution. The GPT model trained using the above corpus construction scheme can only introduce the historical figures annotated by the user; for other questions, it will answer, "Sorry, this question is a bit too difficult; I'm still working on it!" In practical enterprise applications, there is usually a large amount of tabular data. Enterprises can continuously add new skills to the model according to their needs, thus realizing the construction of an enterprise's infrastructure.

[0036] S5: Long-term Optimizable Corpus Construction: Single question-and-answer skills cannot truly reflect the value of GPT. Users can continuously add new skills to GPT based on company data. Skills can be continuously developed tailored to the user's business needs, allowing GPT to truly realize the value the user wants to achieve. Aside from skills the user wants to add, GPT's output for other questions is always, "Sorry, this question is a bit difficult; I'm still working on it!" As long as the user's answer is reasonable and valuable, GPT's output will never generate information that spreads rumors, infringes copyrights, raises ethical issues, or leaks privacy.< / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep>

Claims

1. A method for constructing a long-term controllable and optimizable corpus suitable for GPT, characterized in that... The following options are included: S1. Collect open-source question-and-answer dataset pairs: Collect open-source question-and-answer dataset pairs, with questions and answers in... <sep>To distinguish them, newline characters were removed from the questions and answers. After processing, a total of 30 million question-and-answer data pairs were placed into the file ori.txt. The separator between the question and answer in each data pair is [insert separator here]. <sep> ;< / sep> < / sep> S2. Set all answers to unanswerable questions: In the initial state, set all answers to unanswerable questions, replace the answers of each question-answer data pair in ori.txt with unanswerable text, and put them into another file open_train.txt; S3. Enter the long-term optimization training phase of GPT: Use the GPT question answering model to train open_train.txt. In the training set, the answer label for each question is the text of the unanswered question. S4. Construction of a training corpus for user-customized needs: Customize your own question-and-answer dataset. The question-and-answer dataset transmits text in tabular data. A total of 20,000 question-and-answer corpora are built based on the tabular data. The similarity between the 30 million questions in open_train.txt and the questions in the 20,000 question-and-answer dataset is compared. All questions with a similarity threshold greater than 90% are deleted and saved to user_train.txt.

2. The method for constructing a long-term controllable and optimizable corpus suitable for GPT according to claim 1, characterized in that... It also includes the following steps: S5. Long-term optimizable corpus construction: Regularly update the S4 table data.

3. The method for constructing a long-term controllable and optimizable corpus suitable for GPT according to claim 1, characterized in that... In step S2, the text for an unanswerable question is "Sorry, this question is a bit difficult, I'm still working hard to improve!"