Model training and content generation method and device

By constructing multi-level training sets and supervised fine-tuning technology, the instruction following ability of the cross-modal content generation model is improved, the deficiencies in generation accuracy and user experience of existing models are solved, and more accurate content generation is achieved.

CN118586455AActive Publication Date: 2024-09-03BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Application Number
CN202410628333.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-09-03
Estimated Expiration
2044-05-20

AI Technical Summary

Technical Problem

Cross-modal artificial intelligence content generation models have shortcomings in the ability to follow instructions. Especially in the generation of Vincent pictures or Vincent videos, it is difficult to strictly follow the given prompt words, resulting in inaccuracy of generated content and degradation of user experience.

Method used

By constructing a first training set containing entity pictures and picture description information, the entity cognitive ability of the content generation model is trained, and a second training set containing modification relationship information between words is constructed to train the model's entity detail characterization ability, combined with pre-training The language model undergoes supervised fine-tuning to understand and generate content that conforms to instructions.

Benefits of technology

It significantly improves the instruction following ability of the content generation model, improves the accuracy and user experience of generated content, ensures that the model can correctly identify and depict entities and their details, and enhances the understanding of the relationship between prompt word modifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118586455A
    Figure CN118586455A
Patent Text Reader

Abstract

The invention provides a model training and content generation method and device, and relates to the artificial intelligence fields of large models, deep learning, natural language processing, knowledge maps and the like. The AIGC model training method comprises the steps that a first training set is constructed, the first training set comprises a first training sample, and the first training sample comprises a first training picture corresponding to any entity and picture description information of the first training picture; training the entity cognitive ability of the first content generation model by using the first training set to obtain a second content generation model; a second training set is constructed, the second training set comprises a second training sample, and the second training sample comprises modification relation information between words in the target cue word and a second training picture matched with the target cue word; and training the entity detail description capability of the second content generation model by using the second training set to obtain a third content generation model. By applying the scheme, the instruction following capability and the like of the content generation model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to model training and content generation methods and devices in the fields of large models, deep learning, natural language processing, and knowledge graphs. Background Art

[0002] For cross-modal AIGC (Artificial Intelligence Generated Content) models, it is necessary to improve their instruction following (prompt following) capabilities. Cross-modality refers to text-generated images or text-generated videos, etc. Instruction following capability refers to whether it can strictly follow the given prompt to generate content. Summary of the invention

[0003] The present disclosure provides a model training and content generation method and device.

[0004] A content generation model training method, comprising:

[0005] Constructing a first training set, wherein the first training set includes a first training sample, wherein the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture;

[0006] Using the first training set to train the entity recognition ability of the first content generation model to obtain a second content generation model;

[0007] Constructing a second training set, wherein the second training set includes a second training sample, wherein the second training sample includes: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word;

[0008] The second training set is used to train the entity detail depiction capability of the second content generation model to obtain a third content generation model.

[0009] A content generation method, comprising:

[0010] Obtaining an input prompt word to be processed, and obtaining modification relationship information between words in the prompt word to be processed;

[0011] The modification relationship information is used as the input of the target model to obtain the content generation result corresponding to the prompt word to be processed, and the target model is the third content generation model trained by the above method.

[0012] A modification relationship discrimination model training method, comprising:

[0013] Constructing a third training set, wherein the third training set includes a third training sample, and the third training sample includes: a sample prompt word;

[0014] The pre-trained large language model is subjected to supervised fine-tuning training using the third training set to obtain the modification relationship discrimination model; the modification relationship discrimination model is used to construct a second training set, the second training set includes a second training sample, the second training sample includes: modification relationship information between words in the target prompt word determined using the modification relationship discrimination model, and a second training picture matching the target prompt word, the second training set is used to train the entity detail depiction ability of the second content generation model to obtain a third content generation model, the second content generation model is obtained after the first content generation model is trained for entity recognition ability using the first training set, the first training set includes a first training sample, the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture; the modification relationship discrimination model is also used to determine the modification relationship information of the input prompt word to be processed when the third content generation model is used to generate content.

[0015] A content generation model training device, comprising: a first training module and a second training module;

[0016] The first training module is used to construct a first training set, the first training set includes a first training sample, and the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture; the entity recognition ability of the first content generation model is trained by using the first training set to obtain a second content generation model;

[0017] The second training module is used to construct a second training set, which includes a second training sample. The second training sample includes: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word; using the second training set, the entity detail depiction ability of the second content generation model is trained to obtain a third content generation model.

[0018] A content generation device, comprising: an acquisition module and a generation module;

[0019] The acquisition module is used to acquire the input prompt word to be processed, and acquire the modification relationship information between the words in the prompt word to be processed;

[0020] The generation module is used to use the modification relationship information as the input of the target model to obtain the content generation result corresponding to the prompt word to be processed, and the target model is the third content generation model trained by the above device.

[0021] A modification relationship discrimination model training device comprises: a construction module and a training module;

[0022] The construction module is used to construct a third training set, wherein the third training set includes a third training sample, and the third training sample includes: a sample prompt word;

[0023] The training module is used to perform supervised fine-tuning training on the pre-trained large language model using the third training set to obtain the modification relationship discrimination model; the modification relationship discrimination model is used to construct a second training set, the second training set includes a second training sample, the second training sample includes: modification relationship information between words in the target prompt word determined using the modification relationship discrimination model, and a second training picture matching the target prompt word, the second training set is used to train the entity detail depiction ability of the second content generation model to obtain the third content generation model, the second content generation model is obtained after the first content generation model is trained in entity recognition ability using the first training set, the first training set includes a first training sample, the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture; the modification relationship discrimination model is also used to determine the modification relationship information of the input prompt word to be processed when using the third content generation model for content generation.

[0024] An electronic device, comprising:

[0025] at least one processor; and

[0026] a memory communicatively connected to the at least one processor; wherein,

[0027] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.

[0028] A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method as described above.

[0029] A computer program product comprises a computer program / instruction, wherein the computer program / instruction implements the method described above when executed by a processor.

[0030] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0032] Figure 1 This is a flowchart of an embodiment of the AIGC model training method disclosed in the present invention;

[0033] Figure 2 A flowchart of an embodiment of the content generation method described in the present disclosure;

[0034] Figure 3 A flowchart of an embodiment of the modification relationship discrimination model training method disclosed in the present invention;

[0035] Figure 4 A schematic diagram of the overall implementation process of model training and prediction described in the present disclosure;

[0036] Figure 5 Schematic diagram of the composition structure of the AIGC model training device embodiment 500 described in the present disclosure;

[0037] Figure 6 It is a schematic diagram of the composition structure of the content generation device embodiment 600 of the present disclosure;

[0038] Figure 7 Schematic diagram of the structure of the modification relationship discrimination model training device embodiment 700 of the present disclosure;

[0039] Figure 8 A schematic block diagram of an electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0040] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0041] In addition, it should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0042] Figure 1 Flow chart of an embodiment of the AIGC model training method described in the present disclosure. Figure 1 As shown, the following specific implementation methods are included.

[0043] In step 101, a first training set is constructed, wherein the first training set includes a first training sample, and the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture.

[0044] In step 102, the entity recognition capability of the first AIGC model is trained using the first training set to obtain a second AIGC model.

[0045] In step 103, a second training set is constructed, wherein the second training set includes second training samples, and the second training samples include: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word.

[0046] In step 104, the entity detail characterization capability of the second AIGC model is trained using the second training set to obtain a third AIGC model.

[0047] By adopting the scheme described in the above method embodiment, the instruction-following ability of the AIGC model can be concretized as entity recognition ability and entity detail portrayal ability, and corresponding training sets can be constructed respectively, and then the constructed training sets can be used to train the AIGC model, thereby achieving targeted instruction-following ability optimization (special effect improvement), that is, improving the instruction-following ability of the AIGC model, and then improving the accuracy of the content generated based on AIGC, etc.

[0048] For ease of distinction, in the solution described in the present disclosure, the AIGC models obtained by training at different stages of the training process are respectively referred to as the first AIGC model, the second AIGC model, and the third AIGC model.

