Event-driven story generation method and system based on three-curtain structure thinking chain and semantic self-consistency

Through the three-act structural thinking chain and semantic self-consistent method, the relevance and coherence of large-scale language models in event-driven story generation is optimized, the problem of insufficient correlation and coherence of generated stories is solved, and the story quality is significantly improved.

CN118939795APending Publication Date: 2024-11-12KUNMING UNIV OF SCI & TECH

Patent Information

Application Number
CN202411123440.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

Large-scale language models face the problem of insufficient relevance and coherence of generated stories in event-driven story generation tasks, and it is difficult to generate high-quality text with clear logical frameworks.

Method used

Using an event-driven story generation method based on three-act structure thinking chain and semantic self-consistent semantics, by downloading ROCStories and MTG datasets, using multi-language pre-trained language models to generate semantic vectors, clustering algorithms optimize sample data, and constructing three-act structure thinking chains Template, combining the input story-led background and event sequence to generate candidate stories, and filter out texts with the highest coherence and correlation through semantic self-consistent methods.

Benefits of technology

The quality of story text generated by large-scale language models is significantly improved, the logical reasoning ability and narrative structure of the story is improved, ensuring that the generated story is highly correlated with the dominant background and event sequence, and enhancing the coherence and relevance of the text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939795A_ABST
    Figure CN118939795A_ABST
Patent Text Reader

Abstract

The invention discloses an event-driven story generation method and system based on a three-screen structure thinking chain and semantic self-consistency, and relates to the field of natural language processing. According to the invention, before the story is generated, the examples are optimized. A clustering algorithm is adopted to select story text examples which have various types and can reflect a task domain from the data set, so that a large-scale language model can learn writing modes of different types of stories; when a story is generated, the story is divided into three stages of starting, conflicting and ending, the idea of a thinking chain prompt technology is introduced, and a three-curtain structure thinking chain template is constructed; after a story is generated, a semantic self-consistent method is provided, firstly, a model is required to generate a plurality of different story texts, a story text cluster with the most self-consistent semantics is screened out from the story texts by utilizing a clustering algorithm, and then the story text with the highest score is selected as a final answer according to the consistency and correlation score of each story text. According to the method provided by the invention, an ideal result is achieved on the ROCStories data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention discloses an event-driven story generation method and system based on a three-act structure thinking chain and semantic self-consistency, and relates to the technical field of natural language processing. Background Art

[0002] Event-driven story generation refers to letting the model generate the content of the story based on the dominant background of the story and the preset event sequence. Unlike traditional story generation tasks, event-driven story generation not only requires the algorithm model to understand the dominant background and generate a natural, coherent, and common-sense story, but also requires each plot to unfold according to predetermined events. Event-driven story generation has a wide range of application scenarios in news writing, literary creation, and other fields.

[0003] In recent years, the use of large-scale language models and prompt learning has become a new paradigm for generative tasks. Contextual learning based on a few sample examples can effectively help large models adapt to different tasks. However, even if a certain number of contextual examples are provided to the model, the event-driven story generation task still faces the problem of insufficient relevance and coherence of the generated stories. Therefore, how to make the stories generated by the large model have a clear logical framework and improve the quality of the story texts generated by the large model is the core task of the present invention. Summary of the invention

[0004] In view of the above problems, the purpose of the present invention is to provide an event-driven story generation method and system based on a three-act structure thinking chain and semantic self-consistency, thereby improving the quality of story texts generated by large-scale language models.

[0005] The technical solution of the present invention is: in the first aspect, the present invention provides an event-driven story generation method based on a three-act structure thinking chain and semantic self-consistency, comprising the following steps:

[0006] Step 1. Download the ROCStories dataset, which contains 98,158 samples, each of which is a 5-sentence common sense story. At the same time, download the MTG dataset, which is a dataset for training and evaluating multilingual text generation. It contains story generation data in five languages ​​(English, German, French, Spanish, and Chinese).

