Scenario generation method and device, electronic equipment and storage medium
By constructing a plot node data and literary feature label system, and combining reinforcement learning to generate a script narrative outline, the problems of narrative logic in the large language model in script generation are solved, and the logical coherence and rich plot of the script are achieved.
Patent Information
- Application Number
- CN202510461329.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-08-15
AI Technical Summary
The existing script generation method based on large language models has problems of narrative logic incoherence, plot faults and plot contradictions, and it is difficult to generate professional scripts with logical coherence, rich plots and consistent characters.
By determining the plot node data in the object text, a hierarchical script narrative outline is constructed, and a pre-constructed literary feature label system is used for structured extraction, combining reinforcement learning and multi-model training to generate script content to ensure the logical coherence and plot richness of the script.
It realizes the richness of the plot of the script and the consistency of the characters, avoids plot gaps and contradictions, and ensures the logical consistency of the script content.
Smart Images

Figure CN120493876A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a script generation method, device, electronic device and storage medium. Background Art
[0002] With the development of artificial intelligence technology, professional script generation has gradually become one of the important applications in the field of natural language processing.
[0003] Existing technologies primarily rely on large language models based on the Transformer architecture for script generation. These large language models demonstrate powerful text generation capabilities through self-supervised learning from massive amounts of text data.
[0004] However, the above-mentioned script generation based on the large language model has defects and shortcomings such as the difficulty in sustaining narrative logic, the convergence of plot patterns, and the lack of hierarchy in the script structure, which limits its application in the field of professional script generation. There is an urgent need for a script generation method that can solve the above-mentioned defects. Summary of the Invention
[0005] The present invention provides a script generation method, device, electronic device and storage medium to solve the defects of the prior art such as incoherent narrative logic, easy occurrence of plot gaps and / or plot contradictions, and can ensure that the generated script has rich plot and coherent content.
[0006] The present invention provides a script generation method, comprising the following steps: Determining plot point data in the target text, the plot point data including a plot point sequence corresponding to the target text and plot elements associated with each plot point in the plot point sequence; generating a script narrative outline based on the plot point data; Generate script content based on the script narrative outline.
[0007] According to a script generation method provided by the present invention, determining plot point data in the target text includes: Locating each plot change node in the target text, wherein the plot change node is determined based on at least one of a character change, a scene change, or a relationship change; Determining the plot node sequence according to the plot change nodes; Based on a pre-constructed literary feature tag system, structured extraction is performed on text fragments related to each plot point in the plot point sequence to obtain the plot elements related to each plot point.
[0008] According to a script generation method provided by the present invention, based on a pre-established literary feature tag system, structured extraction is performed on text fragments related to each plot point in the plot point sequence to obtain the plot elements related to each plot point, including: Performing structured extraction of the text fragments related to each of the plot points from at least one of a narrative mode dimension, an emotional dimension, and a structural dimension; The narrative mode dimension includes a label dimension composed of at least one of dialogue guidance, inner monologue and environmental description; the emotional dimension includes a label dimension composed of at least one of emotional polarity and emotional intensity; and the structural dimension includes a label dimension composed of at least one of foreshadowing, reversal and preparation.
[0009] According to a script generation method provided by the present invention, the plot elements include one of explicit elements, implicit elements and content elements; The explicit elements include at least one of characters, scenes, relationships, and plots; the implicit elements include at least one of emotional tone, contradictions and conflicts, and foreshadowing clues; and the content elements include at least one of character dialogues and environmental descriptions.
[0010] According to a script generation method provided by the present invention, generating a script narrative outline based on the plot point data includes: Inputting the plot point data and the first thought chain guiding instruction into the first model to obtain the script narrative outline output by the first model; The first thought chain guiding instruction is used to instruct the first model to generate the script narrative outline according to the plot point data, and to define the hierarchical structure of the script narrative outline; The first model is obtained by training an initial model using a plurality of plot point data samples and a script narrative outline label corresponding to each of the plot point data samples.
[0011] According to a script generation method provided by the present invention, the processing step includes aggregating all plot nodes in the plot node sequence, and then generating the script narrative outline according to the script narrative structure and the explicit elements; the hierarchical structure is a multi-level hierarchical structure composed of scenes, scenes and plot nodes.
[0012] According to a script generation method provided by the present invention, generating script content based on the script narrative outline includes: Inputting the script narrative outline and the second thought chain guiding instruction into the second model to obtain the script content output by the second model; The second thought chain guiding instruction includes a scene number and at least one of content requirements, format requirements, logical consistency constraint requirements and style requirements for the generated script content.
[0013] According to a script generation method provided by the present invention, the second model is trained based on the following steps: Use the text corpus to perform unsupervised training on the initial large model to obtain the third model; Collecting a first training data set and a second training data set; Using the first training data set and the second training data set, the third model is trained to obtain a fourth model after instruction fine-tuning training; Perform reinforcement learning training on the fourth model to obtain the second model.
[0014] According to a script generation method provided by the present invention, the first training data set is collected based on the following steps: Collect multiple script contents; Inputting any script content into a first language model, obtaining a variety of script generation instructions output by the first language model, and a consistency score between each script generation instruction and the any script content; Filtering the script generation instruction with the highest consistency score and forming a training sample with the script narrative outline obtained from the script generation instruction; Obtaining training samples corresponding to all the script contents to construct the first training data set; The second training data set is collected based on the following steps: Build multiple types of script generation instruction sets; Input any script generation instruction in the script generation instruction set into the second largest language model, and obtain multiple script contents output by the second largest language model; Screening out the script content with the highest quality score and forming a training sample with the script narrative outline obtained by any of the script generation instructions; Obtain training samples corresponding to all the script generation instructions in the script generation instruction set to construct the second training data set.
[0015] According to a script generation method provided by the present invention, the method uses the first training data set and the second training data set to train the third model, and obtains a fourth model after instruction fine-tuning training, including: Obtaining any one training sample from the first training data set and the second training data set, using the script narrative outline in the training sample as a model input of the third model, and obtaining an output result of the third model; Setting the script content in the training sample as an output label, and adjusting the model parameters of the third model according to the difference between the output result and the output label; Iteratively execute the step of obtaining any training sample from the first training data set and the second training data set, to the step of adjusting the model parameters of the third model according to the difference between the output result and the output label, until the model training cutoff condition is met, and obtain the fourth model.
[0016] According to a script generation method provided by the present invention, after constructing multiple types of script generation instruction sets, interpolation processing is performed on the script generation instruction sets, specifically including: Combining different types of script generation instructions; and / or, performing element expansion on the script generation instruction; And / or, modify some elements in the script generation instructions.
[0017] According to a scenario generation method provided by the present invention, performing reinforcement learning training on the fourth model to obtain the second model includes: Taking the script narrative outline corresponding to any script generation instruction as the input of the fourth model, and obtaining the script content output by the fourth model; Calling a reward model to evaluate the script content to determine a total reward value of the fourth model based on the evaluation result, wherein the total reward value includes a score output by the reward model for evaluating the script content and a KL divergence penalty term; Based on a preset strategy optimization algorithm, with the goal of maximizing the total reward value, the model parameters of the fourth model are iteratively updated to obtain the second model.
[0018] According to a scenario generation method provided by the present invention, the preset strategy optimization algorithm is a proximal strategy optimization algorithm; based on the preset strategy optimization algorithm, with the goal of maximizing the total reward value, when iteratively updating the model parameters of the fourth model, the method includes: Setting the clipping range of the proximal strategy optimization algorithm; and / or, setting a script generation reference model with fixed parameters as a reference when updating the model parameters of the fourth model; And / or, using a critic network to evaluate the value of the script content to generate a reward signal, and including the reward signal in the total reward value.
[0019] According to a script generation method provided by the present invention, the reward model is trained based on the following method; Obtaining a script narrative outline corresponding to any script generation instruction in the script generation instruction set; Taking the script narrative outline as input to the fourth model, and adjusting the temperature coefficient of the fourth model to obtain all script contents output by the fourth model; Sampling a preset number of candidate script contents from all the script contents, and determining actual quality scores and relative quality rankings of all the candidate script contents; Taking any of the script generation instructions and any of the corresponding candidate script contents as inputs to the reward model, and obtaining a score value output by the reward model; Adjusting the model parameters of the reward model according to the score values with the goal of maximizing the reward probability of candidate script content with high score values and minimizing the reward probability of candidate script content with low score values; Iteratively execute the steps of obtaining the script narrative outline corresponding to any script generation instruction in the script generation instruction set to adjusting the model parameters of the reward model according to the scoring value until the model training cutoff condition is met, and obtain the reward model that has completed training.
[0020] The present invention also provides a script generation device, comprising the following modules: a plot point data extraction module for determining plot point data in a target text, wherein the plot point data includes a plot point sequence corresponding to the target text and plot elements related to each plot point in the plot point sequence; A script narrative outline extraction module, for generating a script narrative outline based on the plot point data; The script content generation control module is used to generate script content based on the script narrative outline.
[0021] The present invention also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the script generation method described above is implemented.
[0022] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the script generation methods described above.
[0023] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the script generation methods described above.
[0024] The script generation method, device, electronic device and storage medium provided by the present invention start from the novel text and structure the plot points and plot elements related to the plot points through hierarchical modeling of the object text, so as to generate a complete script scene by scene according to the obtained hierarchical script narrative outline, which can ensure the richness of the script plot, the consistency of the characters and the logical coherence of the script content, and can effectively avoid plot gaps or contradictions. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 It is a flow chart of the script generation method provided by the present invention.
[0027] Figure 2 It is a flow chart of the plot node data extraction provided by the present invention.
[0028] Figure 3 It is a flowchart of the second model training provided by the present invention.
[0029] Figure 4 It is a schematic diagram of the process of constructing the first training data set provided by the present invention.
[0030] Figure 5 It is a schematic diagram of the process of constructing the second training data set provided by the present invention.
[0031] Figure 6 It is a flow chart of training the third model to obtain the fourth model provided by the present invention.
[0032] Figure 7 It is a flow chart of the process of performing reinforcement learning training on the fourth model to obtain the second model provided by the present invention.
[0033] Figure 8 It is a flowchart of training the reward model provided by the present invention.
[0034] Figure 9 It is a structural diagram of the script generation device provided by the present invention.
[0035] Figure 10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0036] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0037] It should be noted that, in the description of the present invention, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0038] The terms "first," "second," and so forth, used herein are used to distinguish similar objects, not to describe a specific order or precedence. It should be understood that such terms are interchangeable where appropriate, allowing embodiments of the present invention to be implemented in an order other than that illustrated or described herein. Furthermore, the terms "first," "second," and so forth generally distinguish objects of a single type, and do not limit the number of objects. For example, the first object may be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates an "or" relationship between the connected objects.
[0039] In recent years, large language models based on the Transformer architecture have achieved breakthroughs in natural language processing. These large-scale pre-trained models demonstrate powerful text generation capabilities through self-supervised learning from massive amounts of text data. In general text generation tasks, these large language models are able to generate grammatically correct and information-rich text content based on user instructions. Their advantages lie in three key areas: first, they offer extensive knowledge coverage and can flexibly access knowledge elements from diverse fields; second, they possess language modeling capabilities and can maintain a certain degree of contextual coherence; and third, they support conversational interactions within a certain number of turns and can dynamically adjust based on user feedback.
[0040] When such large language models are applied to professional scriptwriting, they exhibit significant limitations, specifically: (1) Narrative logic is difficult to sustain: Due to the limitations of the autoregressive generation mechanism, the model has difficulty maintaining a stable causal chain in long text generation, and plot gaps or contradictions are prone to occur.
[0041] (2) Plot pattern convergence: Affected by the distribution of training data, the model tends to repeat common plots and lacks innovative plot structure.
[0042] (3) Weak character development: Character behavior patterns often deviate from pre-set personality traits, and there is confusion about character identities in dialogues (e.g., different characters use similar language styles).
[0043] (4) Insufficient dramatic tension: It is difficult to independently construct an effective conflict escalation mechanism and suspense setting, resulting in a flat story rhythm.
[0044] Screenwriting requires a clear, overall plan for the story's structure and plot direction, ensuring coherence and logic to avoid plot gaps or inconsistencies. Furthermore, the characters' behavior, language, and personality traits must remain consistent throughout the script, fitting within their intended setting and personality traits to avoid situations where their actions are inconsistent with their identities. Furthermore, scripts often contain multiple complex events and plot threads, requiring a rational arrangement of their sequence and interrelationships to create a tense, engaging storyline and conflict.
[0045] In view of this, the present invention provides a script generation method, device, electronic device and storage medium, which takes text as the object, structures the plot elements such as plot, characters, scenes, etc. by hierarchical modeling of the text, and gradually generates a complete script by constructing a hierarchical script narrative outline, which can ensure the richness of the script plot and the consistency of the characters. Figures 1-10 The specific contents of the script generation method, device, electronic device and storage medium provided by the present invention are described in detail.
[0046] Figure 1 It is a flowchart of the script generation method provided by the present invention, such as Figure 1 As shown, the present invention provides a script generation method, the core of which is to generate a script narrative outline by determining the plot point data in the target text, and generate the script content scene by scene based on the outline, specifically including but not limited to the following steps: Step 11: Determine the plot point data in the target text. The plot point data mainly includes the plot point sequence corresponding to the target text and the plot elements related to each plot point in the plot point sequence.
[0047] The object text can be a novel, a story, or other textual form with a storyline, and is usually a carrier for recording text according to chapters or other logic.
[0048] By identifying plot points within the target text, the target text is divided into segments with distinct plots. Each plot point represents a segment of the story. Each plot point necessarily contains plot elements related to the story, such as characters, settings, relationships, plot points, conflicts, and environmental descriptions.
[0049] A plot point sequence is a sequence of multiple plot points that are arranged in a certain order, and each plot point represents a plot in the story.
[0050] In step 11, important plot nodes in the object text can be identified, and plot elements related to each plot node can be extracted. These plot nodes can then be arranged in the order of story development, character growth experience, and the flow of important items to form a plot node sequence.
[0051] Step 12: Generate a script narrative outline based on the plot point data. The script narrative outline is generated based on the plot point data and is a script structure framework that accurately reflects the sequence and hierarchy of plot points, and is used to guide the generation of script content.
[0052] By inputting the plot point data collected in the previous step into the large language model, the large language model's reasoning capabilities can be used to aggregate multiple consecutive plot points to generate a script narrative outline based on the script's narrative structure (such as introduction, development, climax, and ending). A script narrative outline typically includes a hierarchical structure of acts, scenes, and plot points. Specifically, a script narrative outline typically includes at least one act, each act consisting of one or more scenes, and each scene corresponds to at least one plot point.
[0053] Step 13, generating script content based on the script narrative outline.
[0054] The script content can be tailored to the requirements of the script's performance, including scene descriptions, character dialogues, stage directions, and action instructions. Stage directions may further include instructions for lighting, sound effects, and prop usage, while action instructions may further include instructions for character movements, expressions, and demeanor.
[0055] Assume that the object text is a chapter in the novel "Snow White and the Seven Dwarfs". The following uses the script generation of this chapter as an example to illustrate.
[0056] First, obtain the required plot point data. That is, by identifying the plot change nodes, divide the story into the following four plot points. After obtaining the plot elements related to each plot point, all plot points are organized into a plot point sequence from plot point 1 to plot point 4 according to the development of the storyline. For example: Plot point 1: Snow White meets the seven dwarfs in the forest. The plot elements include characters (Snow White, the seven dwarfs), scene (forest), dialogue content (Snow White asks for help), and environmental description (the tranquility and mystery of the forest).
[0057] Plot point 2: Snow White lives with the seven dwarfs and helps them with housework. The plot elements include characters (Snow White, the seven dwarfs), scenes (the dwarfs' home), emotional tone (warmth), dialogue content (the dwarfs thank Snow White), etc.
[0058] Plot point 3: The Queen disguises herself as an old woman and gives Snow White a poisoned apple. The plot elements involved include characters (Snow White, the Queen disguised as an old woman), scenes (the forest), conflicts (the Queen's conspiracy), dialogues (the old woman persuades Snow White to eat the apple), and descriptions of the environment (the darkness and danger of the forest).
[0059] Plot point 4: The prince finds the sleeping Snow White and wakes her up with a kiss. The plot elements involved include characters (Snow White, the prince), scene (the dwarfs' home), emotional tone (happiness), and environmental description (sunlight fills the room).
[0060] Furthermore, the obtained plot point data is input into the large language model, and the generated script narrative outline may include: Act 1 (Beginning: Snow White meets the seven dwarfs in the forest), Act 2 (Development: Snow White lives with the seven dwarfs), Act 3 (Climax: The Queen disguises herself as an old woman and gives Snow White a poisoned apple), Act 4 (Ending: The prince finds the sleeping Snow White and wakes her up with a kiss).
[0061] Furthermore, the script narrative outline can be input into the large language model to generate the corresponding script content, for example: (1) The script content generated for Act 1 is: Scene description: In the forest, sunlight shines through the leaves, casting mottled shadows.
[0062] Character dialogue: Snow White: "Can you help me?" Dwarfs: "Of course, who are you?" Action Instructions: Snow White walks up to the dwarfs, and they greet her in a friendly manner.
[0063] (2) The script content generated for Act 2 is: Scene description: The dwarf's home is tidy and warm.
[0064] Character dialogue: Dwarfs: "Thank you for helping us clean up." Snow White: "I'm glad to help." Action Instructions: Snow White tidies her room while the dwarfs watch and express their gratitude.
[0065] (3) The script content generated for Act 3 is: Scene description: In the forest, an old woman hands Snow White an apple.
[0066] Character dialogue: Old woman: "Eat an apple, it's very sweet." Snow White hesitated for a moment and took the apple.
[0067] Action instructions: Snow White takes a bite of the apple and then falls to the ground.
[0068] (4) The script content generated for Act 4 is: Scene description: The dwarfs' home, the prince walks into the room.
[0069] Character dialogue: Prince: "I love you, wake up."
[0070] Action instructions: The prince kissed Snow White, she woke up, slowly opened her eyes, and they smiled at each other.
[0071] From the above embodiments, it can be seen that the script generation method provided by the present invention, starting from the novel, through the hierarchical modeling of the object text, structures the plot nodes and the plot elements related to the plot nodes, and generates a complete script scene by scene according to the obtained hierarchical script narrative outline, which can ensure the richness of the script plot, the consistency of the characters and the logical coherence of the script content, and can effectively avoid plot breaks or contradictions.
[0072] Existing Semantic Role Labeling (SRL) technology is a shallow semantic analysis technology that focuses on grammatical structure analysis and lacks support for literary narrative dimensions. This is mainly manifested in: a lack of literary element modeling, unable to identify narrative features such as dialogue guidance and psychological description; a lack of emotional dimension, ignoring the impact of character emotional state on the development of events; and the existence of long-term dependency breaks, with insufficient support for literary techniques such as cross-chapter reference and foreshadowing.
[0073] In order to solve the above problems and better realize the plot point data extraction of the object text, the present invention constructs a literary feature label system, that is, structures the story plot from multiple dimensions such as narrative mode dimension, emotional dimension, structural dimension, etc., so as to accurately extract the key plot elements of each plot point.
[0074] Figure 2 Schematic diagram of the process of extracting plot point data provided by the present invention, such as Figure 2 As shown, it mainly includes but is not limited to the following steps: Step 21: Locate each plot change node in the object text, where the plot change node is determined based on at least one of a character change, a scene change, or a relationship change.
[0075] Step 22: Determine the plot point sequence according to the plot change nodes.
[0076] Step 23, based on the pre-built literary feature label system, structured extraction is performed on the text fragments related to each plot point in the plot point sequence to obtain the plot elements related to each plot point.
[0077] In step 21, plot change nodes in the text can be identified through semantic analysis and contextual understanding. These plot change nodes typically involve character changes, scene changes, or relationship changes. Semantic analysis and contextual understanding can be implemented using a large language model. This model is used to identify, analyze, and locate plot change nodes, outputting complete plot point data and providing a solid foundation for script generation.
[0078] A character change generally refers to the introduction, exit, or transformation of a major or minor character within a storyline, often significantly impacting the plot. For example, in Snow White and the Seven Dwarfs, Snow White encounters the seven dwarfs after escaping to the forest, a significant character change.
[0079] A scene change generally refers to a significant shift in the location, time, or atmosphere of a story, often accompanying a plot twist or development. For example, in Snow White and the Seven Dwarfs, Snow White's escape from the castle to the forest is a significant scene change, marking the beginning of a new phase in the story.
[0080] Relationship change refers to the establishment, deepening, deterioration, or transformation of relationships between characters, which usually affects the interactions between characters and the development of the plot. For example, in "Snow White and the Seven Dwarfs," the relationship between Snow White and the seven dwarfs changes from strangers to familiarity. This is the establishment and deepening of a relationship, laying the foundation for the subsequent development of the plot.
[0081] In step 22, based on the plot change nodes located in the previous step, all plot nodes are determined to construct a plot node sequence in the order of plot development, such as chronological or logical order. This process ensures the logic and coherence of the storyline and provides a clear structure for subsequent script generation.
[0082] Optionally, when a large number of plot change nodes are located in the previous step, in order to simplify subsequent processing and improve efficiency, control the length of script content generation, and reduce redundant information, some important plot change nodes can be first screened out from all plot change nodes based on sampling methods, and then these important plot change nodes can be used to guide the construction of the plot node sequence.
[0083] For example, sampling can be performed based on the importance of each plot change node. The importance of a plot change node can be measured by its impact on the development of the story. For example, a large language model or manual annotation can be used to assess the importance of each plot change node and select those with a significant impact on the plot development.
[0084] Alternatively, sampling can be performed based on the density of plot change nodes. For high-density areas that may contain multiple similar plot change nodes, the number of samples can be appropriately reduced. For example, analyzing the distribution of plot change nodes in the timeline or plot development can be used to retain areas with moderate density to avoid redundancy.
[0085] You can also sample based on the timeline of plot development to ensure that each key time period has representative plot change nodes. For example, divide the entire storyline into multiple time periods based on the story's opening, development, climax, and ending, and select a key plot change node within each time period.
[0086] In step 23, based on a pre-built literary feature tagging system, structured extraction is performed on the text fragments associated with each plot point in the plot point sequence to obtain the plot elements associated with each plot point. Using this literary feature tagging system, multi-dimensional annotation and extraction of plot point-related text fragments ensures that the key plot elements of each plot point are fully extracted, providing rich material for the generation of script content.
[0087] The literary feature labeling system is a rule system used to structure the text fragments related to plot points, mainly labeling from multiple dimensions such as narrative mode dimension, emotional dimension, and structural dimension.
[0088] By extracting the structured text fragments related to plot nodes, we can obtain the plot elements related to each plot node, such as characters, scenes, relationships, plots, environmental descriptions, dialogue content, etc.
[0089] The script generation method provided by the present invention can accurately extract plot point data from the object text and structure it to provide basic material for the subsequent generation of the script narrative outline. It can effectively solve the problems of narrative logic incoherence, plot pattern convergence and weak character creation in the existing technology, ensure the richness and logical coherence of the script plot, and avoid plot gaps or contradictions.
[0090] Based on the content of the above embodiment, as an optional embodiment, the above step 23 mentioned above is based on a pre-constructed literary feature label system to perform structured extraction of text fragments related to each plot node in the plot node sequence to obtain the plot elements related to each plot node, mainly including: performing structured extraction of text fragments related to each plot node from at least one dimension of narrative mode dimension, emotional dimension and structural dimension.
[0091] Among them, the narrative mode dimension includes a label dimension composed of at least one of dialogue guidance, inner monologue and environmental description; the emotional dimension includes a label dimension composed of at least one of emotional polarity and emotional intensity; the structural dimension includes a label dimension composed of at least one of foreshadowing, reversal and preparation.
[0092] Specifically, the above literary feature label system can be presented in Table 1 below: Table 1 List of literary feature label systems
[0093] As shown in Table 1, the narrative mode dimension involves marking dialogue introductory elements, interior monologues, and environmental descriptions. By labeling these elements, the narrative style and character interactions are captured, enhancing the sense of immersion. The emotional dimension involves labeling emotional polarity (positive, calm, negative) and emotional intensity (a quantitative index on a scale of 0-5). By labeling these polarity and intensity, the characters' emotional states are quantified, enhancing the layering of emotional expression. The structural dimension involves labeling foreshadowing, flashbacks, and foreshadowing. This helps identify the plot's layout and logic, enhancing the coherence and layering of the story.
[0094] Among them, dialogue guidance is used to mark the initiator of the dialogue and the turn-taking, which can capture the interaction between different characters; inner monologue is used to mark the character's psychological activities and emotional intensity value, which can enhance the character's emotional expression; environmental description is related to the spatial attributes and plot atmosphere of the scene, which can enhance the immersion of the story.
[0095] Emotion polarity is used to mark the positive, calm or negative state of a character's emotions, reflecting the character's emotional changes. In this embodiment, a 0-5 level quantitative index is used to specifically quantify the intensity of the emotion and enhance the layered sense of emotional expression.
[0096] Through foreshadowing in the structural dimension, one can identify hints or omens in the storyline, thus enhancing the coherence and logic of the storyline; flashback processing that marks the timeline can enrich the narrative structure; foreshadowing is to identify the foreshadowing content for the development of the plot, thus enhancing the layering of the story.
[0097] In this embodiment, the literary feature tagging system uses multi-dimensional annotation rules based on narrative mode, emotion, and structure. These dimensions complement each other, comprehensively capturing the key elements of plot points. This multi-dimensional annotation ensures the integrity and accuracy of plot point data, providing rich material for subsequent script content generation.
[0098] Taking the novel "Snow White and the Seven Dwarfs" as an example, assuming that the plot point data extraction method provided in the above embodiment is used, by analyzing the object text of a chapter, assuming that there are four plot points obtained, the plot elements of these four plot points obtained based on the literary feature label system are expressed as follows: (1) Plot point 1: Snow White escapes to the forest.
[0099] Narrative mode dimension: environmental description (the darkness and danger of the forest).
[0100] Emotional dimension: emotion polarity (negative), emotion intensity (3).
[0101] Structural dimension: foreshadowing (preparing for subsequent plot development).
[0102] Plot elements: setting (forest), characters (Snow White).
[0103] (2) Plot point 2: Snow White meets the seven dwarfs.
[0104] Narrative mode dimension: dialogue guidance (dialogue between Snow White and the dwarfs).
[0105] Emotional dimension: emotion polarity (positive), emotion intensity (4).
[0106] Structural dimension: development (relationship building).
[0107] Plot elements: characters (Snow White, the seven dwarfs), setting (forest).
[0108] (3) Plot point 3: The Queen disguises herself as an old woman.
[0109] Narrative mode dimension: interior monologue (Snow White’s fear).
[0110] Emotional dimension: emotion polarity (negative), emotion intensity (5).
[0111] Structural dimension: climax (escalation of conflict).
[0112] Plot elements: characters (Snow White, the old woman in disguise as the Queen), conflicts (the Queen's conspiracy).
[0113] (4) Plot point 4: The prince wakes Snow White up with a kiss.
[0114] Narrative mode dimension: environmental description (sunlight fills the room).
[0115] Emotional dimension: emotional polarity (positive), emotional intensity (5).
[0116] Structural dimension: outcome (resolution of conflict).
[0117] Plot elements: characters (Snow White, Prince), emotional tone (happiness).
[0118] From the above embodiments, it can be seen that the script generation method provided by the present invention can ensure the integrity and accuracy of plot node data by comprehensively capturing key plot elements through a multi-dimensional literary feature label system, and provide high-quality materials for the generation of subsequent script narrative outlines, effectively solving the problems of plot pattern convergence and weak character creation in the existing technology, and enhancing the richness and logical coherence of the script plot.
[0119] As an optional embodiment, the present invention proposes a method based on a literary feature label system, that is, a method for structuring the story plot from the narrative mode dimension, the emotional dimension, and the structural dimension to extract key plot elements.
[0120] Among them, plot elements mainly include but are not limited to one of explicit elements, implicit elements and content elements.
[0121] Explicit elements are the most intuitive and easily identifiable elements of a script, including at least one of the following: characters, settings, relationships, and plot. These elements serve to establish the basic framework of the script. These explicit elements provide a clear direction for subsequent plot development and character development.
[0122] Characters refer to the characters in a storyline and are generally considered to be the core driving force of the storyline. It should be noted that the character proposed in the present invention is a broad concept that is not limited to human characters, but can also include anthropomorphic animals, objects, etc. For example, in some storylines, animals or objects are given human characteristics and behaviors, becoming important characters in the storyline, and these can be collectively classified as characters. Scenes refer to the location and environment where the storyline takes place, providing the background for the storyline. Relationships generally refer to the interactions or connections between characters, such as mentor-apprentice relationships, friendships, hostile relationships, etc., which are used to drive the development of the storyline. Plots refer to the specific events or actions in the storyline.
[0123] Implicit elements are relatively abstract elements within the target text that are crucial to the logical and emotional expression of the plot. These elements include at least one of the following: emotional tone, conflict, and foreshadowing. Implicit elements enhance the depth and complexity of a script. By identifying emotional tone, conflict, and foreshadowing, we can ensure the emotional expression and logical coherence of the generated script, making the story more engaging.
[0124] Emotional tone generally represents the emotional atmosphere of a story, such as joy, sadness, or tension. Conflict represents the opposition or inner struggle between characters, driving the story forward. Foreshadowing refers to hints or foreshadowing within the story, enhancing the story's coherence and logic.
[0125] Content elements refer to the specific textual content within a script, primarily including at least one of character dialogue and environmental descriptions. These elements make the subsequent script more vivid and detailed. Content elements not only enrich the script's details but also enhance the story's immersion and appeal.
[0126] Dialogue refers to the exchanges between characters that drive the plot and reveal their personalities. Environment description refers to the detailed description of the setting, used to enhance the story's immersion and atmosphere.
[0127] Taking "Snow White and the Seven Dwarfs" as an example, the following shows the relevant content of the extracted and applied explicit elements, implicit elements and content elements.
[0128] (1) Plot point 1: Snow White escapes to the forest.
[0129] Explicit elements: character (Snow White), setting (forest).
[0130] Hidden elements: emotional tone (fear), conflict (escaping from the queen).
[0131] Content elements: Description of the environment (the darkness and danger of the forest).
[0132] (2) Plot point 2: Snow White meets the seven dwarfs.
[0133] Explicit elements: characters (Snow White, the Seven Dwarfs), setting (forest).
[0134] Hidden elements: emotional tone (warmth), relationship (building friendship).
[0135] Content elements: character dialogue (dialogue between Snow White and the dwarfs).
[0136] (3) Plot point 3: The Queen disguises herself as an old woman.
[0137] Explicit elements: characters (Snow White, the old woman in disguise as the Queen), setting (forest).
[0138] Hidden elements: emotional tone (tension), contradictions and conflicts (the queen's conspiracy).
[0139] Content Elements: Interior monologue (Snow White's fear).
[0140] (4) Plot point 4: The prince wakes Snow White up with a kiss.
[0141] Explicit elements: characters (Snow White, the Prince), setting (the dwarfs’ house).
[0142] Hidden elements: emotional tone (happiness), conflict (dispelling magic).
[0143] Content elements: Description of the environment (sunlight fills the room).
[0144] From the above embodiments, it can be seen that the script generation method provided by the present invention can comprehensively capture the key elements of plot points through the comprehensive application of explicit elements, implicit elements and content elements, ensure the richness and logical coherence of the script plot, effectively solve the problems of plot pattern convergence and weak character creation in the existing technology, and enhance the attractiveness and appeal of the script.
[0145] After extracting the plot point data from the target text based on the method provided in any of the above embodiments, a script narrative outline for guiding the generation of script content can be generated based on the plot point data.
[0146] The plot point data provides key plot elements, while the first chain of thought guidance provides the model with specific instructions for generating a script narrative outline. These instructions include processing steps and hierarchical structure constraints to ensure that the generated script narrative outline conforms to the expected structure and logic.
[0147] The first model generates a script narrative outline based on plot point data and the first chain of thought guidance. This outline typically includes a hierarchical structure of acts, scenes, and plot points, ensuring the script's logic and coherence. The combination of these two ensures the integrity and logic of the script narrative outline.
[0148] The first model is obtained by training an initial model using multiple plot point data samples and the script narrative outline labels corresponding to each plot point data sample. The training process uses supervised learning to learn how to use the plot point data to generate a script narrative outline that meets the requirements according to the guidance instructions of the first thought chain.
[0149] The initial model can be any large language model with strong text generation and comprehension capabilities. It can be trained through self-supervised learning on massive text data, demonstrating strong text generation capabilities and being able to generate a script narrative outline that meets the requirements based on the input plot point data and thought chain guidance instructions.
[0150] As an optional embodiment, the first thought chain guidance instruction is used to instruct the first model to generate a script narrative outline, which mainly includes: aggregating all plot points in the plot point sequence, and then generating a script narrative outline according to the script narrative structure and explicit elements. The hierarchical structure of the script narrative outline is defined as a multi-level hierarchy consisting of acts, scenes, and plot points.
[0151] Plot point sequence aggregation involves aggregating all plot points within a plot point sequence to form the basic structure of the script's narrative outline. This aggregation process analyzes the emotional and narrative changes between plot points to rationally structure the script, ensuring the integrity and logical coherence of each act. A script's narrative structure generally encompasses multiple stages, including introduction, development, climax, and denouement, based on the storyline. Generating a script's narrative outline based on the script's narrative structure ensures a logical progression of the plot and enhances the story's appeal.
[0152] The multi-level structure of acts, scenes, and plot points means that the generated script narrative outline includes at least one scene, and each scene is composed of one or more specific plot points, each describing a specific event or action. This hierarchical structure of acts, scenes, and plot points ensures the logic and coherence of the script content.
[0153] Next, we will continue to use "Snow White and the Seven Dwarfs" as an example to explain how to generate a script narrative outline based on plot point data.
[0154] Assume that the first thought chain guiding instruction is: "Set the processing steps for generating the script narrative outline to aggregate the sequence of plot points, and generate the script narrative outline according to the script narrative structure (beginning, development, climax, ending); set the hierarchical structure of the generated script narrative outline to include a hierarchical structure of scenes, scenes, and plot points." The plot point data can be collected in any of the aforementioned embodiments. The first thought chain guiding instruction and the plot point data are synchronously or successively input into the first model, so that the first model is used to use the plot point data as the basis and the first thought chain guiding instruction as the deduction direction. Through step-by-step reasoning, multiple consecutive plot points are aggregated and the script narrative outline is generated according to the script narrative structure. For example, the generated script narrative outline can be: (1) Act 1 (Beginning): 1.1. Scene 1: Snow White escapes to the forest.
[0155] Plot Point 1: Snow White escapes to the forest.
[0156] Explicit elements: character (Snow White), setting (forest).
[0157] Hidden elements: emotional tone (fear), conflict (escaping from the queen).
[0158] Content elements: Description of the environment (the darkness and danger of the forest).
[0159] (2) Act 2 (Development): 2.1. Scene 1: Snow White wanders in the forest.
[0160] Plot Point 2: Snow White seeks refuge in the forest.
[0161] Explicit elements: character (Snow White), setting (forest).
[0162] Hidden elements: emotional tone (anxiety), conflicts (hunger and fatigue).
[0163] Content elements: Description of the environment (the darkness and danger of the forest).
[0164] 2.2. Scene 2: Snow White meets the seven dwarfs.
[0165] Plot Point 3: Snow White meets the seven dwarfs.
[0166] Explicit elements: characters (Snow White, the Seven Dwarfs), setting (forest).
[0167] Hidden elements: emotional tone (warmth), relationship (building friendship).
[0168] Content elements: character dialogue (dialogue between Snow White and the dwarfs).
[0169] (3) Act 3 (Climax): 3.1. Scene 1: The Queen disguises herself as an old woman and approaches Snow White.
[0170] Plot Point 4: The Queen disguises herself as an old woman.
[0171] Explicit elements: characters (Snow White, the old woman in disguise as the Queen), setting (forest).
[0172] Hidden elements: emotional tone (tension), contradictions and conflicts (the queen's conspiracy).
[0173] Content Elements: Interior monologue (Snow White's fear).
[0174] 3.2. Scene 2: Snow White eats the poisoned apple.
[0175] Plot Point 5: Snow White eats the poisoned apple.
[0176] Explicit elements: character (Snow White), setting (forest).
[0177] Hidden elements: emotional tone (despair), conflict (poisoning).
[0178] Content elements: Action description (Snow White falls).
[0179] (4) Act 4 (End): 4.1. Scene 1: The prince finds Snow White.
[0180] Plot Point 6: The Prince finds Snow White.
[0181] Explicit elements: characters (Snow White, the Prince), setting (the dwarfs’ house).
[0182] Hidden elements: emotional tone (hope), conflict (the prince’s persistence).
[0183] Content elements: description of the environment (the dwarfs’ home).
[0184] 4.2. Scene 2: The prince wakes Snow White up with a kiss.
[0185] Plot Point 7: The prince wakes Snow White up with a kiss.
[0186] Explicit elements: characters (Snow White, the Prince), setting (the dwarfs’ house).
[0187] Hidden elements: emotional tone (happiness), conflict (dispelling magic).
[0188] Content elements: Description of the environment (sunlight fills the room).
[0189] The above examples demonstrate that the script generation method provided by the present invention, through the combination of plot point data and first thought chain guidance instructions, can conveniently and accurately generate a clearly structured and logically coherent script narrative outline. This effectively addresses the problem of a lack of hierarchy and logic in script structures in the prior art, improving the efficiency and quality of script generation. Furthermore, the hierarchical structure of scenes, scenes, and plot points ensures the richness and logical coherence of the script's plot.
[0190] For any target text, after completing the extraction of the script narrative outline, the script content can be further generated scene by scene based on the script narrative outline, mainly including but not limited to: The script narrative outline and the second thought chain guiding instructions are input into the second model to obtain the script content output by the second model.
[0191] The script narrative outline provides the structural framework for the script content, while the second thought chain guidance instructions provide specific guidance for the second model to generate the script content. The second thought chain guidance instructions mainly include scene numbers and at least one of the following requirements for the generated script content: content requirements, format requirements, logical consistency constraints, and style requirements.
[0192] The second model generates the specific script content based on the script's narrative outline and the second thought chain's guiding instructions. This content primarily includes scene descriptions, character dialogue, stage directions (for lighting, sound effects, prop usage, set changes, and other special effects), and action instructions (for the characters' movements, expressions, and demeanor during the performance).
[0193] Among them, format requirements mainly refer to requirements on script types, and the main formats include storyboards, stage plays, dramas, etc.; logical consistency constraint requirements refer to logical consistency constraint requirements for characters, storylines, etc. within and between acts; style requirements can include black humor, romanticism, etc.
[0194] The second model can be trained through multiple stages including unsupervised training, supervised fine-tuning (SFT), and reinforcement learning (RL) training, so as to gradually improve the quality of its generated script content and its ability to meet human preferences through training.
[0195] Based on the above embodiments, we continue to take "Snow White and the Seven Dwarfs" as an example to show the script content corresponding to each scene generated according to the script narrative outline (assuming that the script narrative outline has been extracted in any of the above embodiments).
[0196] (1) Act 1 (Beginning): Scene 1: In the forest, sunlight shines through the leaves, casting mottled shadows.
[0197] Character dialogue: Snow White says "I have to get away from here."
[0198] Action Instructions: Snow White runs quickly through the forest, looking nervous.
[0199] Description of the environment: The darkness and danger of the forest.
[0200] (2) Act 2 (Development): Scene 1: Snow White wanders in the forest, looking tired and hungry.
[0201] Character Dialogue: Snow White says "I need to find food and shelter."
[0202] Action Instructions: Snow White stops and looks around.
[0203] Description of the environment: The darkness and danger of the forest.
[0204] Scene 2: Outside the seven dwarfs' cottage, Snow White knocks on the door.
[0205] Character dialogue: The dwarf said, "Who are you?", and Snow White said, "I am Snow White, can you let me in?"
[0206] Action Instructions: The dwarfs open the door and greet Snow White in a friendly manner.
[0207] Description of the environment: The warmth and coziness of the cottage.
[0208] Act 3 (Climax): Scene 1: In the forest, an old woman hands Snow White an apple.
[0209] Character dialogue: The old woman said, "Eat an apple, it's very sweet." Snow White hesitated for a moment and took the apple.
[0210] Action instructions: Snow White takes a bite of the apple and then falls to the ground.
[0211] Description of the environment: The darkness and danger of the forest.
[0212] Scene 2: Inside the dwarfs' cottage, Snow White is lying on the ground, surrounded by the dwarfs.
[0213] Character Dialogue: The dwarf says "She was poisoned by the Queen's poisoned apple."
[0214] Action Instructions: The dwarfs anxiously discuss how to rescue Snow White.
[0215] Description of the environment: The tense atmosphere of the cabin.
[0216] Act 4 (End): Scene 1: Outside the dwarfs' hut, the prince arrives on horseback.
[0217] Character dialogue: The prince said, "I'm here to save you."
[0218] Action Instructions: The prince kissed Snow White and she slowly woke up.
[0219] Description of the environment: Sunlight fills the room, and the cottage is warm and happy.
[0220] Scene 2: In the dwarfs' cottage, Snow White and the prince smile at each other.
[0221] Character dialogue: Snow White said, "Thank you for saving me." The prince said, "I will always protect you."
[0222] Action instructions: The prince takes Snow White's hand and they walk out of the cottage.
[0223] Description of the environment: The sun shines on the forest, symbolizing a new beginning.
[0224] The script generation method provided by the present invention can generate script content with rich content and logical coherence through the combination of the script narrative outline and the second thought chain guiding instructions, effectively solving the problem of lack of logic and coherence in the script content in the prior art, and improving the efficiency and quality of script generation.
[0225] The following describes in detail how the present invention performs multi-stage training on the second model.
[0226] Figure 3 This is a flow chart of the second model training process provided by the present invention, such as Figure 3 As shown, it mainly includes but is not limited to the following steps: Step 31: Use the text corpus to perform unsupervised training on the initial large model to obtain a third model.
[0227] Step 32: Collect a first training data set and a second training data set.
[0228] Step 33: Use the first training data set and the second training data set to train the third model, and obtain instructions to fine-tune the trained fourth model.
[0229] Step 34: Perform reinforcement learning training on the fourth model to obtain the second model.
[0230] In step 31, a large-scale text corpus, such as novels, screenplays, and general text, is selected to perform unsupervised training on an initial large model. Through self-supervised learning, such as predicting the next word or filling in blanks, the initial large model learns common patterns and structures of the language, forming a third model. The initial large model can be a large language model with strong text generation capabilities.
[0231] In step 32, the first training dataset contains high-quality scripts and their corresponding script outlines. Each script outline has corresponding script generation instructions. The second training dataset contains a variety of script generation instructions and their corresponding script content. A rich variety of training samples can be generated by interpolating and expanding the script generation instructions.
[0232] In step 33, the third model is fine-tuned on the first and second training datasets, enabling the resulting fourth model to generate script content that meets the requirements based on the script narrative outline. This fine-tuning process uses supervised learning and a cross-entropy loss function to optimize model parameters, improving the model's responsiveness to script generation instructions and the quality of generated content.
[0233] In step 34, a reward model (RM) is constructed to evaluate the quality of the script content generated by the fourth model based on factors such as plot coherence, character consistency, and dramatic conflict intensity. This model is then trained using a pre-set strategy optimization algorithm through reinforcement learning. The reward signal optimizes the model parameters to produce the final script generation model (i.e., the second model). This reinforcement learning training further enhances the model's ability to generate script content with improved logic, coherence, and alignment with human preferences, ensuring the quality of the generated script.
[0234] The script generation method provided by the present invention can train a high-quality script generation model through a combination of unsupervised training, instruction fine-tuning and reinforcement learning training, effectively solving the problem of lack of logic and coherence in script generation in the existing technology, and improving the efficiency and quality of script generation.
[0235] It should be noted that the present invention can use the big data model to generalize the script narrative outline and obtain the script generation instructions corresponding to each script narrative outline, that is, use the big data model to construct the correspondence between the script generation instructions and the script narrative outline.
[0236] Specifically, the big data model can create a variety of different script generation instructions based on its training data and generation capabilities. These instructions can cover different styles (such as black humor and romanticism), structures (such as three-act plays and circular narratives), and audiences (such as children's plays and elderly themes). Based on these diverse script generation instructions, the big data model further generates script narrative outlines that match these instructions. These script narrative outlines follow a specific script structure, such as a multi-layered structure consisting of acts, scenes, and plot points, to ensure the logic and coherence of the script content.
[0237] Figure 4 This is a flow chart of constructing the first training data set provided by the present invention. Figure 4 The specific steps for collecting the first training dataset are described in detail, including but not limited to: Collect multiple script contents (generally referring to high-quality scripts).
[0238] Input any script content into the first language model, obtain the diversified script generation instructions output by the first language model, and obtain the consistency score between each script generation instruction and the any script content.
[0239] The script generation instructions and the script narrative outline with the highest consistency score are selected to form a training sample.
[0240] Repeat the above steps until the training samples corresponding to each script content are obtained, and the first training data set can be constructed.
[0241] In this embodiment, high-quality script content can be collected from existing script libraries or creative resources. Preferably, this script content covers a variety of genres and styles to ensure diversity and representativeness of the training data. Any collected script content is input into the first language model, which generates a variety of script generation instructions based on the script content and scores the consistency of each script generation instruction with the script content.
[0242] Furthermore, from the multiple script generation instructions generated by the first language model, the one with the highest consistency score with the script content is selected. This script generation instruction can accurately reflect the key features and requirements of the script.
[0243] The selected script generation instructions are combined with the corresponding script narrative outline to form a training sample. The script narrative outline can be extracted from the original script content through automatic or manual annotation, and contains a multi-layered structure of scenes, scenes, and plot points, thus completing the collection of a training sample.
[0244] Repeat the above steps to collect multiple training samples to construct a first training dataset. This first training dataset is primarily used for subsequent instruction fine-tuning training of the fourth model, helping the fourth model learn how to generate a script narrative outline that meets the requirements based on the script generation instructions.
[0245] The first training data set collected through the above steps can effectively improve the learning effect of the script generation model in instruction fine-tuning training, enabling the script generation model to generate high-quality script narrative outlines based on the script generation instructions, thereby improving the accuracy and efficiency of script generation.
[0246] Figure 5 This is a flow chart of constructing the second training data set provided by the present invention. Figure 5 The steps for collecting the second training dataset are further described, including but not limited to: Build multiple types of script generation instruction sets; Input any script generation instruction in the script generation instruction set into the second largest language model to obtain multiple script contents output by the second largest language model; Filter out the script content with the highest quality score and form a training sample with the script narrative outline obtained from any script generation instruction; Iteratively repeat the above steps until the above script generation instruction set is traversed, and the training samples corresponding to all the script generation instructions therein are obtained to construct the second training data set.
[0247] Specifically, we first need to create a set of script generation instructions that encompass a variety of genres. These instructions should cover a variety of styles (e.g., black humor, romanticism), structures (e.g., three-act play, circular narrative), and audiences (e.g., children's plays, elderly-themed dramas), ensuring both diversity and richness.
[0248] Each script generation instruction in the constructed script generation instruction set is input into the second language model, which then generates multiple script contents based on each input script generation instruction. This step can be achieved by adjusting the temperature coefficient of the second language model. That is, for the same script generation instruction seat input, by adjusting different temperature coefficients, different outputs from the second language model can be obtained, that is, multiple different script contents.
[0249] Furthermore, for each script generation instruction, the quality of the multiple scripts generated by it is evaluated, and the scripts with the highest quality scores are selected. The quality assessment can refer to dimensions such as plot coherence, character consistency, and dramatic conflict intensity.
[0250] The screened script content with the highest quality score and the script narrative outline corresponding to the script generation instructions are combined into training samples.
[0251] Among them, the script narrative outline is obtained by inputting the script generation instructions into the large language model in a generalized manner based on the large model provided in the above embodiment, which will not be elaborated here.
[0252] Repeat the above steps until the entire script generation instruction set is traversed, and multiple training data are obtained to construct a second training data set.
[0253] As an optional embodiment, after constructing multiple types of script generation instruction sets, it is also possible to generate diverse script generation instructions with richer requirements through instruction interpolation. The script generation instruction set can be interpolated by the following means: Combining different types of script generation instructions; and / or, performing element expansion on the script generation instructions; and / or, modify some elements of the script generation instructions.
[0254] Combining different types of script generation instructions refers to combining different types of script generation instructions to generate new instructions. For example, combining "generate a black comedy script" and "generate a three-act play script" into "generate a three-act play script with a black comedy style."
[0255] Expanding script generation instructions means adding new elements or requirements to existing script generation instructions to create more complex ones. For example, expanding "Generate a romantic-style script" to "Generate a romantic-style script with suspense elements and a multi-line narrative structure" might be enough.
[0256] Modifying certain elements of a script generation instruction means modifying some elements of an existing script generation instruction to generate new instructions. For example, modifying "Generate a school fantasy script suitable for children" to "Generate a school fantasy script suitable for teenagers, with growth themes and friendship elements."
[0257] The present invention can significantly expand the diversity and complexity of script generation instructions through instruction interpolation processing. Instruction combination allows the script generation model to handle script generation tasks of various styles and structures. Element expansion improves the guidance and complexity of instructions, enabling the script generation model to adapt to more complex script generation needs, while element modification ensures that the script generation model can be flexibly adjusted to meet different script creation requirements. The combination of the above-mentioned interpolation methods enhances the adaptability and flexibility of the script generation model, ensuring that the generated script content can meet the diverse style and structure requirements, thereby improving the quality and efficiency of script generation.
[0258] The following will continue to explain how to use the first training data set and the second training data set to train the above-mentioned third model. This training process specifically belongs to the instruction fine-tuning stage in the multi-stage training.
[0259] Figure 6 : is a flow chart of training the third model to obtain the fourth model provided by the present invention, such as Figure 6 As shown, it mainly includes but is not limited to the following steps: Obtaining any training sample from the first training data set and the second training data set, using the script narrative outline in the training sample as a model input of a third model, and obtaining an output result of the third model; The script content in the training sample is set as the output label, and the model parameters of the third model are adjusted according to the difference between the output result and the output label; Iteratively execute the step of obtaining any training sample from the first training data set and the second training data set, to the step of adjusting the model parameters of the third model according to the difference between the output result and the output label, until the model training cutoff condition is met, and obtain the instruction to fine-tune the trained fourth model.
[0260] Specifically, after obtaining the first training data set and the second training data set based on any of the above embodiments, each training sample contained in the two includes a script narrative outline and corresponding script content (which can be called a script narrative outline and script data pair).
[0261] During actual training, the script outline from any training sample can be used as input to the third model to obtain the model's output. The third model will output the generated script content (called the output) based on the input script outline.
[0262] Compare the difference between the output result of the third model and the output label (that is, the script content of any of the above training samples) and calculate the loss value using the loss function.
[0263] The loss function used may be a cross entropy loss function, a mean square error loss function, or other custom loss functions.
[0264] Finally, the parameters of the third model can be adjusted according to the loss value to minimize the difference between the output result and the output label, thus completing one iterative training of the third model using one training sample.
[0265] Repeat the above steps, retrieve new training samples from the training data set and continue to iteratively train the third model until the model training cutoff condition is met, and the fourth model after instruction fine-tuning is obtained.
[0266] The above-mentioned model training cutoff condition can be reaching a preset maximum number of training rounds, such as setting a maximum number of training rounds (such as 100 rounds), and stopping training when the training reaches this number of rounds.
[0267] The training cutoff condition can also be the convergence of the loss value. For example, when the loss function value of the model no longer decreases significantly in multiple consecutive training rounds (for example, the change is less than a certain threshold, such as 0.001), it means that the model has converged and training can be stopped.
[0268] The training cutoff condition can also be that the performance of the validation set no longer improves, the learning rate decays to a threshold, or the training time limit.
[0269] Through the fine-tuning training process described above, the third model learned how to generate script content that meets the requirements based on the script's narrative outline. The script's narrative outline provides the script's structural framework, while the script's content provides the specific details and logic. Through continuous iterative training, the script generation model gradually improved the accuracy and logic of the generated script content, ensuring consistency between the generated script content and the script's narrative outline, thereby improving the quality and efficiency of script generation.
[0270] The following further describes how the present invention performs reinforcement learning training on the fourth model to obtain the second model.
[0271] Figure 7This is a flow chart of the present invention for performing reinforcement learning training on the fourth model to obtain the second model, as an optional implementation. Figure 7 The following implementation steps are mainly included but not limited to: Step 71: Using the script narrative outline corresponding to any script generation instruction as input to the fourth model, and obtaining the script content output by the fourth model; Step 72: calling the reward model to evaluate the script content to determine the total reward value of the fourth model based on the evaluation results; Step 73 : Based on a preset strategy optimization algorithm, with the goal of maximizing the total reward value, iteratively update the model parameters of the fourth model to obtain the second model.
[0272] The script generation method provided by the present invention adopts a multi-stage training method in the training process of the script generation model, which mainly includes a combination of unsupervised training, instruction fine-tuning training and reinforcement learning training, and gradually trains to obtain a script generation model with generalization ability (i.e., the second model in the above embodiment).
[0273] In the reinforcement learning training stage involved in this embodiment, the script generation model is mainly optimized by utilizing the score provided by the reward model for the script content generated by the model, including: using the fourth model after instruction fine-tuning as the rated initial strategy model in the reinforcement learning training stage, iteratively generating answers through a preset strategy optimization algorithm and calculating the total reward value, which is determined based on the score value of the reward model.
[0274] The following is a brief description of the specific implementation steps of reinforcement learning training.
[0275] The script narrative outline corresponding to any script generation instruction is used as the input of the fourth model. The script narrative outline provides the structural framework of the script, including a hierarchical structure of acts, scenes and plot points.
[0276] The fourth model will generate the corresponding script content based on the input script narrative outline, which includes scene descriptions, character dialogues, stage instructions, and action instructions.
[0277] The generated script content is evaluated using a reward model, which scores the currently generated script content based on multiple dimensions (such as plot coherence, character consistency, and dramatic conflict intensity).
[0278] Furthermore, the total reward value of the fourth model can be calculated based on the score output by the reward model.
[0279] In order to prevent the strategy from deviating from the initial model during training, as an optional embodiment, the total reward value can be determined based on the combination of the score value of the reward model and the KL divergence penalty term. The specific calculation formula can be expressed as: Total reward value = RM score - β*KL divergence; Where RM score is the score output by the reward model, and β is a coefficient that controls the influence of KL divergence, which is the difference between the model output distribution and the initial model output distribution.
[0280] Furthermore, the policy optimization algorithm adopted in this embodiment may be a Proximal Policy Optimization (PPO) algorithm, or other policy optimization algorithms such as a Trust Region Policy Optimization (TRPO) algorithm, and the present invention does not impose any specific limitation on this.
[0281] Furthermore, based on a preset PPO algorithm, the model parameters of the fourth model are iteratively updated with the goal of maximizing the total reward value.
[0282] Repeat the above steps, continuously input new script narrative outlines, generate script content, evaluate rewards, and update model parameters until the model training cutoff conditions are met (such as loss value convergence or reaching the preset maximum number of training rounds), and obtain the final script generation model (i.e., the second model mentioned in the above embodiment).
[0283] During the reinforcement learning training process provided by this invention, the resulting script generation model is ensured to generate high-quality script content through the evaluation of the reward model and the iterative updating of the strategy optimization algorithm. The multi-dimensional evaluation of the reward model ensures the logic and coherence of the script content, while the strategy optimization algorithm further improves the quality of the generated content by maximizing the reward value. These two approaches combine the advantages of supervised fine-tuning and reinforcement learning, enabling the model to generate script content that conforms to human preferences. This effectively addresses the lack of logic and coherence in script generation in the existing technology, and improves the efficiency and quality of script generation.
[0284] As an optional embodiment, the present invention further includes the following improvements when iteratively updating the model parameters of the fourth model based on a preset strategy optimization algorithm with the goal of maximizing the total reward value: Set the clip range of the PPO algorithm (clip range); and / or, setting a script generation reference model with fixed parameters as a reference when updating the model parameters of the fourth model; And / or, using a critic network to evaluate the value of the script content to generate a reward signal, and including the reward signal in the total reward value.
[0285] In the PPO algorithm, a clipping range is used to limit the magnitude of policy updates, preventing excessive updates from causing degradation in model performance. In the reinforcement learning process of the scenario generation model, this paper sets a clipping range to prevent performance fluctuations or degradation during training. This ensures that policy updates occur within a certain range, thereby ensuring the stability and convergence of the training process.
[0286] During reinforcement learning training, a fixed-parameter script generation reference model is introduced as a reference for updating the parameters of the fourth model. This provides a stable baseline, ensuring that the new model does not deviate from the correct direction during the update process, thereby improving training stability and efficiency.
[0287] The critic network is used to evaluate the value of the generated script content to provide additional reward signals. The present invention combines these reward signals with the score value of the reward model and uses them as the total reward value to guide the update of the model. This can help the model better understand the quality of the generated content, thereby more effectively optimizing the strategy and improving the logic and coherence of the generated script.
[0288] In the above embodiment, the training of the reward model is not considered for the time being. The following briefly explains how the present invention implements the training of the above reward model.
[0289] Figure 8 This is a flow chart of training the reward model provided by the present invention, as an optional embodiment, such as Figure 8 As shown, the training steps mainly include but are not limited to the following: Obtain the script narrative outline corresponding to any script generation instruction in the script generation instruction set; The script narrative outline is used as the input of the fourth model, and all script contents output by the fourth model are obtained by adjusting the temperature coefficient of the fourth model; Sampling a preset number of candidate script contents from all script contents, and determining the actual quality scores and relative quality rankings of all candidate script contents; Take any script generation instruction and any corresponding candidate script content as input to the reward model, and obtain the score value output by the reward model; The goal is to maximize the reward probability of candidate script content with high scores and minimize the reward probability of candidate script content with low scores, and adjust the model parameters of the reward model according to the score value; Iteratively execute the steps of obtaining the script narrative outline corresponding to any script generation instruction in the script generation instruction set to adjusting the model parameters of the reward model according to the score value until the model training cutoff condition is met, and obtain a trained reward model.
[0290] Before training the reward model, it is necessary to first perform data labeling for the reward model. Specifically, the script generation instruction set constructed in any of the above embodiments can be expanded using the prompt enhancement method to generate a new script generation instruction set consisting of a variety of script generation instructions.
[0291] Furthermore, a big data model is used to generate a corresponding script narrative outline from each script generation instruction in the script generation instruction set, ensuring coverage of diverse topics and scenarios to enhance generalization capabilities.
[0292] The script's narrative outline is used as input to the fourth model, which generates multiple scripts by setting different temperature coefficients. The temperature coefficient controls the randomness of the fourth model's output; higher temperature values increase output diversity, while lower temperature values make the output more deterministic.
[0293] A preset number of candidate script contents can be sampled for each script narrative outline, and each candidate script content can be quality-scored and ranked relative to its quality. The quality score can be based on dimensions such as plot coherence, character consistency, and intensity of dramatic conflict. For example, if any script narrative outline a is used as the input to the fourth model, and the number of script contents obtained is 10, 5 of them can be selected as candidate script contents through sampling. Then, the actual quality scores of these 5 candidate script contents are determined separately, and finally, these candidate script contents are ranked according to their actual quality scores to obtain a relative quality ranking.
[0294] By iteratively executing the above steps, multiple sets of third training data sets for reward model training can be obtained, where each training sample includes a model input sample consisting of a script generation instruction and a corresponding candidate script content, and the label of the model input sample is the actual quality score calculated above.
[0295] When actually training the reward model, a contrastive learning strategy is often adopted, and multiple sets of training data related to the same script generation instructions are treated as a batch.
[0296] On the one hand, the model input samples are used as input to the reward model, and the reward model outputs a score value. Based on minimizing the cross-entropy loss, the model parameters of the reward model are adjusted according to the gap between the score value and the label of the model input sample.
[0297] On the other hand, the goal is to maximize the reward probability of candidate script content with high scores and minimize the reward probability of candidate script content with low scores. According to the score values of different model input samples composed of multiple instructions generated by the reward model for the same script, the model parameters of the reward model are adjusted to maximize the reward probability of human-preferred answers.
[0298] Repeat the above steps until the model training cutoff condition is met (such as the loss value converges or the preset maximum number of training rounds is reached), and the trained reward model can be obtained.
[0299] During the training of the reward model, regularization (such as weight decay, that is, adding a weight decay term to the loss function) and early stopping can be combined to prevent overfitting.
[0300] Early stopping refers to stopping training early if the reward model's performance on the validation set stops improving during training to avoid overfitting. In practice, this is typically done by setting a patience value (e.g., if validation set performance doesn't improve for three consecutive epochs). Training is stopped when the patience value is reached.
[0301] Since the script generation method provided by the present invention generally operates by generating script content scene by scene, there may be extra characters, plots, or props that are not part of the main plot, resulting in incoherence or logical conflicts between scenes. Therefore, the present invention proposes to add a step of checking the script content after generating the script content based on the script narrative outline to further control the quality and logic of the script content, mainly including but not limited to: Check the consistency between the script content corresponding to each act and the script narrative outline, check the continuity of the script content between adjacent acts, and the integrity of the overall script composed of all the script content.
[0302] The consistency check between the script content and the script's narrative outline primarily involves checking, through rule matching and semantic analysis, whether the relevant timeline, character relationships, plot opening and closing of each act are consistent with the script's narrative outline. Rule matching primarily checks whether the timeline conforms to the script's narrative outline, whether character relationships are consistent with the script's narrative outline, and whether the plot's opening and closing logic conform to the script's narrative outline. Semantic analysis utilizes natural language processing technology to analyze the consistency of the script content with the script's narrative outline, ensuring that individual script content does not deviate from the script's narrative outline.
[0303] Each act can be scored based on the results of the consistency check. The scoring criteria may include timeline consistency, character relationship accuracy, plot logic, etc. Acts with scores below a preset threshold need to be regenerated.
[0304] Verifying the continuity of the script content between adjacent acts involves checking the script content, starting from the beginning and ending in the narrative order of the script outline, for plot conflicts, repetitions, logical conflicts, or incoherence. A comprehensive score is then generated for the continuity between the two acts. If the score exceeds a preset threshold, the next step of verification is carried out; otherwise, the generated script content is deemed unusable.
[0305] The integrity of the entire script, comprising all its content, involves a text quality check of the entire script, including its plot consistency, logical coherence of the scenes, and the integrity and plausibility of the main characters' plots. This scoring process is conducted through a summary of the language model, extracting the script's plot and character development for analysis and scoring.
[0306] So far, the specific implementation steps of the script generation method provided by the present invention have been fully introduced through all the above embodiments. The following is a review of the limitations of the prior art previously proposed and a brief explanation of how the present invention specifically addresses these limitations.
[0307] (1) To address the problem of narrative logic being difficult to maintain in existing technologies, the present invention adopts a hierarchical modeling method to structure the storyline, construct plot points and a hierarchical script narrative outline, and ensure the coherence and causal relationship of the script plot. At the same time, during the script generation process, the script content is generated scene by scene based on the script narrative outline, ensuring that the script content related to each scene is consistent with the script narrative outline, avoiding plot gaps, and effectively solving this problem.
[0308] (2) To address the problem of plot model convergence in existing technologies, this invention adopts a multi-stage training method, specifically a method that combines instruction fine-tuning and reinforcement learning training. Through different thought chain guidance instructions (such as style instructions, structure instructions, audience instructions, etc.), a variety of script content is generated. During the training process, rewards are optimized through manual scoring and reward models to encourage the generation of innovative plot structures.
[0309] (3) In response to the problem of weak character creation in the existing technology, the present invention focuses on extracting implicit elements related to the character's emotions and behaviors when extracting plot points to ensure the consistency of the character's role creation. In addition, during the script content generation process, the thought chain guidance method can be used to generate thought chain guidance instructions based on the character's personality traits and emotional state to avoid confusion about the character's identity.
[0310] (4) To address the problem of insufficient dramatic tension in existing technologies, the present invention focuses on the emotional dimension between plot points and the changes in the script's narrative structure when generating the script's narrative outline, rationally divides the script's hierarchical structure, and constructs an effective conflict escalation mechanism. Furthermore, during the script generation process, the dramatic conflict and suspense settings of the script are optimized through reinforcement learning training, thereby enhancing dramatic tension.
[0311] Figure 9 This is a schematic diagram of the structure of the script generation device provided by the present invention. Figure 9 As shown, it mainly includes but is not limited to the following components: The plot point data extraction module 91 is mainly used to determine the plot point data in the target text. The plot point data includes the plot point sequence corresponding to the target text and the plot elements related to each plot point in the plot point sequence.
[0312] The script narrative outline extraction module 92 is mainly used to generate a script narrative outline based on the plot point data.
[0313] The script content generation control module 93 is mainly used to generate script content based on the script narrative outline.
[0314] It should be noted that the script generation device provided by the present invention can execute the script generation method described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0315] The script generation device provided by the present invention starts from the novel text and structures the plot nodes and plot elements related to the plot nodes through hierarchical modeling of the object text, so as to generate a complete script scene by scene according to the obtained hierarchical script narrative outline, which can ensure the richness of the script plot, the consistency of the characters and the logical coherence of the script content, and can effectively avoid plot gaps or contradictions.
[0316] Figure 10 Schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 10 As shown, the electronic device may include: a processor 1010, a communications interface 1020, a memory 1030, and a communications bus 1040, wherein the processor 1010, the communications interface 1020, and the memory 1030 communicate with each other via the communications bus 1040. The processor 1010 may invoke logic instructions in the memory 1030 to execute a script generation method, which includes: determining plot point data in a target text, the plot point data including a plot point sequence corresponding to the target text and plot elements associated with each plot point in the plot point sequence; generating a script narrative outline based on the plot point data; and generating script content based on the script narrative outline.
[0317] Furthermore, the logic instructions in the aforementioned memory 1030 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0318] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the script generation method provided by the above-mentioned embodiments, which method includes: determining plot node data in the object text, the plot node data including the plot node sequence corresponding to the object text and the plot elements related to each plot node in the plot node sequence; generating a script narrative outline based on the plot node data; and generating script content based on the script narrative outline.
[0319] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the script generation method provided in the above-mentioned embodiments, the method comprising: determining plot node data in an object text, the plot node data including a plot node sequence corresponding to the object text and plot elements related to each plot node in the plot node sequence; generating a script narrative outline based on the plot node data; and generating script content based on the script narrative outline.
[0320] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0321] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.
[0322] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A script generation method, characterized in that: include: Determining plot point data in the target text, the plot point data including a plot point sequence corresponding to the target text and plot elements associated with each plot point in the plot point sequence; generating a script narrative outline based on the plot point data; Generate script content based on the script narrative outline.
2. The script generation method according to claim 1, characterized in that The step of determining plot point data in the object text includes: Locating each plot change node in the target text, wherein the plot change node is determined based on at least one of a character change, a scene change, or a relationship change; Determining the plot node sequence according to the plot change nodes; Based on a pre-constructed literary feature tag system, structured extraction is performed on text fragments related to each plot point in the plot point sequence to obtain the plot elements related to each plot point.
3. The script generation method according to claim 2, characterized in that: Based on a pre-built literary feature tag system, a structured extraction is performed on the text fragments related to each plot point in the plot point sequence to obtain the plot elements related to each plot point, including: Performing structured extraction of the text fragments related to each of the plot points from at least one of a narrative mode dimension, an emotional dimension, and a structural dimension; The narrative mode dimension includes a label dimension composed of at least one of dialogue guidance, inner monologue and environmental description; the emotional dimension includes a label dimension composed of at least one of emotional polarity and emotional intensity; and the structural dimension includes a label dimension composed of at least one of foreshadowing, reversal and preparation.
4. The script generation method according to claim 2, characterized in that: The plot elements include one of explicit elements, implicit elements and content elements; The explicit elements include at least one of characters, scenes, relationships, and plots; the implicit elements include at least one of emotional tone, contradictions and conflicts, and foreshadowing clues; and the content elements include at least one of character dialogues and environmental descriptions.
5. The script generation method according to claim 4, characterized in that: Generating a script narrative outline based on the plot point data includes: Inputting the plot point data and the first thought chain guiding instruction into the first model to obtain the script narrative outline output by the first model; The first thought chain guiding instruction is used to instruct the first model to generate the script narrative outline according to the plot point data, and to define the hierarchical structure of the script narrative outline; The first model is obtained by training an initial model using a plurality of plot point data samples and a script narrative outline label corresponding to each of the plot point data samples.
6. The script generation method according to claim 5, characterized in that: The processing steps include aggregating all plot nodes in the plot node sequence and generating the script narrative outline according to the script narrative structure and the explicit elements; the hierarchical structure is a multi-level hierarchical structure consisting of scenes, scenes and plot nodes.
7. The script generation method according to claim 1, characterized in that: Generating the script content based on the script narrative outline includes: Inputting the script narrative outline and the second thought chain guiding instruction into the second model to obtain the script content output by the second model; The second thought chain guiding instruction includes a scene number and at least one of content requirements, format requirements, logical consistency constraint requirements and style requirements for the generated script content.
8. The script generation method according to claim 7, characterized in that: The second model is trained based on the following steps: Use the text corpus to perform unsupervised training on the initial large model to obtain the third model; Collecting a first training data set and a second training data set; Using the first training data set and the second training data set, the third model is trained to obtain a fourth model after instruction fine-tuning training; Perform reinforcement learning training on the fourth model to obtain the second model.
9. The script generation method according to claim 8, characterized in that: The first training data set is collected based on the following steps: Collect multiple script contents; Inputting any script content into a first language model, obtaining a variety of script generation instructions output by the first language model, and a consistency score between each script generation instruction and the any script content; Filtering the script generation instruction with the highest consistency score and forming a training sample with the script narrative outline obtained from the script generation instruction; Obtain training samples corresponding to all the script contents to construct the first training data set; the second training data set is collected based on the following steps: Build multiple types of script generation instruction sets; Input any script generation instruction in the script generation instruction set into the second largest language model, and obtain multiple script contents output by the second largest language model; Screening out the script content with the highest quality score and forming a training sample with the script narrative outline obtained by any of the script generation instructions; Obtain training samples corresponding to all the script generation instructions in the script generation instruction set to construct the second training data set.
10. The script generation method according to claim 8, characterized in that: The method of training the third model using the first training data set and the second training data set to obtain instructions for fine-tuning the trained fourth model includes: Obtaining any one training sample from the first training data set and the second training data set, using the script narrative outline in the training sample as a model input of the third model, and obtaining an output result of the third model; Setting the script content in the training sample as an output label, and adjusting the model parameters of the third model according to the difference between the output result and the output label; Iteratively execute the step of obtaining any training sample from the first training data set and the second training data set, to the step of adjusting the model parameters of the third model according to the difference between the output result and the output label, until the model training cutoff condition is met, and obtain the fourth model.
11. The script generation method according to claim 9, characterized in that: After constructing multiple types of script generation instruction sets, interpolation processing is performed on the script generation instruction sets, specifically including: Combining different types of script generation instructions; and / or, performing element expansion on the script generation instruction; And / or, modify some elements in the script generation instructions.
12. The script generation method according to claim 9, characterized in that: The performing reinforcement learning training on the fourth model to obtain the second model includes: Taking the script narrative outline corresponding to any script generation instruction as the input of the fourth model, and obtaining the script content output by the fourth model; Calling a reward model to evaluate the script content to determine a total reward value of the fourth model based on the evaluation result, wherein the total reward value includes a score output by the reward model for evaluating the script content and a KL divergence penalty term; Based on a preset strategy optimization algorithm, with the goal of maximizing the total reward value, the model parameters of the fourth model are iteratively updated to obtain the second model.
13. The script generation method according to claim 12, characterized in that: The preset strategy optimization algorithm is a proximal strategy optimization algorithm; When iteratively updating the model parameters of the fourth model based on a preset strategy optimization algorithm with the goal of maximizing the total reward value, the method includes: Setting the clipping range of the proximal strategy optimization algorithm; and / or, setting a script generation reference model with fixed parameters as a reference when updating the model parameters of the fourth model; And / or, using a critic network to evaluate the value of the script content to generate a reward signal, and including the reward signal in the total reward value.
14. The script generation method according to claim 12, wherein: The reward model is trained based on the following method: Obtaining a script narrative outline corresponding to any script generation instruction in the script generation instruction set; Taking the script narrative outline as input to the fourth model, and adjusting the temperature coefficient of the fourth model to obtain all script contents output by the fourth model; Sampling a preset number of candidate script contents from all the script contents, and determining actual quality scores and relative quality rankings of all the candidate script contents; Taking any of the script generation instructions and any of the corresponding candidate script contents as inputs to the reward model, and obtaining a score value output by the reward model; Adjusting the model parameters of the reward model according to the score values with the goal of maximizing the reward probability of candidate script content with high score values and minimizing the reward probability of candidate script content with low score values; Iteratively execute the steps of obtaining the script narrative outline corresponding to any script generation instruction in the script generation instruction set to adjusting the model parameters of the reward model according to the scoring value until the model training cutoff condition is met, and obtain the reward model that has completed training.
15. A script generation device, characterized in that: include: a plot point data extraction module for determining plot point data in a target text, wherein the plot point data includes a plot point sequence corresponding to the target text and plot elements related to each plot point in the plot point sequence; A script narrative outline extraction module, for generating a script narrative outline based on the plot point data; The script content generation control module is used to generate script content based on the script narrative outline.
16. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, it implements the script generation method as described in any one of claims 1 to 14.
17. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the script generation method as described in any one of claims 1 to 14.
18. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the script generation method as described in any one of claims 1 to 14.
Citation Information
Cited By
Original script-oriented AI autonomous plot structure adaptive generation system
CN121233763A
Method and system for automatically generating 3D scene interaction script based on large language model
CN121303094A
Scenario-centered interaction-driven scene generation system
CN121364778A
Script-centric, interactive, drive scene generation system
CN121364778B
Multi-stage scene linkage AI interactive narrative generation and management method
CN121412419A