[0049] The AIGC model is usually a cross-modal model such as a text-generated graph model or a text-generated video model. The following description will be made using the text-generated graph model as an example.

[0050] Among them, entity recognition ability refers to the ability of the AIGC model to correctly identify entities. For example, if you need to draw a certain person, if the model cannot even recognize the entity (the person) in the prompt word entered by the user, that is, it cannot even draw the subject correctly, then it must be a case of not following the user's instructions, resulting in a very poor user experience.

[0051] The ability to depict entity details, as the name suggests, refers to the AIGC model's ability to depict the specific details of an entity, which can be manifested as the ability to understand the modifying relationship between words that describe the entity.

[0052] In some embodiments of the present disclosure, the modification relationship may include: attribute binding, reference relationship information, sentence-free context, and spatial position relationship, which are introduced below.

[0053] 1) Property Binding

[0054] For example, the prompt word = there is a red ball on the blue table, and a big-eyed beauty is sitting in front of the table.

[0055] Attribute binding refers to the modification relationship binding of adjective -> entity, such as:

[0056] blue->modification->table, blue is bound to the table;

[0057] Red->Modification->Ball, red is bound to the ball;

[0058] Big eyes->Modification->Beauty, big eyes are bound to beauty.

[0059] 2) Reference relationship

[0060] For example, the prompt word = the graceful queen, holding a violin in one hand and a book in the other...

[0061] Reference relations may include: third-person reference and binding reference to specific body parts, such as:

[0062] She->Queen;

[0063] Violin -> one hand;

[0064] Book -> other hand.

[0065] 3) No sentence context

[0066] For example, the prompt word = the noble princess ragdoll cat is graceful, furry, blonde and blue-eyed, looking for food, sitting on the luxurious throne.

[0067] Sentence-free context means that it is impossible to determine which adjective modifies which entity through sentence structure. For example, in the above prompt words, there are two entities, Princess and Ragdoll Cat. One of these entities is a person and the other is a cat, but the following adjectives do not clearly indicate which entity they are used to modify.

[0068] But in fact, common sense can determine:

[0069] Graceful -> High probability of modification -> Princess;

[0070] Fluffy -> High probability of modification -> Ragdoll cat;

[0071] Blonde -> High probability of modification -> Princess;

[0072] Foraging->High probability of grooming->Ragdoll cat.

[0073] 4) Spatial position relationship

[0074] For example, the prompt word = ink-painted mountain, there is a river at the foot of the mountain, there are farmlands beside the river, there are large tractors in the farmlands, and a drone is parked on the right side of the tractor.

[0075] Spatial position relationship refers to the relationship existing in spatial position, such as:

[0076] There is a river at the bottom of the mountain;

[0077] River->next to->farmland;

[0078] Farmland->There is->Tractor;

[0079] Tractor->On the right there is->Drone.

[0080] These spatial position relationships cannot be wrong, otherwise the generated images will show obvious non-compliance with the instructions.

[0081] Based on the above-concrete entity recognition ability and entity detail portrayal ability, training sets can be constructed respectively, and the constructed training sets can be used to train the AIGC model to improve the instruction-following ability of the AIGC model.

[0082] Among them, as described in step 101, a first training set can be first constructed, and the first training set includes a first training sample. The first training sample may include: a first training picture corresponding to any entity and picture description information of the first training picture. Accordingly, in step 102, the first training set can be used to train the entity recognition ability of the first AIGC model.

[0083] In some embodiments of the present disclosure, in order to construct a first training set, an entity cognitive map can be first constructed, and the following processing can be performed on all or part of the entities in the entity cognitive map: an entity image corresponding to the entity is obtained, the first training image includes the entity image, and the image description information of the first training image is obtained, and then a first training sample can be generated based on the first training image and the image description information.

[0084] By adopting the above processing method, an entity cognitive map can be constructed first, and then the corresponding first training samples can be constructed for all or part of the entities in the entity cognitive map, thereby using the entity cognitive map to provide a data basis for the construction of the first training sample, thereby improving the sample construction efficiency, etc.

[0085] In some embodiments of the present disclosure, when constructing an entity cognitive map, a first entity with a higher than preset first heat can be obtained from a historical prompt word set recorded in a predetermined business log, and an entity cognitive map can be constructed based on at least the first entity. In addition, a second entity with a higher than preset second heat can be obtained from other predetermined data sources other than the historical prompt word set, and an entity cognitive map can be constructed based on the first entity and the second entity. The specific values ​​of the first heat and the second heat can be determined according to actual needs.

[0086] For example, the scheduled business log can be a Wenxin Yige business log, which can obtain the full set of historical prompt words entered by the user. Afterwards, based on the entity linking tool, the entities in each historical prompt word can be linked to the knowledge base, where the cumulative number of occurrences of different entities can be counted, and the entity with a cumulative number of occurrences greater than the first heat can be used as the first entity. Furthermore, the required entity cognitive map can be constructed based on the first entity.

[0087] In addition, in addition to obtaining the first entity from the historical prompt word set, the second entity can also be obtained from other predetermined data sources, and then the required entity cognitive map can be constructed based on the first entity and the second entity. For example, the other predetermined data source can be an encyclopedia data source.

[0088] The first entities obtained from the historical prompt word set are all entities that have appeared in the prompt words input by the user. However, if some entities have not appeared in the prompt words input by the user, it does not mean that the AIGC model does not need to recognize these entities. Accordingly, the first entity obtained from the historical prompt word set can be effectively supplemented by mining other predetermined data sources, thereby constructing a more complete entity cognitive map.

[0089] For the constructed entity cognitive graph, corresponding first training samples can be constructed for all or part of the entities therein. For example, corresponding first training samples can be constructed for all entities, or it can be considered that the higher the popularity of the entity, the higher the priority. Accordingly, from the perspective of resource consumption, etc., corresponding first training samples can be constructed only for some entities with higher priority. The specific implementation method is not limited. In addition, one or more first training samples can be constructed for the same entity.

[0090] Each entity in the entity cognitive graph may have a corresponding entity name and one or more entity aliases, such as the entity name of an entity is Li Si and the entity alias is Li Zi. Among them, through the entity linking tool, the entity name and entity alias can be mapped to the same entity. In addition, the entity alias corresponding to any entity name can also be obtained by querying or searching the relevant knowledge base.

[0091] For any entity in the entity cognitive map, the corresponding picture can be obtained based on the entity name or entity alias of the entity through image search or other methods, that is, the first training picture corresponding to the entity can be obtained. The number of first training pictures can be one or more. If there are multiple pictures, the corresponding first training sample can be constructed based on each picture.

[0092] In addition, for the entity Li Si, the corresponding first training picture usually only includes the character Li Si, and does not include other characters. Moreover, the first training picture can be selected with better aesthetics and clarity to improve the subsequent model learning effect.

[0093] For the first training picture, its picture description information can also be obtained. In some embodiments of the present disclosure, a picture description generator (captioner) can be used to generate initial description information of the first training picture, and then the target concept word in the initial description information can be replaced by at least one of the entity name and entity alias of the entity corresponding to the first training picture to obtain the picture description information, where the target concept word is used to represent the entity corresponding to the first training picture.

[0094] Captioner is a model tool that generates text for a given image. That is, after taking any image as its input, it can output text description information (caption) about the content of the image. For the sake of distinction, the generated caption in the scheme described in this disclosure is called initial description information.

[0095] Generally speaking, the entity name or entity alias of the entity will not appear in the initial description information. For example, the initial description information generated for the first training picture corresponding to the entity Li Si may be: a man wearing a black suit, holding a wine glass in his hand..., that is, only conceptual words such as man, boy, handsome guy, etc. will appear in the initial description information, and the entity name or entity alias will not appear directly. Therefore, it is necessary to optimize it to a certain extent, that is, use at least one of the entity name and entity alias of the entity corresponding to the first training picture to replace the target concept word in the initial description information to obtain the required picture description information.

[0096] Assuming that the entity in the first training image is Li Si, the target concept word refers to the concept word used to represent Li Si, such as man.