[0007] Step 2: Use a multilingual pre-trained language model to represent the story text and generate corresponding semantic vectors. Then, use a clustering algorithm to classify these semantic vectors and select the text closest to the cluster center from each cluster as an example to prompt the large-scale language model.

[0008] Step 3. Use the three-act structure thought chain template to convert the selected sample text into a thought chain prompt, splice it with the input story dominant background and event sequence, and input it into the large-scale language model to generate multiple candidate story texts.

[0009] Step 4: Apply the semantic self-consistency method to screen the candidate story texts generated by the large-scale language model and select the story text with the best quality.

[0010] As a preferred embodiment of the present invention, the Step 1 comprises:

[0011] Step 1.1. Download the public ROCStories and MTG datasets from the Internet.

[0012] Step 1.2: Use Spacy to process the dataset and extract the first sentence of each story as the dominant background of the story. Perform dependency syntactic analysis on the last four sentences of the story and extract a verb phrase from each sentence as the event of the story.

[0013] As a preferred embodiment of the present invention, the Step 2 comprises:

[0014] Step 2.1. Use the multilingual pre-trained language model Sentence-BERT to encode each story text in the dataset into a vector representation.

[0015] Step 2.2, Definition A collection of examples to prompt large-scale language model adaptation tasks, where They represent the dominant background, event sequence, and corresponding story text of the nth example in the example set D. The text vectors are processed using the k-means clustering algorithm to divide them into |D| clusters.

[0016] Step 2.3: For each text vector in each cluster, calculate the distance between them and the cluster center, and select the text that is closest to the cluster center. Add the dominant background, event sequence, and story text corresponding to the text vector to the example set D.

[0017] As a preferred embodiment of the present invention, the Step 3 comprises:

[0018] Step 3.1. Build a thought chain template and refer to the three-act structure model to divide the story generation process into three acts, namely the beginning (Act 1), conflict (Act 2) and ending (Act 3).

[0019] Step 3.2: Given the dominant background of the nth example in the example set D and sequence of events Divide the event sequence into three acts according to the ratio of 1:2:1, namely the events constitute the beginning of the story, the events and constitute the conflict of the story, and the events constitute the ending of the story. Among them, denotes the j-th event of

[0020] Step3.3. Use chain-of-thought prompting to let the large language model generate a candidate story set where denotes the m-th generation result of the large model.

[0021] As a preferred solution of the present invention, the said Step4 includes:

[0022] Step4.1. Use Sentence-BERT to calculate the semantic vectors of each story in the candidate story set C and its corresponding dominant background L and event sequence E.

[0023] Step4.2. Use the hierarchical clustering algorithm to process the story vectors of the candidate story set C, and divide the set C into p clusters, namely R = {C1, C2, …, C p}.

[0024] Step4.3. Count the number of elements in each cluster, and select the cluster with the most elements (assuming its number is q, q < p), where denotes q the t-th story in the cluster C

[0025] Step4.4. For each story q in the cluster C use Sentence-BERT to encode each sentence in into a semantic vector, calculate the cosine similarity between each adjacent sentence, and take the mean of these cosine similarities as the coherence score of the story. At the same time, calculate the cosine similarity between and the dominant background L and the event sequence E as the relevance score of the story. The specific formulas are as follows:

[0026]

[0027] Among them, sim k represents the cosine similarity between the kth sentence and the previous sentence, represents the cosine similarity score between the k-th sentence and the dominant background L and event sequence E, Representing the story The coherence score, Representing the story The relevance score.

[0028] Step 4.5: Combine the coherence score and relevance score, and select the story text with the highest comprehensive score from the cluster as the final answer. The calculation formula for the comprehensive score is as follows:

[0029]

[0030] Finally, choose the story text with the highest score:

[0031]

[0032] in, Representing the story The comprehensive score of λ is an adjustable proportional parameter, and λ is set to 0.5 in the present invention.

