A self-learning method for enhancing the plot of story content
By guiding the generation of language models and evaluating iterative optimization of logical consistency and plot coherence, the logic and coherence problems of existing models in complex story generation are solved, and the quality of story creation is improved.
Patent Information
- Application Number
- CN202411965452.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The existing language generation model lacks logic and coherence when generating complex stories, the characters' motivations are unclear, emotional turning points are unnatural, and long-term context memory, resulting in inconsistent content of the generated stories.
By obtaining a small set of examples with potential logical reasoning chains and large-scale data sets without inference annotations, the language model is guided to generate inference chains, and iteratively optimized by evaluating the consistency and logical consistency of key elements to generate logically consistent and plot-coherent story scripts.
It improves the logical consistency and plot coherence of the language model in story creation, improves the model's reasoning ability, and generates more profound and resonant story content.
Smart Images

Figure CN119886348B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a self-learning method for enhancing story content and plot. Background Art
[0002] In the field of natural language processing, language models have made significant progress in text generation and understanding. However, existing language generation models often lack coherence and deep reasoning capabilities when dealing with complex story creation. Especially in stories that require complex causal relationships and plot logic, the generated content may be inconsistent or difficult to understand, which is specifically manifested in the following deficiencies:
[0003] Lack of logic and coherence: Existing story generation models often cannot guarantee the logic and coherence of the plot, and the generated plots are prone to inconsistencies in causality and event sequence; Unclear character motivations: In complex story creation, the character's behavior and motivation need to be logically reasonable and consistent, however, the character behavior generated by existing models often lacks clear motivations, resulting in the character's behavior appearing abrupt, making it impossible for readers to understand the character's intentions, making the entire story lack depth and difficult to resonate; Emotional transitions lack natural transitions: In story creation, emotional changes and transitions need to be reasonable and natural, but existing language models find it difficult to capture these microsecond changes, resulting in abrupt emotional transitions and a lack of natural transitions; Lack of long-term contextual memory: When dealing with longer stories, existing generative models tend to forget previously generated content, resulting in inconsistencies in the story's plots.
[0004] In view of the above-mentioned shortcomings, traditional improvement methods usually rely on large-scale manually annotated datasets or use few-shot learning methods, but these methods have problems such as high data acquisition costs and unstable generation quality. Manually annotated datasets require a lot of manpower and it is difficult to cover all possible plot developments. Few-shot learning methods lack sufficient contextual information and are difficult to generate coherent story content. Therefore, a new mechanism is urgently needed to help language models gradually learn how to generate logical reasoning processes, thereby improving their performance in story creation. Summary of the invention
[0005] In order to solve the above-mentioned deficiencies in the prior art, the present invention provides a self-learning method for enhancing the content and plot of a story, the method comprising the following steps:
[0006] Obtain the user's first question, an example set with potential logical reasoning chains, and a data set without reasoning chains;
[0007] Input the user's first question and the example set into the constructed original language model to guide the original language model to generate the first inference chain and the first story script;
[0008] Based on the user's first question, match the corresponding benchmark story script in the data set;
[0009] Extract the key elements in the first story script as the first elements, and the key elements in the benchmark story script as the second elements;
[0010] Judge whether the first elements and the second elements are consistent. If so, add the user's first question, the first inference chain and the first story script to the data set to update the data set. If not, provide the first preset story script to the original language model. The original language model forms a second inference chain by reverse inference based on the user's first question and the first preset story script, and add the user's first question, the second inference chain and the first preset story script to the data set to update the data set;
[0011] Adjust the original language model using the updated data set and obtain the adjusted original language model;
[0012] Input the user's second question into the adjusted original language model to generate the corresponding third story script and the third inference chain. Judge whether the generated content in the third story script maintains logical consistency and plot coherence. If so, use the user's second question, the third inference chain and the third story script as the first data set. If not, provide the second preset story script to the adjusted original language model. The adjusted original language model forms a fourth inference chain by reverse inference based on the user's second question and the second preset story script, and use the user's second question, the fourth inference chain and the second preset story script as the second data set;
[0013] Add both the first data set and the second data set to the data set, and perform iterative optimization on the original language model based on the latest data set.
[0014] The present invention is realized through the following technical solutions:
[0015] This solution first obtains the user's first question, an example set, and a data set. The example set includes logical reasoning chains, and the data set does not contain reasoning chains. The user's first question and the example set are input into the original language model to guide the original language model to generate a first reasoning chain and a first story script corresponding to the user's first question; based on the user's first question, a corresponding benchmark story script is matched in the data set, and it is judged whether the key elements in the first story script and the benchmark story script are consistent. If so, the user's first question, the first reasoning chain, and the first story script are added to the data set to update the data set; if not, a first preset story script (the correct story script compared to the user's first question) is provided and input into the original language model. Then, the original language model performs reverse reasoning based on the first preset story script and the user's first question to form a second reasoning chain, and the user's first question, the second reasoning chain, and the first preset story script are added to the data set to update the data set;
[0016] Using the updated data set, the original language model is adjusted, and the adjusted original language model is obtained; the user's second question is input into the adjusted original language model to generate a corresponding third story script and a third reasoning chain, and it is judged whether the generated content in the third story script maintains logical consistency and plot coherence. If so, the user's second question, the third reasoning chain, and the third story script are used as the first data set. If not, a second preset story script is provided and input into the adjusted original language model. The adjusted original language model performs reverse reasoning based on the user's second question and the second preset story script to form a fourth reasoning chain, and the user's second question, the fourth reasoning chain, and the second preset story script are used as the second data set;
[0017] Both the first data set and the second data set are added to the data set, and the original language model is iteratively optimized based on the latest data set each time.
[0018] As an optional technical solution, the example set with potential logical reasoning chains consists of (a, b, c). a represents the user's question, b represents the story script generated based on the user's question, and c represents the reasoning chain from the user's question to the generated corresponding story script.
[0019] As an optional technical solution, the data set without reasoning chains consists of (a, b). a represents the user's question, and b represents the story script generated based on the user's question.
[0020] As an optional technical solution, judging whether the first element and the second element are consistent includes:
[0021] Through the indicator function 1(M(^y i =y i)) Determine whether the first element is consistent with the second element. M is an evaluation model, and ^y i is the first element, and y i is the second element.
[0022] As an optional technical solution, determining whether the logical consistency and plot coherence of the generated content are maintained in all data sets includes:
[0023] Obtain the corresponding event in the third story script as the first event, and obtain the causal relationship of the first event. Determine whether there is a break in the causal chain of the first event. If so, determine that the first event does not have logical consistency and plot coherence in the generated content. If not, perform a secondary judgment on the first event.
[0024] As an optional technical solution, performing a secondary judgment on the first event includes:
[0025] Obtain whether the development order of the plot corresponding to the first event conforms to the preset logic. If not, determine that the first event does not have logical consistency and plot coherence in the generated content. If so, perform a third judgment on the first event.
[0026] As an optional technical solution, performing a third judgment on the first event includes:
[0027] Track the status of the character in the first event to obtain a tracking result;
[0028] Based on the tracking result, determine whether the status of the character remains consistent throughout the first event. If so, determine that the first event has logical consistency and plot coherence in the generated content. If not, determine that the first event does not have logical consistency and plot coherence in the generated content.
[0029] As an optional technical solution, adding both the first data set and the second data set to the data set and iteratively optimizing the original language model based on the latest data set includes:
[0030] S1. Add all the first data sets and all the second data sets to the data set and optimize the original language model;
[0031] S2. Use the optimized original language model to generate new first data sets and second data sets. Add all the new first data sets and second data sets to the data set and perform a secondary optimization on the original language model;
[0032] S3. Repeat steps S1 - S2 to perform multiple iterative optimizations on the original language model.
[0033] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:
[0034] The present invention discloses a self-learning method for enhancing the plot of story content. Through a given small set of examples with logical reasoning processes, combined with a large-scale dataset without reasoning annotations, the language model is guided to generate an inference chain. Then, the language model containing the inference chain processes the user's story requirements to generate a corresponding story script, and determines whether the generated story script has logical consistency and plot coherence. If so, the corresponding story script is directly output. If not, the correct story plot is provided to guide the original language model to regenerate a story script with logical consistency and plot coherence. Finally, through the output story script with logical consistency and plot coherence, the language model is continuously iteratively optimized to improve the inference ability of the model. The method of the present invention can not only be used to generate complex story plot scripts, but also maintain the logical consistency and plot coherence of the generated story plot scripts, thereby improving the performance of the original language model in story creation.
[0035] The present invention gradually guides the language model to generate an inference chain through a given small set of examples with potential logical reasoning processes, combined with a large-scale dataset without reasoning annotations, that is, guides the language model to generate a reasonable inference process and a complete story script according to user requirements on the dataset without reasoning annotations, and evaluates the generated complete story script. If the story script generated by the model is inconsistent with the key elements of the benchmark story corresponding to the user requirements in the dataset, the benchmark story script will be provided, and combined with the user requirements, an inverse inference will be performed to generate an inference chain to fine-tune the language model, so as to help the language model better understand the logical consistency and plot coherence of the story script. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, form a part of the present invention, and do not constitute a limitation to the embodiments of the present invention;
[0037] Figure 1 It is a schematic flowchart of a self-learning method for enhancing the plot of story content in the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0038] In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be further described in detail below with reference to the drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.
[0039] In the following description, many specific details are set forth in order to provide a thorough understanding of the present invention. However, the present invention may be practiced in other ways than those described within the scope hereof. Accordingly, the scope of the present invention is not limited by the specific embodiments disclosed below.
[0040] Embodiment
[0041] Please refer to Figure 1 , Figure 1 , which is a schematic flow diagram of a self - learning method for enhancing the plot of a story content in the present invention. The method includes the following steps:
[0042] Obtain the user's first question, a set of examples with potential logical inference chains, and a data set without inference chains;
[0043] Input the user's first question and the set of examples into the constructed original language model to guide the original language model to generate a first inference chain and a first story script;
[0044] Based on the user's first question, match the corresponding benchmark story script in the data set;
[0045] Extract the key elements in the first story script as the first elements, and the key elements in the benchmark story script as the second elements;
[0046] Judge whether the first elements and the second elements are consistent. If so, add the user's first question, the first inference chain, and the first story script to the data set to update the data set. If not, provide a first preset story script and input it into the original language model. The original language model performs reverse inference based on the user's first question and the first preset story script to form a second inference chain, and add the user's first question, the second inference chain, and the first preset story script to the data set to update the data set;
[0047] Adjust the original language model using the updated data set and obtain the adjusted original language model;
[0048] Input the user's second question into the adjusted original language model to generate the corresponding third story script and the third reasoning chain, and determine whether the logic consistency and plot coherence of the generated content are maintained in the third story script. If so, use the user's second question, the third reasoning chain, and the third story script as the first dataset. If not, provide the second preset story script to the adjusted original language model. The adjusted original language model forms the fourth reasoning chain based on the user's second question and the second preset story script, and uses the user's second question, the fourth reasoning chain, and the second preset story script as the second dataset;
[0049] Add both the first dataset and the second dataset to the dataset, and perform iterative optimization on the original language model based on the latest dataset.
[0050] The specific embodiments of the present invention are as follows:
[0051] Perform potential logical reasoning using a small example set with potential logical reasoning chains:
[0052] Obtain the user's first question, the example set with potential logical reasoning chains, and the dataset without reasoning chains;
[0053] Among them, the example set consists of (a, b, c), where a represents the user's question, b represents the story script generated based on the user's question, and c represents the reasoning chain from the user's question to the generated corresponding story script; the dataset consists of (a, b), where a represents the user's question and b represents the story script generated based on the user's question;
[0054] Input the user's first question and the example set into the constructed original language model to guide the original language model to generate the first reasoning chain and the first story script;
[0055] Based on the user's first question, match the corresponding benchmark story script in the dataset;
[0056] Extract the key elements in the first story script as the first elements, and the key elements in the benchmark story script as the second elements;
[0057] Determine whether the first element and the second element are consistent. If so, add the user's first question, the first reasoning chain, and the first story script to the dataset and update the dataset. If not, provide the first preset story script to the original language model. The original language model forms a second reasoning chain by reverse reasoning based on the user's first question and the first preset story script, and adds the user's first question, the second reasoning chain, and the first preset story script to the dataset and updates the dataset;
[0058] Further, determining whether the first element and the second element are consistent includes:
[0059] Determine whether the first element and the second element are consistent through the indicator function 1(M(^y i =y i ))), where M is the evaluation model, ^y i is the first element, and y i is the second element.
[0060] Iteratively improve the reasoning ability of the model multiple times:
[0061] Adjust the original language model using the updated dataset and obtain the adjusted original language model;
[0062] Input the user's second question into the adjusted original language model to generate the corresponding third story script and third reasoning chain. Determine whether the generated content in the third story script maintains logical consistency and plot coherence. If so, use the user's second question, the third reasoning chain, and the third story script as the first dataset. If not, provide the second preset story script to the adjusted original language model. The adjusted original language model forms a fourth reasoning chain by reverse reasoning based on the user's second question and the second preset story script, and use the user's second question, the fourth reasoning chain, and the second preset story script as the second dataset;
[0063] Add both the first dataset and the second dataset to the dataset, and iteratively optimize the original language model based on the latest dataset.
[0064] Further, determining whether the generated content in all datasets maintains logical consistency and plot coherence includes:
[0065] Obtain the corresponding event in the third story script, denoted as the first event, and obtain the causal relationship of the first event. Determine whether there is a break in the causal chain of the first event. If so, determine that the first event does not have logical consistency and plot coherence in generating content. If not, perform a secondary judgment on the first event;
[0066] Performing a secondary judgment on the first event includes:
[0067] Obtain whether the development order of the corresponding plot of the first event conforms to the preset logic. If not, determine that the first event does not have logical consistency and plot coherence in generating content. If so, perform a third judgment on the first event;
[0068] Performing a third judgment on the first event includes:
[0069] Track the state of the character in the first event to obtain a tracking result;
[0070] Based on the tracking result, determine whether the state of the character remains consistent throughout the first event. If so, determine that the first event has logical consistency and plot coherence in generating content. If not, determine that the first event does not have logical consistency and plot coherence in generating content.
[0071] Among them, this embodiment provides a method for judging the logical consistency and plot coherence of story content, specifically: causal relationship detection, by analyzing the causal relationship between events, judging whether there is a break in the causal chain of events. For example, if the result of an event depends on a previous event but lacks a reasonable causal connection in the middle, it is determined that there is a logical error; timeline analysis, checking whether the development order of the event plot conforms to logic. For example, whether the actions of the character conform to the chronological order and whether there is a situation where the character suddenly appears or disappears; character state tracking, tracking the state of the character (such as position, emotion, and worn items, etc.) to ensure consistency throughout the plot of the event. Only when the generated story content passes causal relationship detection, timeline analysis, and character state tracking at the same time and the results are all in line, it is determined that the generated story content has logical consistency and plot coherence.
[0072] Further, adding both the first data set and the second data set to the data set, and iteratively optimizing the original language model based on the latest data set includes:
[0073] S1. Add all the first data sets and all the second data sets to the data set and optimize the original language model;
[0074] S2. Use the optimized original language model to generate new first and second datasets, add all the new first and second datasets to the dataset, and perform secondary optimization on the original language model;
[0075] S3. Repeat steps S1 - S2 to perform multiple iterative optimizations on the original language model.
[0076] Among them, in this embodiment, the inference ability of the original language model is improved through multiple iterations (if the current language model is continuously iterated, it is easy to cause overfitting of the language model). In each iteration, first, use the inference ability of the current language model to generate a new high-quality dataset, and then fine-tune the current language model based on the new high-quality dataset, so as to improve the overall performance of the language model. Through this method, the language model will gradually learn how to perform high-quality inferences, so as to generate more coherent and logically reasonable plots in subsequent story creation.
[0077] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the appended claims are intended to be construed as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0078] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.
Claims
1. A self-learning method for enhancing the plot of story content, characterized in that, The method includes the following steps: Obtain the user's first question, a set of examples with potential logical reasoning chains, and a dataset without reasoning chains; Input the user's first question and the set of examples into the constructed original language model to guide the original language model to generate a first reasoning chain and a first story script; Based on the user's first question, match the corresponding benchmark story script in the dataset; Extract the key elements in the first story script as the first elements, and the key elements in the benchmark story script as the second elements; Judge whether the first elements and the second elements are consistent. If so, add the user's first question, the first reasoning chain, and the first story script to the dataset to update the dataset. If not, provide a first preset story script and input it into the original language model. The original language model performs reverse reasoning based on the user's first question and the first preset story script to form a second reasoning chain, and add the user's first question, the second reasoning chain, and the first preset story script to the dataset to update the dataset; Adjust the original language model using the updated dataset and obtain the adjusted original language model; Input the user's second question into the adjusted original language model to generate a corresponding third story script and a third reasoning chain. Judge whether the generated content in the third story script maintains logical consistency and plot coherence. If so, use the user's second question, the third reasoning chain, and the third story script as the first dataset. If not, provide a second preset story script and input it into the adjusted original language model. The adjusted original language model performs reverse reasoning based on the user's second question and the second preset story script to form a fourth reasoning chain, and use the user's second question, the fourth reasoning chain, and the second preset story script as the second dataset; Add both the first dataset and the second dataset to the dataset, and perform iterative optimization on the original language model based on the latest dataset.
2. The self - learning method for enhancing the plot of a story content according to claim 1, characterized in that, The set of examples with potential logical reasoning chains consists of (a, b, c), where a represents the user's question, b represents the story script generated based on the user's question, and c represents the reasoning chain from the user's question to the generated corresponding story script.
3. A self-learning method for enhancing the plot of a story content according to claim 1, characterized in that, The dataset without reasoning chains consists of (a, b), where a represents the user's question and b represents the story script generated based on the user's question.
4. A self-learning method for enhancing the plot of a story content according to claim 1, characterized in that, Judging whether the first elements and the second elements are consistent includes: By using the indicator function 1(M(^y i = y i )) to determine whether the first element is consistent with the second element, where M is an evaluation model, ^y i is the first element, and y i is the second element.
5. A self-learning method for enhancing the plot of a story content according to claim 1, characterized in that, Judging whether the generated content in the third story script maintains logical consistency and plot coherence includes: Obtain the corresponding event in the third story script as the first event, and obtain the causal relationship of the first event. Judge whether there is a break in the causal chain of the first event. If so, determine that the first event does not have logical consistency and plot coherence in the generated content. If not, perform a secondary judgment on the first event.
6. A self-learning method for enhancing the plot of a story content according to claim 5, characterized in that, Performing a secondary judgment on the first event includes: Obtain whether the development sequence of the plot corresponding to the first event conforms to the preset logic. If not, determine that the first event does not have logical consistency and plot coherence in generating content. If so, make three judgments on the first event.
7. A self-learning method for enhancing the plot of a story content according to claim 6, characterized in that, Making three judgments on the first event includes: Track the status of the character in the first event to obtain a tracking result; Based on the tracking result, determine whether the status of the character remains consistent throughout the first event. If so, determine that the first event has logical consistency and plot coherence in generating content. If not, determine that the first event does not have logical consistency and plot coherence in generating content.
8. A self-learning method for enhancing the plot of a story content according to claim 1, characterized in that, Add both the first data set and the second data set to the data set. Based on the latest data set, the iterative optimization of the original language model includes: S1. Add all the first data sets and all the second data sets to the data set and optimize the original language model; S2. Use the optimized original language model to generate new first data sets and second data sets. Add all the new first data sets and second data sets to the data set and perform secondary optimization on the original language model; S3. Repeat steps S1 - S2 to perform multiple iterative optimizations on the original language model.
Citation Information
Patent Citations
Text adaptation method and apparatus
CN108986785A
Method, apparatus and program for artificial intelligence-based story creation support service
KR102640438B1