[0097] With the help of captioner, the required initial description information can be obtained efficiently and accurately, and then by replacing the target concept words in the initial description information, the semantically clear and specific image description information can be obtained, thus laying a good foundation for subsequent processing.

[0098] In some embodiments of the present disclosure, when replacing the target concept word in the initial description information with at least one of the entity name and the entity alias of the entity corresponding to the first training image, the target concept word can be replaced with a predetermined target object, where the target object includes the entity name and the entity alias, or the target concept word can be replaced with all target objects in a flat form, or the target objects can be randomly selected and the target concept word can be replaced with L selected target objects, where L is a positive integer and is less than P, and P is the total number of target objects.

[0099] That is to say, the solution disclosed in the present invention provides three methods of replacing target concept words, and for the first training picture, one of the replacement methods can be randomly selected or selected according to a certain strategy to complete the replacement, which is very flexible and convenient.

[0100] Assuming that the entity corresponding to the first training image is Li Si, that is, the entity name is Li Si, and the entity aliases include Li Zi and Si Ye, then the target concept word can be replaced by a predetermined one among Li Si, Li Zi and Si Ye, such as always using Li Si to replace the target concept word, or, the target concept word can be replaced by all target objects in a flat form, such as "Li Si, Li Zi, Si Ye" or "Li Si / Li Zi / Si Ye", or, assuming that Li Zi and Si Ye are randomly extracted from Li Si, Li Zi and Si Ye, then the target concept word can be replaced by the two extracted target objects in a flat form, such as "Li Zi, Si Ye" or "Li Zi / Si Ye".

[0101] Through the above three replacement methods, the AIGC model can fully recognize the entity name and entity alias of the entity, thereby avoiding the situation where the entity cannot be correctly identified when the name is changed.

[0102] After obtaining the image description information of the first training image, the first training image and the corresponding image description information can be used to form a first training sample. In the same way, multiple first training samples can be constructed to form a first training set, and then the entity recognition ability of the first AIGC model can be trained using the first training set as described in step 102 to obtain a second AIGC model.

[0103] In step 103, a second training set may also be constructed. The second training sample may include: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word. Then, as described in step 104, the second training set may be used to train the entity detail depiction capability of the second AIGC model.

[0104] In some embodiments of the present disclosure, when constructing the second training set, some historical prompt words can be obtained from the historical prompt word set recorded in the predetermined business log, and the target prompt words can be determined based on the some historical prompt words. Then, the second training pictures corresponding to each target prompt word and the modification relationship information of each target prompt word can be obtained respectively, and then the second training samples can be composed according to the modification relationship information and the corresponding second training pictures.

[0105] In some embodiments of the present disclosure, the modification relationship may include: M different types of modification relationships, where M is a positive integer greater than 1, such as 4. Accordingly, when obtaining some historical prompt words from a historical prompt word set, the modification relationship type to which each historical prompt word in the historical prompt word set belongs can be determined respectively, and for different modification relationship types, historical prompt words can be extracted according to the principle that the more historical prompt words there are, the more historical prompt words can be extracted.

[0106] For different types of modification relations such as attribute binding, reference relation, sentence-free context and spatial position relation, the modification relation type of each historical prompt word in the historical prompt word set can be determined respectively, so as to obtain the real distribution of historical prompt words belonging to different modification relation types, and then the historical prompt words can be extracted according to the real distribution, that is, for different modification relation types, the more historical prompt words are extracted, the more historical prompt words are extracted. Among them, the same historical prompt word may belong to one modification relation type, or may belong to multiple different modification relation types at the same time.

[0107] Through the above processing, the more modified relationship types are distributed, the more historical prompt words are extracted, thereby improving the pertinence of subsequent model training and further improving the model training effect.

[0108] In some embodiments of the present disclosure, in order to obtain the target prompt word, the quality of the part of the historical prompt words may be checked. In response to determining that there are target historical prompt words that fail the check, the target historical prompt words may be modified and the target prompt word may be determined. The target prompt word includes: the historical prompt word that passed the check and the modified target historical prompt word. In response to determining that there are no target historical prompt words that fail the check, the target prompt entity may include: the historical prompt word that passed the check. Alternatively, in some embodiments of the present disclosure, the target prompt word may be directly determined, and the target prompt word includes: the part of the historical prompt words.

[0109] That is to say, the extracted historical prompt words can be directly used as target prompt words to simplify the processing, or, considering that some of the extracted historical prompt words may have quality problems and are not suitable for direct use as target prompt words, the extracted historical prompt words can first be quality-checked according to a predetermined verification strategy, and the target historical prompt words that fail the verification can be modified in a targeted manner, and then the historical prompt words that pass the verification and the modified target historical prompt words can be used as target prompt words, thereby improving the quality of the target prompt words, and then improving the subsequent model training effect, etc. The specific verification strategy is not limited. In addition, if necessary, some new prompt words can be edited and generated based on the extracted historical prompt words as target prompt words.

[0110] For each target prompt word, a corresponding second training picture can be obtained respectively. There is no limitation on how to obtain the picture. For example, a picture generated based on a text graph model and determined to be correct can be used as the required second training picture.

[0111] In addition, the modification relationship information of each target prompt word can also be obtained respectively. Accordingly, for any modification relationship information obtained, the modification relationship information and the corresponding second training picture can be used to form a second training sample.

[0112] In the same manner, a plurality of second training samples may be constructed to form a second training set, and then, as described in step 104, the second training set may be used to train the entity detail characterization capability of the second AIGC model.

[0113] In some embodiments of the present disclosure, the following processing can be performed for any second training picture: the second training picture is modified using a picture modification tool to obtain a modified picture, the target prompt word corresponding to the second training picture is modified according to the modified picture to obtain a modified prompt word matching the modified picture, the modification relationship information of the modified prompt word is obtained, and the modification relationship information of the modified prompt word and the modified picture are used to form a second training sample.

[0114] For example, for any second training picture, it can be quickly modified based on the ControlNet tool to generate one or more modified pictures of the same type and similar to the second training picture. For example, the spatial position relationship can be modified. The original object 1 is on the left side of the object 2, and it is modified to object 1 is on the right side of the object 2, etc. For another example, Li Si originally held a wine glass in his left hand, but it was modified to hold a fan in his left hand, etc.

[0115] As the second training picture is modified into a modified picture, the corresponding target prompt word also needs to be modified accordingly to obtain a modified prompt word that matches the modified picture, and then the modification relationship information of the modified prompt word can be obtained. The modification relationship information of the modified prompt word and the modified picture can be used to form a second training sample and added to the second training set.

[0116] Through the above processing, the second training set can be expanded, thereby increasing the number of second training samples, and further improving the training effect of the model.

[0117] It should be noted that, in practical applications, when the entity recognition ability of the first AIGC model is trained using the first training set, the modification relationship information of the image description information (which can also be regarded as prompt words) of the first training image can also be obtained, and then the first training image and the corresponding modification relationship information can be used to form a first training sample.

[0118] In some embodiments of the present disclosure, in order to obtain modification relationship information, taking the target prompt word as an example (other prompt words are the same), the following processing can be performed: using a pre-trained component analysis model to determine the component information of the words in the target prompt word, and based on the component information, using a pre-trained modification relationship discrimination model to determine the modification relationship information.

[0119] In some embodiments of the present disclosure, the component information of the words in the target prompt word may include: the main word, qualifier, modifier, topic word and grammatical word in the target prompt word; the modification relationship may include: attribute binding, reference relationship, sentence-free context and spatial position relationship.

[0120] The component information of the words in the target prompt word refers to which components are included in the image to be generated.

[0121] Assume that the target prompt word = the noble princess ragdoll cat is elegant, furry, blonde and blue-eyed, looking for food. The cat is on the left side of the princess. The princess holds a red wine glass in her left hand and wears black leather shoes on her feet, in a cyberpunk style.

[0122] Then we have:

[0123] Subject words (the main body of the picture): princess, ragdoll cat, red wine glass, leather shoes;

[0124] Qualifiers (words that modify the main word): aristocratic, elegant, hairy, blond, foraging, black;

[0125] Modifiers (used to modify the entire picture): Cyberpunk style;

