Self-learning method for enhancing story content plots
By guiding the generation and optimization of the reasoning chain of language models, the problem of existing models lacking coherence and reasoning ability in complex story creation is solved, and the story content with logical consistency and plot coherence is generated.
Patent Information
- Application Number
- CN202411965452.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Existing language generation models lack coherence and deep reasoning when dealing with complex story creation, resulting in inconsistent or difficult to understand the generated content.
By obtaining user problems and example sets with potential logical reasoning chains, combining large-scale data sets without inference annotations, the language model is guided to generate inference chains, and through reverse reasoning and iterative optimization, the logical consistency and plot consistency of the model are improved.
It realizes the generation of complex story content with logical consistency and plot coherence, and improves the performance of the language model in story creation.
Smart Images

Figure CN119886348A_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] Inputting the user's first question and the example set into the constructed original language model, and guiding the original language model to generate a first reasoning chain and a first story script;
[0008] Based on the user's first question, matching and obtaining a corresponding benchmark story script in the data set;
[0009] Extracting the key elements in the first story script as first elements, and extracting the key elements in the reference story script as second elements;
[0010] 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 data set, and update the data set. If not, provide a first preset story script as input to the original language model. The original language model forms a second reasoning chain based on the user's first question and the first preset story script through reverse reasoning. Add the user's first question, the second reasoning chain and the first preset story script to the data set, and update the data set.
[0011] Using the updated data set to adjust the original language model, and obtain an adjusted original language model;
[0012] Input the user's second question into the adjusted original language model, generate a corresponding third story script and a third reasoning chain, determine whether the third story script maintains the logical consistency and plot coherence of the generated content, if so, use the user's second question, the third reasoning chain and the third story script as the first data set, if not, provide a second preset story script to input into the adjusted original language model, the adjusted original language model is based on the user's second question and the second preset story script, reversely reasoning 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 data set;
[0013] 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.
[0014] The present invention is achieved through the following technical solutions:
[0015] This solution first obtains the user's first question, an example set and a data set, wherein the example set includes a logical reasoning chain, and the data set does not include a reasoning chain, inputs the user's first question and the example set into the original language model, and guides 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, the corresponding benchmark story script is matched in the data set, and it is determined 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, and the data set is updated; if not, a first preset story script (compared to the correct story script of the user's first question) is provided and input into the original language model, and 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, and the data set is updated;
[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, a corresponding third story script and a third reasoning chain are generated, and it is determined whether the generated third story script maintains the logical consistency and plot coherence of the generated content. 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, the 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] 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, an example set with potential logical reasoning chains consists of (a, b, c), where a represents the user question, b represents the story script generated based on the user question, and c represents the reasoning chain from the user question to the corresponding story script.
[0019] As an optional technical solution, the dataset without reasoning chain consists of (a, b), where a represents the user question and b represents the story script generated based on the user question.
[0020] As an optional technical solution, determining whether the first element is consistent with the second element includes:
[0021] By indicating the function 1(M(^y i =y i)) determines whether the first element is consistent with the second element, M is an evaluation model, ^y i is the first element, y i This is the second element.
[0022] As an optional technical solution, judging 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 and record it as the first event, and obtain the cause and effect relationship of the first event to determine whether there is a break in the cause and effect chain of the first event. If so, determine that the first event does not have the logical consistency and plot coherence of the generated content. If not, perform a second judgment on the first event.
[0024] As an optional technical solution, performing a second judgment on the first event includes:
[0025] Obtain whether the development sequence of the story plot corresponding to the first event conforms to the preset logic. If not, determine that the first event does not have the logical consistency and plot coherence of the generated content. If so, make three judgments on the first event.
[0026] As an optional technical solution, judging the first event three times includes:
[0027] Tracking the status of the character in the first event to obtain a tracking result;
[0028] 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 the logical consistency and plot coherence of the generated content; if not, determine that the first event does not have the logical consistency and plot coherence of the generated content.
[0029] As an optional technical solution, adding 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. adding all the first data sets and all the second data sets to the data set, and optimizing the original language model;
[0031] S2. Generate a new first data set and a new second data set by using the optimized original language model, add all the new first data sets and second data sets to the data set, and perform secondary optimization on the original language model;
[0032] S3. Repeat steps S1 to S2 to perform multiple iterations of optimization 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 a story content, through a given small number of example sets with logical reasoning processes, combined with a large-scale data set without reasoning annotations, guiding a language model to generate a chain of reasoning, and then the language model containing the chain of reasoning processes the user's story needs, generating a corresponding story script, and judging whether the generated story script has logical consistency and plot coherence, if so, directly outputting the corresponding story script, if not, providing a correct story plot to guide the original language model, regenerating a story script with logical consistency and plot coherence, and finally through the output of the story script with logical consistency and plot coherence, the language model is continuously iterated and optimized to improve the reasoning ability of the model. The method of the present invention can not only be used to generate complex storyline scripts, but also can maintain the logical consistency and plot coherence of the generated storyline script, thereby improving the performance of the original language model in story creation.
[0035] The present invention gradually guides the language model to generate a reasoning chain by giving a small number of example sets with potential logical reasoning processes and combining them with a large-scale dataset without reasoning annotations. That is, it guides the language model to generate a reasonable reasoning process and a complete story script according to user needs 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 needs in the dataset, a benchmark story script will be provided, and reverse reasoning will be performed to generate a reasoning chain in combination with user needs, and the language model will be fine-tuned 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, constitute a part of the present invention, and do not constitute a limitation on the embodiments of the present invention;
[0037] Figure 1 It is a flowchart of a self-learning method for enhancing story content and plot in the present invention. DETAILED DESCRIPTION
[0038] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0039] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those within the scope of this description. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0040] Example
[0041] Please refer to Figure 1 , Figure 1 The present invention is a flow chart of a self-learning method for enhancing the content and plot of a story, the method comprising the following steps:
[0042] Obtain the user's first question, an example set with potential logical reasoning chains, and a data set without reasoning chains;
[0043] Inputting the user's first question and the example set into the constructed original language model, and guiding the original language model to generate a first reasoning chain and a first story script;
[0044] Based on the user's first question, matching and obtaining a corresponding benchmark story script in the data set;
[0045] Extracting the key elements in the first story script as first elements, and extracting the key elements in the reference story script as second elements;
[0046] 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 data set, and update the data set. If not, provide a first preset story script as input to the original language model. The original language model forms a second reasoning chain based on the user's first question and the first preset story script through reverse reasoning. Add the user's first question, the second reasoning chain and the first preset story script to the data set, and update the data set.
[0047] Using the updated data set to adjust the original language model, and obtain an adjusted original language model;
[0048] Input the user's second question into the adjusted original language model, generate a corresponding third story script and a third reasoning chain, determine whether the third story script maintains the logical consistency and plot coherence of the generated content, if so, use the user's second question, the third reasoning chain and the third story script as the first data set, if not, provide a second preset story script to input into the adjusted original language model, the adjusted original language model is based on the user's second question and the second preset story script, reversely reasoning 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 data set;
[0049] 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.
[0050] The specific embodiments of the present invention are as follows:
[0051] Perform latent logic reasoning using a small set of examples with latent logic reasoning chains:
[0052] Obtain the user's first question, an example set with potential logical reasoning chains, and a data set without reasoning chains;
[0053] The example set consists of (a, b, c), where a represents the user question, b represents the story script generated based on the user question, and c represents the reasoning chain from the user question to the corresponding story script; the data set consists of (a, b), where a represents the user question, and b represents the story script generated based on the user question;
[0054] Inputting the user's first question and the example set into the constructed original language model, and guiding the original language model to generate a first reasoning chain and a first story script;
[0055] Based on the user's first question, matching and obtaining a corresponding benchmark story script in the data set;
[0056] Extracting the key elements in the first story script as first elements, and extracting the key elements in the reference story script as 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 data set, and update the data set. If not, provide a first preset story script as input to the original language model. The original language model forms a second reasoning chain based on the user's first question and the first preset story script through reverse reasoning. Add the user's first question, the second reasoning chain and the first preset story script to the data set, and update the data set.
[0058] Further, determining whether the first element is consistent with the second element includes:
[0059] By indicating the function 1(M(^y i =y i )) determines whether the first element is consistent with the second element, M is an evaluation model, ^y i is the first element, y i This is the second element.
[0060] Multiple iterations improve the model’s reasoning capabilities:
[0061] Using the updated data set to adjust the original language model, and obtain an adjusted original language model;
[0062] Input the user's second question into the adjusted original language model, generate a corresponding third story script and a third reasoning chain, determine whether the third story script maintains the logical consistency and plot coherence of the generated content, if so, use the user's second question, the third reasoning chain and the third story script as the first data set, if not, provide a second preset story script to input into the adjusted original language model, the adjusted original language model is based on the user's second question and the second preset story script, reversely reasoning 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 data set;
[0063] 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.
[0064] Furthermore, judging whether the logical consistency and plot coherence of the generated content are maintained in all data sets includes:
[0065] Obtaining a corresponding event in the third story script as a first event, and obtaining a causal relationship of the first event, determining whether the first event has a causal chain break, and if so, determining that the first event does not have the logical consistency and plot coherence of the generated content, and if not, performing a secondary judgment on the first event;
[0066] The second judgment on the first event includes:
[0067] Obtaining whether the development sequence of the story plot corresponding to the first event conforms to the preset logic; if not, determining that the first event does not have the logical consistency and plot coherence of the generated content; if so, performing three judgments on the first event;
[0068] The three judgments on the first event include:
[0069] Tracking the status 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 the logical consistency and plot coherence of the generated content; if not, determine that the first event does not have the logical consistency and plot coherence of the generated content.
[0071] Among them, this embodiment provides a method for judging the logical consistency and plot coherence of the story content, specifically: causal relationship detection, by analyzing the causal relationship between events, judging whether there is a break in the causal chain of the event, for example, if the result of an event depends on the previous event, but there is a lack of reasonable causal relationship in the middle, then it is judged to be a logical error; timeline analysis, checking whether the development sequence of the event storyline is logical, such as whether the behavior of the character is in chronological order, 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 wearing items, etc.) to ensure consistency in the storyline of the entire event. Only when the generated story content undergoes causal relationship detection, timeline analysis, and character state tracking at the same time, and the results are all in accordance, is it judged that the generated story content has logical consistency and plot coherence.
[0072] Further, adding 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. adding all the first data sets and all the second data sets to the data set, and optimizing the original language model;
[0074] S2. Generate a new first data set and a new second data set by using the optimized original language model, add all the new first data sets and second data sets to the data set, and perform secondary optimization on the original language model;
[0075] S3. Repeat steps S1 to S2 to perform multiple iterations of optimization on the original language model.
[0076] Among them, this embodiment improves the reasoning ability of the original language model through multiple iterations (if the current language model is continuously iterated, it is easy to cause overfitting of the language model). In each iteration, the reasoning ability of the current language model is first used to generate a new high-quality data set, and then based on the new high-quality data set, the current language model is fine-tuned to improve the overall performance of the language model. In this way, the language model will gradually learn how to perform high-quality reasoning, thereby generating a more coherent and logically reasonable plot in subsequent story creation.
[0077] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall 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 equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A self-learning method for enhancing story content and plot, characterized in that: The method comprises the following steps: Obtain the user's first question, an example set with potential logical reasoning chains, and a data set without reasoning chains; Inputting the user's first question and the example set into the constructed original language model, and guiding the original language model to generate a first reasoning chain and a first story script; Based on the user's first question, matching and obtaining a corresponding benchmark story script in the data set; Extracting the key elements in the first story script as first elements, and extracting the key elements in the reference story script as second elements; 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 data set, and update the data set. If not, provide a first preset story script as input to the original language model. The original language model forms a second reasoning chain based on the user's first question and the first preset story script through reverse reasoning. Add the user's first question, the second reasoning chain and the first preset story script to the data set, and update the data set. Using the updated data set to adjust the original language model, and obtain an adjusted original language model; Input the user's second question into the adjusted original language model, generate a corresponding third story script and a third reasoning chain, determine whether the third story script maintains the logical consistency and plot coherence of the generated content, if so, use the user's second question, the third reasoning chain and the third story script as the first data set, if not, provide a second preset story script to input into the adjusted original language model, the adjusted original language model is based on the user's second question and the second preset story script, reversely reasoning 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 data set; 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.
2. A self-learning method for enhancing story content and plot according to claim 1, characterized in that: The example set with potential logical reasoning chains consists of (a, b, c), where a represents the user question, b represents the story script generated based on the user question, and c represents the reasoning chain from the user question to the corresponding story script.
3. A self-learning method for enhancing story content and plot according to claim 1, characterized in that: The dataset without reasoning chain consists of (a, b), where a represents the user question and b represents the story script generated based on the user question.
4. A self-learning method for enhancing story content and plot according to claim 1, characterized in that: Determining whether the first element is consistent with the second element includes: By indicating the function 1(M(^y i =y i )) determines whether the first element is consistent with the second element, M is an evaluation model, ^y i is the first element, y i is the second element.
5. A self-learning method for enhancing story content and plot according to claim 1, characterized in that: Determining whether the third story script maintains the logical consistency and plot coherence of the generated content includes: Obtain the corresponding event in the third story script and record it as the first event, and obtain the cause and effect relationship of the first event to determine whether there is a break in the cause and effect chain of the first event. If so, determine that the first event does not have the logical consistency and plot coherence of the generated content. If not, perform a second judgment on the first event.
6. A self-learning method for enhancing story content and plot according to claim 5, characterized in that: The second judgment on the first event includes: Obtain whether the development sequence of the story plot corresponding to the first event conforms to the preset logic. If not, determine that the first event does not have the logical consistency and plot coherence of the generated content. If so, make three judgments on the first event.
7. A self-learning method for enhancing story content and plot according to claim 6, characterized in that: The three judgments on the first event include: Tracking the status of the character in the first event to obtain a tracking result; 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 the logical consistency and plot coherence of the generated content; if not, determine that the first event does not have the logical consistency and plot coherence of the generated content.
8. A self-learning method for enhancing story content and plot according to claim 1, characterized in that: Adding 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: S1. adding all the first data sets and all the second data sets to the data set, and optimizing the original language model; S2. Generate a new first data set and a new second data set by using the optimized original language model, 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 to S2 to perform multiple iterations of optimization on the original language model.
Citation Information
Patent Citations
Text adaptation method and apparatus
CN108986785A
Language model role playing-based long script automatic generation method
CN118394926A
Event-driven story generation method and system based on three-curtain structure thinking chain and semantic self-consistency
CN118939795A
Method, apparatus and program for artificial intelligence-based story creation support service
KR102640438B1