[0033] In a second aspect, the present invention provides an event-driven story generation system based on a three-act structure thinking chain and semantic self-consistency, including a module for executing the method described in the first aspect above.

[0034] Beneficial effects of the present invention:

[0035] The present invention proposes an event-driven story generation method based on a three-act structure thinking chain and semantic self-consistency, which mainly includes three aspects: first, a clustering algorithm is used to optimize sample data, and story texts of various types are selected for large-scale language model learning; second, a three-act structure thinking chain prompt technology is used to improve the logical reasoning ability of the large model, and the stories generated by the large model have a certain narrative structure; finally, a plurality of story texts are generated through a semantic self-consistent method, and the texts with the highest coherence and relevance are screened out to enhance the quality of the generated stories.

[0036] The event-driven story generation method based on the three-act structure thinking chain and semantic self-consistency proposed in the present invention is superior to the previous methods, which verifies the effectiveness of the method of the present invention for the event-driven story generation task. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1The present invention provides an overall framework diagram of an event-driven story generation method based on a three-act structure thinking chain and semantic self-consistency.

[0038] Figure 2 An example diagram of a three-act structure thinking chain template provided for an example of the present invention.

[0039] Figure 3 This is a schematic diagram of the impact of the example selection method on various indicators of a large-scale language model in an example of the present invention.

[0040] Figure 4 This is the clustering result in semantic space of a case story selected from the test data in an example of the present invention. DETAILED DESCRIPTION

[0041] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the embodiment and the present invention will be described in detail below with reference to the accompanying drawings.

[0042] Optimize the examples before generating the story. A clustering algorithm is used to select story text examples of various types that can reflect the task domain from the data set, so that the large-scale language model can learn how to write different types of stories; improve the logical reasoning ability of the large-scale language model when generating stories. A good story requires rigorous narrative logic and structure. The present invention draws on the three-act structure model commonly used in story creation, divides the story into three stages: beginning, conflict and ending, introduces the concept of thinking chain prompt technology, constructs a three-act structure thinking chain template, and guides the model to consciously plan and follow a clear story structure when generating stories; after generating stories, the stability of the quality of generated stories is improved. Inspired by the deliberation and thinking process of human writers when writing, the present invention refers to the recent self-consistent technology research and proposes a semantic self-consistent method to simulate this process to cope with the problem of unstable quality of generated texts caused by the openness of event-driven story generation tasks. The method first requires the model to generate multiple different story texts, and uses a clustering algorithm to screen out the most semantically self-consistent story text clusters. After that, according to the coherence and relevance scores of each story text, the one with the highest score is selected as the final answer.

[0043] The present invention will be described below in conjunction with specific embodiments:

[0044] Embodiment 1, as Figure 1 As shown, an event-driven story generation method based on a three-act structure thinking chain and semantic self-consistency, the method comprising:

[0045] Step 1. Download the ROCStories dataset, which contains 98,158 samples, each of which is a 5-sentence common sense story. At the same time, download the MTG dataset, which is a dataset for training and evaluating multilingual text generation. It contains story generation data in five languages ​​(English, German, French, Spanish, and Chinese).

[0046] Step 2: Use a multilingual pre-trained language model to represent the story text and generate corresponding semantic vectors. Then, use a clustering algorithm to classify these semantic vectors and select the text closest to the cluster center from each cluster as an example to prompt the large-scale language model.

[0047] Step 3. Use the three-act structure thought chain template to convert the selected sample text into a thought chain prompt, splice it with the input story dominant background and event sequence, and input it into the large-scale language model to generate multiple candidate story texts.

[0048] Step 4: Use the semantic self-consistency method to screen the candidate story texts generated by the large-scale language model and select the story text with the best quality.

[0049] As a preferred embodiment of the present invention, the Step 1 comprises:

[0050] Step 1.1. Download the public ROCStories and MTG datasets from the Internet.