[0126] Grammatical words (punctuation, prepositions, auxiliary words, etc.): de, etc.;

[0127] Keywords (theme of the picture): abstract concepts such as catering industry, religion, etc.

[0128] The component analysis model can be used to determine the component information of the words in the target prompt word, as shown above, and then the required modification relationship information can be determined based on the component information using the modification relationship discrimination model, that is, what kind of modification relationship needs to be analyzed to meet the instruction following ability.

[0129] For example, attribute binding:

[0130] Noble, elegant, blonde -> groomed -> princess;

[0131] Fluffy, foraging->grooming->ragdoll cat;

[0132] Black -> Retouching -> Leather Shoes.

[0133] Referential relationship:

[0134] Cat->Personal reference->Ragdoll cat;

[0135] Red wine glass->refers to including (body part)->left hand;

[0136] Leather shoes -> refers to (body part) -> feet.

[0137] Sentence-free context:

[0138] Graceful -> Decorated -> Princess;

[0139] Blonde -> Retouched -> Princess;

[0140] Fluffy->Groomed->Ragdoll Cat;

[0141] Foraging -> Grooming -> Ragdoll Cat.

[0142] Spatial position relationship:

[0143] Cat -> Left -> Princess.

[0144] It should be noted that, in practical applications, both the component information and the modification relationship information may carry coordinates, and the coordinates may refer to position offset information in the text.

[0145] In addition, the modification relationship information can be organized into structured data in the form of scripting language object notation (JSON, JavaScript Object Notation), that is, the target prompt word is converted into intermediate structured data, and combined with the corresponding image information, it is input into the AIGC model for training, so that the AIGC model can obtain all the structured and accurate information of the instruction to be followed, thereby improving the instruction-following ability of the AIGC model.

[0146] After the AIGC model is trained, it can be used for actual content generation, that is, for prediction.

[0147] Figure 2 Flow chart of an embodiment of the content generation method described in the present disclosure. Figure 2 As shown, the following specific implementation methods are included.

[0148] In step 201, an input prompt word to be processed is obtained, and modification relationship information between words in the prompt word to be processed is obtained.

[0149] In step 202, the modification relationship information is used as the input of the target model to obtain the content generation result corresponding to the prompt word to be processed. The target model is based on Figure 1 The third AIGC model is obtained by training using the method in the illustrated embodiment.

[0150] By adopting the scheme described in the above method embodiment, the AIGC model with improved instruction following ability obtained through pre-training can be used to process the input prompt words to be processed, thereby improving the accuracy of the generated content, etc.

[0151] In some embodiments of the present disclosure, a method for obtaining modification relationship information between words in a prompt word to be processed may include: using a pre-trained component analysis model to determine the component information of the words in the prompt word to be processed, and based on the component information, using a pre-trained modification relationship discrimination model to determine the modification relationship information.

[0152] It can be seen that no matter it is model training or prediction, the prompt words can be converted into intermediate states and aligned in both directions. In this way, no matter how the prompt words change, the information received during model training and prediction is unified.

[0153] In addition, the target model disclosed in the present invention has the ability to modify details in multiple rounds. For example, if a user needs to use the target model to generate a picture, the user can interact with the target model multiple times. For example, after inputting the prompt words to be processed for the first time, the target model outputs the content generation result, that is, a picture, but the user is not satisfied with some details of the picture. Then, the user can input new prompt words to be processed again for the unsatisfactory parts, so that the target model can optimize the content generation result until the user is satisfied.

[0154] It can be seen that the modification relationship discrimination model is needed for both model training and prediction. The following is an explanation of the training method of the modification relationship discrimination model.

[0155] Figure 3 Flow chart of an embodiment of the modification relationship discrimination model training method disclosed in the present invention. Figure 3 As shown, the following specific implementation methods are included.

[0156] In step 301, a third training set is constructed, wherein the third training set includes third training samples, and the third training samples include: sample prompt words.

[0157] In step 302, supervised fine-tuning (SFT) is performed on the pre-trained large language model (LLM) using the third training set to obtain a modification relationship discrimination model; the modification relationship discrimination model is used to construct a second training set, the second training set includes a second training sample, the second training sample includes: modification relationship information between words in the target prompt word determined by the modification relationship discrimination model, and a second training picture matching the target prompt word, the second training set is used to train the entity detail portrayal ability of the second AIGC model to obtain a third AIGC model, the second AIGC model is obtained after the first AIGC model is trained for entity recognition ability using the first training set, the first training set includes a first training sample, the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture, and the modification relationship discrimination model is also used to determine the modification relationship information of the input prompt word to be processed when the third AIGC model is used to generate content.

[0158] It can be seen that by adopting the solution described in the above method embodiment, the LLM+SFT architecture can be adopted to efficiently and accurately train the required modification relationship discrimination model based on the constructed third training set.

[0159] There is no restriction on the specific model of the LLM model, for example, it can be a Wenxinyiyan, a Generative Pre-trained Transformer (GPT) model, etc. According to the different parameter quantities of the LLM model, third training sets of different sizes can be constructed for SFT training.

[0160] In some embodiments of the present disclosure, when constructing the third training set, some historical prompt words can be obtained from the historical prompt word set recorded in the predetermined business log, and corresponding sample prompt words, i.e., the third training samples, can be constructed based on the obtained historical prompt words.

[0161] The historical prompt word set usually includes a large number of historical prompt words, but in practice only a relatively small number of historical prompt words may be needed to construct the third training sample. Therefore, a certain strategy can be used to extract the historical prompt words in the historical prompt word set for subsequent processing.

[0162] In some embodiments of the present disclosure, a learning-augmented k-means clustering algorithm can be used to cluster each historical prompt word in a historical prompt word set, and the following processing can be performed for each obtained cluster: each historical prompt word in the cluster is sorted in ascending order according to the distance from the center point of the cluster, and starting from the historical prompt word that is ranked first after sorting, one historical prompt word is extracted every W historical prompt words, and T historical prompt words are extracted from the cluster, where W and T are both positive integers, W is less than T, and T is less than the number of historical prompt words included in the cluster.

[0163] The specific values ​​of W and T can be determined according to actual needs. For example, assuming that a certain cluster includes 100 historical prompt words, they are sorted in order of distance from the center point of the cluster from small to large and numbered as historical prompt word 1 to historical prompt word 100. Assuming that the value of W is 1 and the value of T is 20, then historical prompt word 1, historical prompt word 3, historical prompt word 5, historical prompt word 7, ... can be extracted respectively, a total of 20 historical prompt words.

[0164] Different historical prompt word extraction methods will lead to large differences in the subsequent model training effects. Experiments show that the above extraction method can significantly improve the model training effect compared with random extraction and other methods. For example, the comprehensive index (F1) will be significantly improved.

[0165] According to each extracted historical prompt word, a corresponding sample prompt word can be constructed respectively. In some embodiments of the present disclosure, for any extracted historical prompt word, the following processing can be performed respectively: using a pre-trained component analysis model to determine the component information of the words in the historical prompt word, filling the default instruction template according to the historical prompt word and the component information, and determining the sample prompt word corresponding to the historical prompt word according to the filling result.

[0166] The component information of the words in the history prompt words may include: the main words, qualifiers, modifiers, subject words and grammatical words in the history prompt words.

[0167] For example, the default instruction template could be:

[0168] The text is '{text}', in which the main words are {A}, {B}, {C}, etc., and the qualifiers are {D}, {E}, {F}, etc., ..., what is the modification relationship between them?

[0169] Among them, the contents in {} are all variables, which can be filled in according to the historical prompt words and component information, which is very flexible and convenient. For example, text can be filled in with the historical prompt words, A, B, and C can be filled in with the main words in the component information, etc. In addition, "the main words are {A}, {B}, {C}, etc., the qualifiers are {D}, {E}, {F}, etc., ...," can be called reference information, which can help the modification relationship discrimination model better learn the modification relationship between words.

[0170] In some embodiments of the present disclosure, after obtaining the filling result corresponding to any historical prompt word, the sample prompt word corresponding to the historical prompt word may include: the filling result, or, by performing disturbance enhancement processing on the filling result, the sample prompt word corresponding to the historical prompt word can be obtained, and the sample prompt word includes: the disturbance enhancement processing result.

[0171] That is to say, the filling result can be directly used as the sample prompt word corresponding to the historical prompt word, or the filling result can be subjected to disturbance enhancement processing, and the disturbance enhancement processing result can be used as the sample prompt word corresponding to the historical prompt word.

[0172] In some embodiments of the present disclosure, the method of performing disturbance enhancement processing on the filling result may include any of the following: selecting one from N pre-set associated words, N is a positive integer, and adding the selected associated word to the filling result to obtain a disturbance enhancement processing result; selecting one from S pre-set sequence adjustment methods, S is a positive integer, and adjusting the sequence of the content in the filling result according to the selected sequence adjustment method to obtain a disturbance enhancement processing result; selecting one from Q pre-set instruction templates, Q is a positive integer, and the Q instruction templates do not include a default instruction template, refilling the selected instruction template according to the historical prompt word and component information, and determining the refilled result as the disturbance enhancement processing result.

[0173] Assuming that a total of 20,000 historical prompt words are extracted, then for each of the historical prompt words, after obtaining the corresponding filling result, the filling result can be directly used as the sample prompt word corresponding to the historical prompt word, or, one of the three perturbation enhancement processing methods mentioned above can be selected to perform perturbation enhancement processing on the filling result. In this way, the final number of sample prompt words is still 20,000, and the total number will not change.

[0174] In practical applications, it can be selected with a certain probability whether to perform disturbance enhancement processing on the filling result, and if it is determined that the filling result needs to be disturbed and enhanced, then one of the three disturbance enhancement processing methods mentioned above can be randomly selected, or one of the three disturbance enhancement processing methods can be selected according to a certain strategy, and the specific strategy is not limited.

[0175] Through perturbation enhancement processing, the form and content of the sample prompt words can be enriched, thereby improving the anti-perturbation, robustness and generalization ability of the modification relationship discrimination model obtained through subsequent training.

[0176] The above three disturbance enhancement processing methods can be respectively called subordinate disturbance method, positioning disturbance method and paraphrasing disturbance method.

[0177] 1) Subordinate relationship disturbance mode

[0178] N kinds of associated words can be preset, where N is a positive integer and the specific value can be determined according to actual needs. The associated words may include because-so, if-then, etc. In this way, for any filling result, one can be randomly selected from the N kinds of associated words, or a matching one can be selected according to the semantics of the filling result, and then the selected associated words can be added to the filling result to obtain the desired disturbance enhancement processing result.

[0179] For example, suppose the filling result is: the text is 'girl wearing black-framed glasses', ... (representing omitted reference information), what is the modification relationship between them?

[0180] Then the perturbation enhancement processing result can be: If the text is 'a girl wearing black-framed glasses', ..., then what is the modification relationship between them?

[0181] 2) Position relationship disturbance method

[0182] S kinds of order adjustment methods can be pre-set, where S is a positive integer and the specific value can be determined according to actual needs. In this way, for any filling result, one of the S order adjustment methods can be randomly selected, or a matching one can be selected according to the semantics of the filling result. Then, the content in the filling result can be sequentially adjusted according to the selected order adjustment method, so as to obtain the desired disturbance enhancement processing result.

[0183] For example, suppose the filling result is: the text is 'girl wearing black-framed glasses',..., what is the modification relationship between them?

[0184] Then the perturbation enhancement processing result can be: What is the modification relationship between them? The text is 'the girl wears black-framed glasses', ......

[0185] 3) Interpretation relationship disturbance method

[0186] Q kinds of instruction templates can be pre-set, where Q is a positive integer and the specific value can be determined according to actual needs. The Q kinds of instruction templates may not include a default instruction template. In this way, for any filling result, one can be randomly selected from the Q kinds of instruction templates, and then the selected instruction template can be refilled according to the historical prompt words and component information to obtain the desired disturbance enhancement processing result.

[0187] For example, suppose the filling result is: the text is 'girl wearing black-framed glasses',..., what is the modification relationship between them?

[0188] Then the result of disturbance enhancement processing can be: the text is 'the girl wears black-framed glasses',..., how to describe the modification relationship of this text?

[0189] It can be seen that by adopting the above-mentioned perturbation enhancement processing method, there is no need to change the core content of the filling result. Only some minor changes are needed to obtain the desired perturbation enhancement processing results. Accordingly, the robustness and generalization ability of the modification relationship discrimination model can be improved.

[0190] The input of the trained modification relationship discrimination model can be a prompt word, and the output can be specific modification relationship information, such as (a, b), (c, d), (e, above, f), etc., among which the spatial position relationship can be in the form of a triple, and other modification relationships can be in the form of a binary.

[0191] Combined with the above introduction, Figure 4 Schematic diagram of the overall implementation process of model training and prediction described in this disclosure. Figure 4 As shown, the instruction-following ability of the AIGC model can be visualized as entity recognition ability and entity detail portrayal ability (including multiple rounds of detail modification ability), wherein, for the entity recognition ability, an entity recognition map can be constructed, and a first training set can be constructed based on the entity recognition map, and then the first training set can be used to train the first AIGC model to obtain a second AIGC model, and for the entity detail portrayal ability, a second training set can be constructed based on a component analysis model and a modification relationship discrimination model, and the second training set can be used to train the second AIGC model again to obtain a third AIGC model, and further, actual content generation can be performed based on the third AIGCAIGC model.

[0192] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present disclosure. In addition, for parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0193] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.

[0194] Figure 5 FIG. 5 is a schematic diagram of the structure of the AIGC model training device embodiment 500 described in the present disclosure. Figure 5 As shown, it includes: a first training module 501 and a second training module 502.

[0195] The first training module 501 is used to construct a first training set, which includes a first training sample. The first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture; the first training set is used to train the entity recognition ability of the first AIGC model to obtain a second AIGC model.

[0196] The second training module 502 is used to construct a second training set, which includes a second training sample. The second training sample includes: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word; using the second training set, the entity detail depiction ability of the second AIGC model is trained to obtain a third AIGC model.

[0197] By adopting the scheme described in the above-mentioned device embodiment, the instruction-following ability of the AIGC model can be concretized as entity recognition ability and entity detail portrayal ability, and corresponding training sets can be constructed respectively. The constructed training sets can then be used to train the AIGC model, thereby achieving targeted instruction-following ability optimization, that is, improving the instruction-following ability of the AIGC model, and then improving the accuracy of the content generated based on AIGC.

[0198] In some embodiments of the present disclosure, the first training module 501 can construct an entity cognitive map, and can perform the following processing on all or part of the entities in the entity cognitive map: obtain an entity image corresponding to the entity, the first training image includes the entity image, and obtain image description information of the first training image, and generate a first training sample based on the first training image and the image description information.

[0199] In addition, in some embodiments of the present disclosure, the first training module 501 can obtain a first entity higher than a preset first heat from a set of historical prompt words recorded in a predetermined business log, and construct an entity cognitive map based on at least the first entity, or, it can also obtain a second entity higher than a predetermined second heat from other predetermined data sources outside the historical prompt word set, and construct an entity cognitive map based on the first entity and the second entity.

[0200] For the first training picture, its picture description information can also be obtained. In some embodiments of the present disclosure, the first training module 501 can first use the picture description generator to generate initial description information of the first training picture, and then use at least one of the entity name and entity alias of the entity corresponding to the first training picture to replace the target concept word in the initial description information to obtain the picture description information, where the target concept word is used to represent the entity corresponding to the first training picture.

[0201] In some embodiments of the present disclosure, when the first training module 501 replaces the target concept word in the initial description information with at least one of the entity name and the entity alias of the entity corresponding to the first training image, the target concept word may be replaced with a predetermined target object, where the target object includes the entity name and the entity alias, or the target concept word may be replaced with all target objects in a flat form, or the target objects may be randomly selected and the target concept word may be replaced with L selected target objects, where L is a positive integer and is less than P, and P is the total number of target objects.