[0051] Step 1.2: Use Spacy to process the dataset and extract the first sentence of each story as the dominant background of the story. Perform dependency syntactic analysis on the last four sentences of the story and extract a verb phrase from each sentence as the event of the story.

[0052] As a preferred embodiment of the present invention, the Step 2 comprises:

[0053] Step 2.1. Use the multilingual pre-trained language model Sentence-BERT to encode each story text in the dataset into a vector representation.

[0054] Step 2.2, Definition A collection of examples to prompt large-scale language model adaptation tasks, where They represent the dominant background, event sequence, and corresponding story text of the nth example in the example set D. The text vectors are processed using the k-means clustering algorithm to divide them into |D| clusters;

[0055] Step 2.3: For each text vector in each cluster, calculate the distance between them and the cluster center, and select the text that is closest to the cluster center. Add the dominant background, event sequence, and story text corresponding to the text vector to the example set D.

[0056] As a preferred embodiment of the present invention, the Step 3 comprises:

[0057] like Figure 2 As shown, express The jth event of express The kth sentence of .

[0058] Step 3.1. Build a thought chain template and refer to the three-act structure model to divide the story generation process into three acts, namely the beginning (Act 1), conflict (Act 2) and ending (Act 3).

[0059] Step 3.2: Given the dominant background of the nth example in the example set D and sequence of events The event sequence is divided into three acts in a ratio of 1:2:1, namely, the event The beginning of the story, the event and The conflicts and events that make up the story This constitutes the ending of the story, in which express Then, develop the plots of each part of the story according to the divided events. Finally, add a conclusion starting with "Combining the setup, confrontation, and resolution, the story is:" at the end of the thought chain template, and splice the generated story sentences together as the final answer.

[0060] Step 3.3: Use thought chain prompts to let the large-scale language model generate a set of candidate stories in Represents the mth generation result of the large model.

[0061] As a preferred embodiment of the present invention, the Step 4 comprises:

[0062] Step 4.1. Use Sentence-BERT to calculate each story in the candidate story set C And the corresponding semantic vectors of the dominant background L and event sequence E.

[0063] Step4.2. Process each story vector in the candidate story set C using the hierarchical clustering algorithm, and divide the set C into p clusters, i.e., R = {C1, C2, …, C p}.

[0064] Step4.3. Count the number of elements in each cluster, and select the cluster with the largest number of elements (assuming its number is q, q < p), where represents the t-th story in cluster C q .

[0065] Step4.4. For each story q in cluster C , use Sentence-BERT to encode each sentence in into a semantic vector, calculate the cosine similarity between each adjacent sentence, and take the average of these cosine similarities as the coherence score of the story. At the same time, calculate the cosine similarity between and the dominant background L and the event sequence E as the relevance score of the story. The specific formula is as follows:

[0066]

[0067] where, sim k represents the cosine similarity between the k-th sentence and the previous sentence, represents the cosine similarity score between the k-th sentence and the dominant background L and the event sequence E, represents the coherence score of story , represents the relevance score of story .

[0068] Step4.5. Combine the coherence score and the relevance score, and select the story text with the highest combined score from the cluster as the final answer. The formula for the combined score is as follows:

[0069]

[0070] Finally, select the story text with the highest score:

[0071]

[0072] where, represents the combined score of story , and λ is an adjustable proportional parameter, which is set to 0.5 in the present invention.

[0073] This embodiment also provides an event-driven story generation system based on a three-act structure thinking chain and semantic self-consistency, including a module for executing the above method. Specifically, it may include:

[0074] Download module, used to download and process ROCStories dataset and MTG dataset;

[0075] The representation module is used to represent the story text using a multilingual pre-trained language model, and classify the represented text using a clustering algorithm. The text closest to the cluster center is selected from each cluster as an example to prompt the large-scale language model.

[0076] A generation module is used to convert the selected text into a thought chain prompt using a three-act structure thought chain template, splice it with the input story dominant background and event sequence, and input it into a large-scale language model to generate multiple candidate story texts;