[0202] After obtaining the image description information of the first training image, the first training module 501 can use the first training image and the corresponding image description information to form a first training sample. In the same way, multiple first training samples can be constructed to form a first training set, and then the first training set can be used to train the entity recognition ability of the first AIGC model to obtain a second AIGC model.

[0203] In addition, the second training module 502 can also construct a second training set, and the second training samples include: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word, and then the second training set can be used to train the entity detail portrayal capability of the second AIGC model.

[0204] In some embodiments of the present disclosure, when constructing the second training set, the second training module 502 can obtain some historical prompt words from the historical prompt word set recorded in the predetermined business log, and can determine the target prompt words based on the some historical prompt words, and then can respectively obtain the second training pictures corresponding to each target prompt word and the modification relationship information of each target prompt word, and then can form a second training sample based on the modification relationship information and the corresponding second training pictures.

[0205] In some embodiments of the present disclosure, the modification relationship may include: M different types of modification relationships, where M is a positive integer greater than 1, such as 4. Accordingly, when the second training module 502 obtains some historical prompt words from the historical prompt word set, it can respectively determine the modification relationship type to which each historical prompt word in the historical prompt word set belongs, and can extract historical prompt words for different modification relationship types according to the principle that the more historical prompt words the more historical prompt words are extracted.

[0206] In some embodiments of the present disclosure, the second training module 502 may perform a quality check on the part of the historical prompt words, and in response to determining that there are target historical prompt words that fail the check, modify the target historical prompt words, and determine the target prompt words, the target prompt words include: historical prompt words that pass the check and the modified target historical prompt words, and in response to determining that there are no target historical prompt words that fail the check, the target prompt words include: historical prompt words that pass the check. Alternatively, in some embodiments of the present disclosure, the second training module 502 may directly determine the target prompt words, including: the part of the historical prompt words.

[0207] In some embodiments of the present disclosure, the second training module 502 can also perform the following processing for any second training picture: modify the second training picture using a picture modification tool to obtain a modified picture, modify the target prompt word corresponding to the second training picture according to the modified picture to obtain a modified prompt word matching the modified picture, obtain modification relationship information of the modified prompt word, and use the modification relationship information of the modified prompt word and the modified picture to form a second training sample.

[0208] In some embodiments of the present disclosure, the second training module 502 can perform the following processing to obtain modification relationship information, taking the target prompt word as an example (other prompt words are the same): using a pre-trained component analysis model to determine the component information of the words in the target prompt word, and based on the component information, using a pre-trained modification relationship discrimination model to determine the modification relationship information.

[0209] In some embodiments of the present disclosure, the component information of the words in the target prompt word may include: the main words, qualifiers, modifiers, subject words and grammatical words in the target prompt word; the modification relationship may include: attribute binding, reference relationship, sentence-free context and spatial position relationship.

[0210] Figure 6 FIG. 6 is a schematic diagram of the composition structure of the content generation device embodiment 600 described in the present disclosure. Figure 6 As shown, it includes: an acquisition module 601 and a generation module 602.

[0211] The acquisition module 601 is used to acquire the input prompt word to be processed, and acquire the modification relationship information between the words in the prompt word to be processed.

[0212] The generation module 602 is used to use the modification relationship information as the input of the target model to obtain the content generation result corresponding to the prompt word to be processed. The target model can be used to generate the content corresponding to the prompt word to be processed. Figure 5 The third AIGC model is obtained by training the device in the illustrated embodiment.

[0213] By adopting the scheme described in the above device embodiment, the AIGC model with improved instruction following ability obtained through pre-training can be used to process the input prompt words to be processed, thereby improving the accuracy of the generated content, etc.

[0214] In some embodiments of the present disclosure, the method in which the acquisition module 601 acquires the modification relationship information between words in the prompt word to be processed may include: using a pre-trained component analysis model to determine the component information of the words in the prompt word to be processed, and based on the component information, using a pre-trained modification relationship discrimination model to determine the modification relationship information.

[0215] Figure 7 FIG. 7 is a schematic diagram of the structure of the modification relationship discrimination model training device embodiment 700 of the present disclosure. Figure 7 As shown, it includes: a construction module 701 and a training module 702.

[0216] The construction module 701 is used to construct a third training set, wherein the third training set includes third training samples, and the third training samples include: sample prompt words.

[0217] The training module 702 is used to perform SFT training on the pre-trained large language model using the third training set to obtain a modification relationship discrimination model; the modification relationship discrimination model is used to construct a second training set, the second training set includes a second training sample, the second training sample includes: modification relationship information between words in the target prompt word determined by the modification relationship discrimination model, and a second training picture matching the target prompt word, the second training set is used to train the entity detail depiction ability of the second AIGC model to obtain a third AIGC model, the second AIGC model is obtained after the first AIGC model is trained in entity recognition ability using the first training set, the first training set includes a first training sample, the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture, the modification relationship discrimination model is also used to determine the modification relationship information of the input prompt word to be processed when the third AIGC model is used to generate content.

[0218] By adopting the solution described in the above device embodiment, the LLM+SFT architecture can be used to efficiently and accurately train the required modification relationship discrimination model based on the constructed third training set.

[0219] In some embodiments of the present disclosure, when constructing the third training set, the construction module 701 can obtain some historical prompt words from the historical prompt word set recorded in the predetermined business log, and can construct corresponding sample prompt words, i.e., the third training samples, based on the obtained historical prompt words.

[0220] In some embodiments of the present disclosure, the construction module 701 can use the Learning-augmented k-means algorithm to cluster each historical prompt word in the historical prompt word set, and can perform the following processing for each obtained cluster: sort each historical prompt word in the cluster in order of the distance from the center point of the cluster from small to large, and start from the historical prompt word that is in the first place after sorting, extract one historical prompt word every W historical prompt words, and extract T historical prompt words from the cluster, where W and T are both positive integers, W is less than T, and T is less than the number of historical prompt words included in the cluster.

[0221] In some embodiments of the present disclosure, the construction module 701 can perform the following processing on any extracted historical prompt word: use a pre-trained component analysis model to determine the component information of the words in the historical prompt word, fill in the default instruction template according to the historical prompt word and the component information, and determine the sample prompt word corresponding to the historical prompt word according to the filling result.

[0222] The component information of the words in the history prompt words may include: the main words, qualifiers, modifiers, subject words and grammatical words in the history prompt words.

[0223] In some embodiments of the present disclosure, after obtaining the filling result corresponding to any historical prompt word, the construction module 701 determines that the sample prompt word corresponding to the historical prompt word may include: the filling result, or, by performing disturbance enhancement processing on the filling result, the sample prompt word corresponding to the historical prompt word can be obtained, and the sample prompt word includes: the disturbance enhancement processing result.

[0224] In addition, in some embodiments of the present disclosure, the construction module 701 may perform disturbance enhancement processing on the filling result in a manner that includes: selecting one from N pre-set associated words, N being a positive integer, and adding the selected associated word to the filling result to obtain a disturbance enhancement processing result, or selecting one from S pre-set sequence adjustment methods, S being a positive integer, and adjusting the sequence of the content in the filling result according to the selected sequence adjustment method to obtain a disturbance enhancement processing result, or selecting one from Q pre-set instruction templates, Q being a positive integer, and the Q instruction templates not including a default instruction template, refilling the selected instruction template according to the historical prompt word and component information, and determining the refilled result as the disturbance enhancement processing result.

[0225] The specific working processes of the above-mentioned device embodiments can refer to the relevant descriptions in the above-mentioned method embodiments and will not be repeated here.

[0226] The scheme disclosed in the present invention can be applied to the field of artificial intelligence, especially to the fields of large models, deep learning, natural language processing, and knowledge graphs. Artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0227] The prompt words and pictures in the embodiments described in this disclosure are not targeted at a specific user and do not reflect the personal information of a specific user. In the technical solution of this disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0228] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0229] Figure 8 A schematic block diagram of an electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0230] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0231] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0232] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the methods described in the present disclosure. For example, in some embodiments, the methods described in the present disclosure may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the method described in the present disclosure may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the method described in the present disclosure in any other appropriate manner (e.g., by means of firmware).

[0233] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0234] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0235] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0236] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0237] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0238] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0239] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0240] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A content generation model training method, comprising: Constructing a first training set, where the first training set includes a first training sample, where the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture; Using the first training set to train the entity recognition ability of the first content generation model to obtain a second content generation model; Constructing a second training set, wherein the second training set includes second training samples, wherein the second training samples include: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word; The second training set is used to train the entity detail depiction capability of the second content generation model to obtain a third content generation model.

2. The method according to claim 1, wherein The constructing of the first training set comprises: Construct entity cognitive map; For all or part of the entities in the entity cognitive map, the following processing is performed respectively: obtaining the entity picture corresponding to the entity, the first training picture including the entity picture; obtaining the picture description information of the first training picture; generating the first training sample based on the first training picture and the picture description information.

3. The method according to claim 2, wherein: The constructing of the entity cognitive map includes: Acquire a first entity having a higher than a preset first popularity from a set of historical prompt words recorded in a predetermined business log; The entity cognitive map is constructed at least based on the first entity.

4. The method according to claim 3, wherein: The constructing of the entity cognitive map further includes: Acquire a second entity with a higher than a preset second popularity from other predetermined data sources other than the historical prompt word set; The entity cognitive graph is constructed according to the first entity and the second entity.

5. The method according to claim 2, wherein: The acquiring of the picture description information of the first training picture includes: Generate initial description information of the first training image using an image description generator; The target concept word in the initial description information is replaced by at least one of the entity name and the entity alias of the entity corresponding to the first training image to obtain the image description information, where the target concept word is used to represent the entity corresponding to the first training image.

6. The method according to claim 5, wherein: The replacing of the target concept word in the initial description information with at least one of the entity name and the entity alias of the entity corresponding to the first training image includes any one of the following: Replacing the target concept word with a predetermined target object, wherein the target object includes the entity name and the entity alias; By flattening, replacing the target concept word with all target objects; The target objects are randomly extracted, and the target concept words are replaced with the extracted L target objects, where L is a positive integer and is less than P, and P is the total number of target objects.

7. The method according to any one of claims 1 to 6, wherein The constructing of the second training set comprises: Obtaining some historical prompt words from the historical prompt word set recorded in the scheduled business log; determining the target prompt word according to the portion of the historical prompt words; respectively obtaining the second training picture corresponding to each target prompt word and the modification relationship information of each target prompt word; The second training sample is composed according to the modification relationship information and the corresponding second training picture.

8. The method according to claim 7, wherein: The modification relationship includes: M different types of modification relationships, where M is a positive integer greater than 1; The step of obtaining some historical prompt words from the historical prompt word set recorded in the predetermined service log includes: respectively determining the modification relationship type of each historical prompt word in the historical prompt word set; For different modification relationship types, historical prompt words are extracted according to the principle that the more historical prompt words there are, the more historical prompt words are extracted.

9. The method according to claim 7, wherein: Determining the target prompt word according to the part of the historical prompt words includes: Performing quality verification on some of the historical prompt words; In response to determining that there is a target historical prompt word that fails verification, modifying the target historical prompt word and determining the target prompt word, the target prompt word including: the historical prompt word that passes verification and the modified target historical prompt word; In response to determining that there is no target history prompt word that has failed verification, the target prompt entity includes: the historical prompt word that has passed verification.

10. The method according to claim 7, wherein: Determining the target prompt word according to the part of the historical prompt words includes: The determined target prompt words include: the part of the historical prompt words.

11. The method according to claim 7, further comprising: For any second training image, perform the following processing: Using an image modification tool to modify the second training image to obtain a modified image; According to the modified picture, modify the target prompt word corresponding to the corresponding second training picture to obtain a modified prompt word that matches the modified picture; Obtaining the modification relationship information of the modification prompt word; The second training sample is composed of the modification relationship information of the modification prompt word and the modified picture.

12. The method according to claim 7, wherein: Obtaining the modification relationship information of each target prompt word includes: For any target prompt word, perform the following processing: Using a pre-trained component analysis model, determining component information of the words in the target prompt word; According to the component information, the modification relationship information is determined using a pre-trained modification relationship discrimination model.

13. The method according to claim 12, wherein: The component information of the words in the target prompt word includes: the main words, qualifiers, modifiers, subject words and grammatical words in the target prompt word; The modification relationship includes: attribute binding, reference relationship, non-sentence context and spatial position relationship.

14. A content generation method, comprising: Obtaining an input prompt word to be processed, and obtaining modification relationship information between words in the prompt word to be processed; The modification relationship information is used as input of a target model to obtain a content generation result corresponding to the prompt word to be processed, and the target model is the third content generation model trained using the method according to any one of claims 1 to 13.

15. The method according to claim 14, wherein The step of obtaining the modification relationship information between the words in the prompt word to be processed includes: Using a pre-trained component analysis model, determining component information of the words in the prompt word to be processed; According to the component information, the modification relationship information is determined using a pre-trained modification relationship discrimination model.

16. A modification relationship discrimination model training method, comprising: Constructing a third training set, wherein the third training set includes third training samples, and the third training samples include: sample prompt words; The pre-trained large language model is subjected to supervised fine-tuning training using the third training set to obtain the modification relationship discrimination model; the modification relationship discrimination model is used to construct a second training set, which includes a second training sample, and the second training sample includes: modification relationship information between words in the target prompt word determined using the modification relationship discrimination model, and a second training picture matching the target prompt word. The second training set is used to train the entity detail depiction ability of the second content generation model to obtain a third content generation model, and the second content generation model is obtained after the first content generation model is trained in entity recognition ability using the first training set. The first training set includes a first training sample, and the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture; the modification relationship discrimination model is also used to determine the modification relationship information of the input prompt word to be processed when using the third content generation model for content generation.

17. The method according to claim 16, wherein The constructing of the third training set comprises: Obtaining some historical prompt words from the historical prompt word set recorded in the scheduled business log; According to each acquired historical prompt word, a corresponding sample prompt word is constructed.

18. The method according to claim 17, wherein: The step of obtaining some historical prompt words from the historical prompt word set recorded in the predetermined service log includes: Clustering each historical prompt word in the historical prompt word set using a K-means clustering algorithm of reinforcement learning; For each obtained cluster, the following processing is performed respectively: the historical prompt words located in the cluster are sorted in ascending order according to the distance between them and the center point of the cluster, and starting from the historical prompt word that is ranked first after sorting, a historical prompt word is extracted every W historical prompt words, and T historical prompt words are extracted from the cluster, where W and T are both positive integers, W is less than T, and T is less than the number of historical prompt words included in the cluster.

19. The method according to claim 17, wherein The corresponding sample prompt words are constructed based on the acquired historical prompt words, including: For any extracted historical prompt word, perform the following processing: Determining component information of words in the historical prompt words using a pre-trained component analysis model; A default instruction template is filled in according to the historical prompt word and the component information, and a sample prompt word corresponding to the historical prompt word is determined according to the filling result.

20. The method according to claim 19, wherein The sample prompt word corresponding to the historical prompt word is determined according to the filling result, including: The determined sample prompt words corresponding to the historical prompt words include: the filling result; Alternatively, a disturbance enhancement process is performed on the filling result to obtain a sample prompt word corresponding to the historical prompt word, and the sample prompt word includes: a disturbance enhancement process result.

21. The method according to claim 20, wherein The performing disturbance enhancement processing on the filling result includes any one of the following: Selecting one from N pre-set associated words, where N is a positive integer, and adding the selected associated word to the filling result to obtain the disturbance enhancement processing result; Selecting one of S pre-set sequence adjustment methods, where S is a positive integer, and sequentially adjusting the content in the filling result according to the selected sequence adjustment method to obtain the disturbance enhancement processing result; One is selected from Q pre-set instruction templates, where Q is a positive integer, and the Q instruction templates do not include the default instruction template. The selected instruction template is refilled according to the historical prompt words and the component information, and the refilled result is determined as the disturbance enhancement processing result.