[0077] The screening module is used to screen the candidate story texts generated by the large-scale language model using a semantically self-consistent method and select the story text with the best quality.

[0078] In order to compare with the existing methods, the present invention uses the public ROCStories dataset and randomly divides the dataset into a training set, a test set and a validation set in a ratio of 8:1:1. The present invention takes the first sentence of each story as the dominant context and extracts the event sequence from the remaining four sentences through dependency syntactic analysis. Due to cost constraints, the present invention randomly selects 200 samples from the test set to test the performance of the method. The selected existing comparison methods include: BART, EtriCA, HINT, GPT-3.5, Gemma, and Llama2. Among them, BART is a Transformer model using a Seq2Seq architecture, in which the decoder is similar to the BERT model and the encoder is similar to the GPT model. The architecture of EtriCA is based on the BART model, using two encoders to encode the dominant context and event sequence of the story respectively, and combining the features of the two inputs through a cross-attention mechanism to improve the coherence of the generated story. The architecture of HINT is also based on the BART model. Two training objectives are designed in the training stage, namely, sentence similarity prediction and sentence order discrimination, to improve the coherence of the story generated by the model. GPT-3.5 is a large-scale language model developed by OpenAI, which is improved on the basis of GPT-3 and can understand and generate natural language or code. Gemma is a series of lightweight open source large-scale language models launched by Google. Llama2 is a series of large-scale language models released by Meta AI, with parameter sizes ranging from 7 billion to 70 billion. The present invention uses ROUGE-n (Rn), BLEU-n (Bn), MS-Jaccard (MSJ) and BERTScore (BES) as indicators for evaluating model generation results. For Rn, Bn and MSJ, the present invention uses 4-gram. For BES, the deberta-xlarge-mnli model is used. The results of the comparison method and the method of the present invention on the ROCStories dataset are shown in Table 1 below, and the best performing part of each indicator is highlighted in bold:

[0079] Table 1 Experimental results

[0080]

[0081] As shown in 1, the method proposed in the present invention outperforms contextual learning prompts and previous fine-tuning methods in all indicators. Specifically, for the GPT-3.5 model, the method of the present invention improves the BLEU-4 indicator by 11.6% compared with contextual prompts and by 10.9% compared with EtriCA; in the BERTScore indicator, it improves by 1.6% and 6.0% compared with contextual prompts and EtriCA, respectively. In the ROUGE-2 and MS-Jaccard indicators, the method of the present invention also performs well, surpassing other baselines. These results show that the stories generated by the method proposed in the present invention are closer to the reference stories written by humans, verifying the effectiveness of the three-act structure thinking chain prompt template and the semantic self-consistency method.

[0082] In order to prove the effectiveness of the method proposed in the present invention, ablation experiments were carried out on three models: Gemma-7B, Llama2-7B and GPT-3.5. The experimental results are shown in Table 2. "(-) Thinking chain" means that when prompting the large model, the thinking chain prompt is not used, and only the context learning prompt is used. "(-) Semantic self-consistency" means that the large-scale language model is not allowed to generate multiple candidate stories and select answers from them through the semantic self-consistency method, and only the large model is allowed to generate a story as the answer during reasoning. "(-) Thinking chain and semantic self-consistency" means that only the large model is allowed to generate stories through context learning prompts.

[0083] Table 2 Ablation experiment results

[0084]