22. A content generation model training device, comprising: A first training module and a second training module; The first training module is configured to construct a first training set, the first training set including first training samples, the first training samples including: a first training image corresponding to any entity and image description information of the first training image; and train the entity recognition ability of the first content generation model using the first training set to obtain a second content generation model; The second training module is used to construct a second training set, which includes a second training sample. The second training sample includes: modification relationship information between words in the target prompt word, and a second training picture matching the target prompt word; using the second training set, the entity detail depiction ability of the second content generation model is trained to obtain a third content generation model.

23. The device according to claim 22, wherein The first training module constructs an entity cognitive map and performs the following processing on all or part of the entities in the entity cognitive map: obtaining entity pictures corresponding to the entities, the first training pictures including the entity pictures, and obtaining picture description information of the first training pictures, and generating the first training samples based on the first training pictures and the picture description information.

24. The device according to claim 23, wherein The first training module obtains a first entity with a higher than a preset first popularity from a historical prompt word set recorded in a predetermined business log, and constructs the entity cognitive map at least based on the first entity.

25. The apparatus according to claim 24, wherein The first training module is further used to obtain a second entity with a higher than preset second popularity from other predetermined data sources outside the historical prompt word set, and construct the entity cognitive map based on the first entity and the second entity.

26. The apparatus according to claim 23, wherein The first training module uses an image description generator to generate initial description information of the first training image, and uses at least one of the entity name and entity alias of the entity corresponding to the first training image to replace the target concept words in the initial description information to obtain the image description information, where the target concept words are used to represent the entity corresponding to the first training image.

27. The device according to claim 26, wherein The first training module replaces the target concept word with a predetermined target object, where the target object includes the entity name and the entity alias, or replaces the target concept word with all target objects in a flattened form, or randomly extracts the target object and replaces the target concept word with L extracted target objects, where L is a positive integer and is less than P, and P is the total number of target objects.

28. The device according to any one of claims 22 to 27, wherein The second training module obtains some historical prompt words from a set of historical prompt words recorded in a predetermined business log, determines the target prompt words based on the some historical prompt words, obtains the second training pictures corresponding to each target prompt word, and the modification relationship information of each target prompt word, and forms the second training samples based on the modification relationship information and the corresponding second training pictures.

29. The apparatus according to claim 28, wherein The modification relationship includes: M different types of modification relationships, where M is a positive integer greater than 1; The second training module determines the modification relationship type of each historical prompt word in the historical prompt word set, and extracts historical prompt words according to the principle that the more historical prompt words there are, the more historical prompt words are extracted.

30. The apparatus according to claim 28, wherein The second training module performs quality verification on the part of the historical prompt words. In response to determining that there are target historical prompt words that fail the verification, the target historical prompt words are modified and the target prompt words are determined. The target prompt words include: historical prompt words that pass the verification and the modified target historical prompt words. In response to determining that there are no target historical prompt words that fail the verification, the target prompt words include: historical prompt words that pass the verification.

31. The apparatus according to claim 28, wherein The target prompt words determined by the second training module include: the partial historical prompt words.

32. The apparatus of claim 28, wherein: The second training module is further used to perform the following processing on any second training picture: modify the second training picture using a picture modification tool to obtain a modified picture, modify the target prompt word corresponding to the corresponding second training picture based on the modified picture to obtain a modified prompt word matching the modified picture, obtain the modification relationship information of the modified prompt word, and use the modification relationship information of the modified prompt word and the modified picture to form the second training sample.

33. The apparatus according to claim 28, wherein The second training module performs the following processing on any target prompt word: using a pre-trained component analysis model to determine the component information of the words in the target prompt word, and based on the component information, using a pre-trained modification relationship discrimination model to determine the modification relationship information.

34. The apparatus according to claim 33, wherein The component information of the words in the target prompt word includes: the main words, qualifiers, modifiers, subject words and grammatical words in the target prompt word; The modification relationship includes: attribute binding, reference relationship, non-sentence context and spatial position relationship.

35. A content generation device, comprising: Get modules and generate modules; The acquisition module is used to acquire the input prompt word to be processed and acquire the modification relationship information between the words in the prompt word to be processed; The generation module is used to use the modification relationship information as the input of the target model to obtain the content generation result corresponding to the prompt word to be processed, and the target model is the third content generation model trained using the device described in any one of claims 22 to 34.

36. The apparatus of claim 35, wherein: The acquisition module uses a pre-trained component analysis model to determine component information of words in the prompt word to be processed, and uses a pre-trained modification relationship discrimination model to determine the modification relationship information based on the component information.

37. A modification relationship discrimination model training device, comprising: Building modules and training modules; The construction module is used to construct a third training set, wherein the third training set includes a third training sample, and the third training sample includes: a sample prompt word; The training module is used to perform supervised fine-tuning training on the pre-trained large language model using the third training set to obtain the modification relationship discrimination model; the modification relationship discrimination model is used to construct a second training set, which includes a second training sample, and the second training sample includes: modification relationship information between words in the target prompt word determined using the modification relationship discrimination model, and a second training picture matching the target prompt word. The second training set is used to train the entity detail depiction ability of the second content generation model to obtain a third content generation model. The second content generation model is obtained after the first content generation model is trained in entity recognition ability using the first training set. The first training set includes a first training sample, and the first training sample includes: a first training picture corresponding to any entity and picture description information of the first training picture. The modification relationship discrimination model is also used to determine the modification relationship information of the input prompt word to be processed when using the third content generation model for content generation.

38. The apparatus according to claim 37, wherein The construction module obtains some historical prompt words from a historical prompt word set recorded in a predetermined business log, and constructs corresponding sample prompt words according to each of the obtained historical prompt words.

39. The apparatus according to claim 38, wherein The construction module uses the K-means clustering algorithm of reinforcement learning to cluster each historical prompt word in the historical prompt word set, and performs the following processing on each obtained cluster: sorting each historical prompt word in the cluster in ascending order according to the distance between the historical prompt word and the center point of the cluster, and starting from the historical prompt word that is ranked first after sorting, extracting one historical prompt word every W historical prompt words, and extracting T historical prompt words from the cluster, where W and T are both positive integers, W is less than T, and T is less than the number of historical prompt words included in the cluster.

40. The apparatus of claim 38, wherein The construction module performs the following processing on any extracted historical prompt word: uses the pre-trained component analysis model to determine the component information of the words in the historical prompt word, fills the default instruction template according to the historical prompt word and the component information, and determines the sample prompt word corresponding to the historical prompt word based on the filling result.

41. The apparatus according to claim 40, wherein The sample prompt word corresponding to the historical prompt word determined by the construction module includes: the filling result, or, by performing perturbation enhancement processing on the filling result, the sample prompt word corresponding to the historical prompt word is obtained, and the sample prompt word includes: the perturbation enhancement processing result.

42. The apparatus according to claim 41, wherein The construction module selects one from N pre-set associated words, where N is a positive integer, and adds the selected associated word to the filling result to obtain the disturbance enhancement processing result. Alternatively, the construction module selects one from S pre-set sequence adjustment methods, where S is a positive integer, and sequentially adjusts the content in the filling result according to the selected sequence adjustment method to obtain the disturbance enhancement processing result. Alternatively, the construction module selects one from Q pre-set instruction templates, where Q is a positive integer, and the Q instruction templates do not include the default instruction template. The selected instruction template is refilled according to the historical prompt word and the component information, and the refilled result is determined as the disturbance enhancement processing result.

43. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 21.

44. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 21.

45. A computer program product comprising a computer program / instructions, which, when executed by a processor, implement the method of any one of claims 1 to 21.

Citation Information

Patent Citations

  • Knowledge graph entity concept description generation system

    CN113672737A

  • Open type question and answer and multi-mode large model training method and device and related equipment

    CN117235232A

  • Image automatic generation method and device based on AIGC, equipment and medium

    CN117496302A

  • Image-text recognition large model training method and device, equipment and storage medium

    CN117593608A

  • Knowledge graph construction method and device based on pre-trained large language model

    CN117851610A

Cited By

  • Rule alignment method and apparatus for model, and device, medium and product

    WO2026060722A1