[0085] As can be seen from Table 2, each module of the method of the present invention has produced a certain effect. When the thinking chain module is removed, the performance of all models has a significant decline in most indicators. On the GPT-3.5 model, taking the "method of the present invention" as the benchmark, compared with "(-) semantic self-consistency", "(-) thinking chain" has a 3.32% drop in the B-4 index and a 9.52% drop in the MSJ index; on the Llama2-7B model, the BLEU-4 score of "(-) thinking chain" is even lower than that of "(-) thinking chain and semantic self-consistency". Although the improvement effect of the semantic self-consistency part is not as significant as that of the thinking chain, it also improves the effect of the model in most indicators. For example, on the GPT-3.5 model, after removing the semantic self-consistency module, the B-4 index dropped by 4.41% and the MSJ index dropped by 3.08%. When the thinking chain and semantic self-consistency modules are removed at the same time, the performance of the model drops most significantly. For example, on the Gemma-7B model, the B-4 index decreased by 15.38%, the R-2 index decreased by 9.33%, and the MSJ index decreased by 12.6%. In summary, the three-act structure thinking chain plays a key role in improving the generation quality of the model. By planning the story structure in the story generation stage, the quality of the generated story is significantly improved. Although the improvement effect of the semantic self-consistency part is relatively small, it also makes an important contribution to improving the quality of the story.

[0086] In order to demonstrate the effectiveness of the example selection method in the present invention, the present invention then compares it with the example selection method based on similarity and the example selection method based on randomness. The present invention uses Sentence-BERT to encode the dominant context and event sequence input into the large model, and then selects the first n story texts similar to the input from the training set according to the cosine similarity as demonstration examples, and uses this as an example selection method based on similarity. The present invention also randomly selects n examples for each input as an example selection method based on randomness. The experimental setting uses the three-act structure thinking chain method to prompt the GPT-3.5 model to generate stories, and observes the impact of example selection on the generation results of the large model from two perspectives: example selection method and number of examples. The experimental results are shown in the figure. Figure 3 As shown, the x-axis of each subgraph represents the number of examples, and the y-axis represents the size of each indicator score.

[0087] pass Figure 3It can be seen that when the number of examples is small, the similarity-based method can achieve good results, but when the number of examples exceeds 6, the performance of the similarity method shows a downward trend. In contrast, the performance of the random method shows an upward trend with the increase in the number of examples, and when the number of examples reaches 8, its performance is comparable to the similarity-based method. When the number of examples exceeds 5, the method of the present invention is significantly better than other example selection methods. These observations show that providing relevant examples to large models can help improve their performance in story generation tasks, but too many relevant examples may introduce noise, limit the scope of the large model's understanding of the task, and lead to performance degradation. On the other hand, providing a certain number of diverse examples to large models can improve their performance. The method of the present invention balances the similarity and diversity of examples. By using the k-means clustering algorithm for example screening, it not only ensures the relevance between examples and problems, but also cleverly incorporates diversity, thereby improving the overall performance of large models in story generation tasks.

[0088] In order to further illustrate the effectiveness of the semantic self-consistent method proposed in the present invention, the present invention Figure 4 A case study is shown in Table 3, where the results are generated by the GPT-3.5 model. The dominant context and event sequence of the case are “Patrick's mother died from Cancer.” and “1.left him 30,000 2.had fight 3.agreed send 4.received letter” respectively. Figure 4 (a) and (b) respectively represent the clustering results of the stories generated by the three-act structure thinking chain and the context learning prompt in the semantic space, and "●", "▲" and "■" respectively represent different clusters. Table 3 shows the story samples selected from each cluster of the clustering results. The present invention uses single underline and double underline to mark the parts of the story text that lack relevance and coherence in Table 3.

[0089] Table 3. Examples of stories selected from each cluster of the clustering results.

[0090]

[0091]

[0092] from Figure 4It can be seen that the stories generated by the large model have multiple semantic clusters. These stories can be classified by using clustering algorithms. According to Table 3, the stories in clusters with fewer elements often have some problems in plot development. For example, if the story in the "■" cluster of the three-act structure thinking chain ends with Patrick receiving a letter from his mother thanking him for his care, then the plot of Patrick taking care of his mother should be found in the previous text, but the previous text only describes the dispute between Patrick and his brothers and sisters over their mother's inheritance. At the same time, the story in the "■" cluster of context learning prompts has a lawyer, a character that did not appear in the previous text.

[0093] For stories generated using the three-act structure thinking chain, the stories in the cluster with more elements will be more reasonable in plot development; while for stories generated by context learning prompts, there are often certain problems. For example, the stories in the "●" cluster and the "▲" cluster both end with the mother writing letters to Patrick to express her love and pride, which is abrupt compared to the previous plot of the mother's death and the fight for the inheritance. At the same time, the mother has passed away, but Patrick can still receive a letter from his mother a few days later, which is obviously illogical. The above phenomenon shows that there are some common problems in the story texts generated by the context learning prompt method, which are difficult to solve even if multiple candidate stories are sampled. The probability of these problems can be reduced by the thinking chain method, which further proves the effectiveness of the three-act structure thinking chain method proposed in the present invention.

[0094] Table 4 shows the effect of setting different cluster numbers p on the final generated story text by the semantic self-consistent method. When the number of clusters is set to 1, the method of the present invention degenerates to selecting results from the candidate set only by the coherence correlation score. From the data in Table 4, it can be seen that clustering the candidate set can effectively improve the performance of the large model generation results in various indicators. This shows that although large-scale language models may make mistakes when generating stories, after sampling multiple candidate stories through the semantic self-consistent method of the present invention, poor generation results can be filtered out, thereby improving the quality of stories generated by large-scale language models.

[0095] Table 4 The impact of different cluster number settings on the final results

[0096]

[0097] In order to further verify the effectiveness of the three-act structure thinking chain proposed in the present invention, the present invention conducted experiments in five languages: Chinese, French, Spanish, German and Vietnamese. Among them, the Chinese, French, Spanish and German data are from the MTG dataset, and the Vietnamese data is obtained by translating the ROCStories dataset using Google Translate. For these non-English languages, we have expanded the thinking chain. We translated the thinking chain into the language corresponding to the input and compared it with the English version of the thinking chain. The experimental results are shown in Table 5, where the source language thinking chain represents the translation of the thinking chain template into the language corresponding to the input.

[0098] Table 5 Experimental results on other languages

[0099]

[0100] As shown in Table 5, compared with the traditional contextual learning method, the thinking chain method performs better in different language settings. These results show that the three-act structure thinking chain prompt method proposed in this invention not only performs well in English settings, but also shows significant effectiveness in other language conditions.

[0101] In order to better illustrate the effect of the method of the present invention on the event-driven story generation task, volunteers were recruited to conduct manual evaluation of the method of the present invention and the first two most competitive methods in Table 1. The present invention randomly selected 50 stories from the ROCStories dataset. Two college students with good English proficiency were invited to evaluate the stories from three aspects: (1) Coherence: measuring the correlation and causal relationship between sentences. (2) Fluency: measuring the quality and grammatical correctness of the language within a sentence. (3) Relevance: measuring the degree of relevance between the story and the dominant background and event sequence. The score range for each indicator is 1 (worst) to 5 points (best). The results of the manual evaluation are shown in Table 6. Overall, the method of the present invention outperforms previous methods in terms of coherence, fluency and relevance.

[0102] Table 6. Manual evaluation results

[0103]

[0104] The specific embodiments of the present invention are described in detail with reference to the accompanying drawings, however, the present invention is not limited to the above specific embodiments. Various changes can be made to the embodiments within the knowledge of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. An event-driven story generation method based on a three-act structure thinking chain and semantic self-consistency, It is characterized in that The following steps are involved: Step 1. Download the ROCStories dataset and the MTG dataset and process them. Step 2: Use a multilingual pre-trained language model to represent the story text, and use a clustering algorithm to classify the represented text. From each cluster, select the text closest to the cluster center as an example to prompt the large-scale language model. Step 3: Use the three-act structure thinking chain template to convert the selected text into a thinking chain prompt, combine it with the input story dominant background and event sequence, and input it into the large-scale language model to generate multiple candidate story texts; Step 4: Use a semantically self-consistent method to screen the candidate story texts generated by the large-scale language model and select the story text with the best quality.

2. The event-driven story generation method based on the three-act structure thinking chain and semantic self-consistency as claimed in claim 1, It is characterized in that The specific implementation of Step 1 includes: Step 1.1, download the public ROCStories and MTG datasets from the Internet; Step 1.2: Use Spacy to process the dataset, taking the first sentence of each story as the dominant background of the story; perform dependency syntactic analysis on the last four sentences of the story, and extract a verb phrase from each sentence as the event of the story.

3. The event-driven story generation method based on the three-act structure thinking chain and semantic self-consistency as claimed in claim 1, It is characterized in that The specific implementation of Step 2 includes: Step 2.

1. Use the multilingual pre-trained language model Sentence-BERT to encode each story text in the dataset into a vector representation. Step 2.2, Definition A collection of examples to prompt large-scale language model adaptation tasks, where Respectively represent the dominant background, event sequence and corresponding story text of the nth example in the example set D; use the k-means clustering algorithm to process the text vectors and divide them into |D| clusters; Step 2.

3. For each text vector in each cluster, calculate the distance between them and the cluster center, select the one closest to the cluster center, and add the dominant background, event sequence, and story text corresponding to the text vector to the example set D.

4. The event-driven story generation method based on the three-act structure thinking chain and semantic self-consistency as claimed in claim 1, It is characterized in that The specific implementation of Step 3 includes: Step 3.

1. Build a thinking chain template and refer to the three-act structure model to divide the story generation process into three acts, namely, the beginning (Act 1), the conflict (Act 2) and the ending (Act 3); Step 3.2: Given the dominant background of the nth example in the example set D and sequence of events The event sequence is divided into three acts in a ratio of 1:2:1, namely, the event The beginning of the story, the event and The conflicts and events that make up the story This constitutes the ending of the story, in which express The jth event of the story; then, develop the plots of each part of the story according to the divided events; finally, add a conclusion starting with "Combining the setup, confrontation, and resolution, the story is:" at the end of the thought chain template, and splice the generated story sentences together as the final answer; Step 3.3: Use thought chain prompts to let the large-scale language model generate a set of candidate stories in Represents the mth generation result of the large model.

5. The event-driven story generation method based on the three-act structure thinking chain and semantic self-consistency as claimed in claim 1, It is characterized in that The specific implementation of Step 4 includes: Step 4.

1. Use Sentence-BERT to calculate each story in the candidate story set C The semantic vector of the corresponding dominant background L and event sequence e; Step 4.2: Use the hierarchical clustering algorithm to process each story vector in set C and divide set C into p clusters, that is, R = {C 1 ,C 2 ,…,C p }; Step 4.

3. Count the number of elements in each cluster, and select the cluster with the most elements (assuming its number is q, q < p), where represents the t-th story in cluster C q ; Step 4.

4. For cluster C q Every story in Using Sentence-BERT Each sentence in is encoded into a semantic vector, and then the cosine similarity between each adjacent sentence is calculated. The average of these cosine similarity scores is taken as the coherence score of the story; in addition, The cosine similarity between the dominant background L and the event sequence E is used as the relevance score of the story, that is: Among them, sim k represents the cosine similarity score between the kth sentence and the previous sentence, represents the cosine similarity score between the k-th sentence and the dominant background L and event sequence E, Representing the story The coherence score, Representing the story The relevance score of Step 4.5: Combine the coherence score and relevance score and select a story text with the highest score from the cluster as the final answer, as shown below: in, Representing the story The comprehensive score of , λ is an adjustable proportional parameter.

6. An event-driven story generation method system based on a three-act structure thinking chain and semantic self-consistency, It is characterized in that The method comprises a module for executing the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Story generation method and device, electronic equipment and storage medium

    CN115130451A

  • Event template induction method and system based on large-scale language model

    CN116450827A

Cited By

  • Self-learning method for enhancing story content plots

    CN119886348A