Text generation model training, text generation method, device, equipment and medium
By using property attribute parameters to train the property description text generation model, the problem of content redundancy and homogeneity of general big models in real estate marketing is solved, and high-quality and personalized property description is achieved, reducing data costs and homogeneity risks.
Patent Information
- Application Number
- CN202411466843.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-10-18
AI Technical Summary
The content generated by the general big model in the application of real estate marketing is redundant, not intuitive and clear enough, and is seriously homogeneous, and cannot meet the specific needs of the real estate industry.
By obtaining property attribute parameters and text generation requirements, the first major language model is used to generate property description text, and then it is corrected and trained as the second major language model as a label. Combined with distillation technology to optimize the model, the property description text generation model is constructed, and the style and logic of the generated text are controlled.
It improves the quality of property description text, reduces the cost of data collection and labeling, reduces the homogeneity of generated text, and improves the description effect in real estate marketing scenarios.
Smart Images

Figure CN119443264B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, apparatus, device and medium for training a text generation model and generating text. Background Art
[0002] With the development of artificial intelligence technology, artificial intelligence has generated natural language texts through natural language processing technology. Such generative artificial intelligence can be used in multiple fields such as natural language question answering, machine translation, natural language summarization, chatbots, etc., and thus general large models that can be applied to various scenarios have emerged. For example, in the e-commerce field, a general large model can be used to generate product detail texts, promotional texts, or marketing texts, etc. However, in the real estate marketing field, the general large model is not sufficiently trained on real estate-related data, and the generated content is verbose, redundant, not intuitive and clear enough, and has serious homogenization problems. Summary of the Invention
[0003] To solve the above technical problems or at least partially solve the above technical problems, embodiments of the present invention provide a method, apparatus, electronic device and medium for training a text generation model and generating text.
[0004] In a first aspect, an embodiment of the present invention provides a method for training a text generation model, including:
[0005] Obtaining housing property parameters of multiple housing units;
[0006] For each housing unit, obtaining the corresponding text generation requirements and at least one description example of the housing unit, and using the housing property parameters of the housing unit, the corresponding text generation requirements of the housing unit, and at least one description example as input data to input into a first large language model to obtain a housing description text corresponding to the housing property parameters;
[0007] Using the housing description text as a label corresponding to the housing property parameters, constructing a training sample based on the housing property parameters and the corresponding label, and training a pre-constructed second large language model according to the training sample to obtain a housing description text generation model.
[0008] In an optional embodiment, the step of using the housing description text as a label corresponding to the housing property parameters and constructing a training sample based on the housing property parameters and the corresponding label includes:
[0009] Performing content correction and / or format correction on the housing description text to obtain a corrected housing description text;
[0010] Using the corrected housing description text as a label corresponding to the housing property parameters, and constructing a training sample based on the housing property parameters and the corresponding label.
[0011] In an optional embodiment, the pre-built second language model is trained based on the training samples to obtain a property description text generation model, including:
[0012] Use the pre-built second language model as the teacher model;
[0013] The teacher model is trained according to the training samples, and the teacher model is distilled according to a preset distillation method to obtain a student model corresponding to the teacher model. The teacher model is used as a property description text generation model.
[0014] In a second aspect, an embodiment of the present invention provides a text generation method, comprising:
[0015] Displaying a property description text generation page, the property description text generation page including a property basic information input control and a text generation control;
[0016] In response to an operation on the house basic information input control, obtaining property attribute parameters of the house to be described;
[0017] In response to an operation on the text generation control, the property attribute parameters of the property to be described are input as input data into a property description text generation model to obtain a property description text of the property to be described; wherein the property description text generation model is obtained according to the text generation model training method described in any embodiment of the present invention;
[0018] Display the property description text of the property to be described.
[0019] In an optional embodiment, the displaying of the property description text of the property to be described includes:
[0020] Performing compliance check on the property description text of the property to be described;
[0021] If the property description text of the property to be described passes the compliance check, displaying the property description text of the property to be described;
[0022] In the case that the property description text of the property to be described fails the compliance check, the illegal words in the property description text of the property to be described are replaced, and the replaced property description text is displayed.
[0023] In an optional embodiment, the property description text generation page further includes a plurality of description angle controls;
[0024] In response to an operation on the text generation control, the housing property parameters of the housing to be described are used as input data to input into a housing description text generation model to obtain the housing description text of the housing to be described, including:
[0025] In response to a selection instruction for the description angle control, determine at least one selected description angle;
[0026] Filter out the selected housing parameters corresponding to the selected description angle from the housing property parameters of the housing to be described;
[0027] Use the selected housing property parameters as input data to input into a housing description text generation model to obtain the housing description text of the housing to be described.
[0028] In a third aspect, an embodiment of the present invention provides a training device for a text generation model, including:
[0029] An acquisition module, configured to acquire housing property parameters of multiple housing units;
[0030] A data enhancement module, for each housing unit, to acquire the text generation requirements and at least one description example corresponding to the housing unit, and use the housing property parameters of the housing unit, the text generation requirements corresponding to the housing unit, and at least one description example as input data to input into a first large language model to obtain the housing description text corresponding to the housing property parameters;
[0031] A training module, configured to use the housing description text as the label corresponding to the housing property parameters, construct training samples based on the housing property parameters and the corresponding labels, and train a pre-constructed second large language model according to the training samples to obtain a housing description text generation model.
[0032] In an optional embodiment, the data enhancement module is further configured to: perform content correction and / or format correction on the housing description text to obtain a corrected housing description text; use the corrected housing description text as the label corresponding to the housing property parameters, and construct training samples based on the housing property parameters and the corresponding labels.
[0033] In an optional embodiment, the training module is further configured to: use the pre-constructed second large language model as a teacher model; train the teacher model according to the training samples, and perform distillation processing on the teacher model according to a preset distillation method to obtain a student model corresponding to the teacher model, and use the teacher model as a housing description text generation model.
[0034] In a fourth aspect, an embodiment of the present invention further provides a text generation device, including:
[0035] A display module for displaying a housing description text generation page, where the housing description text generation page includes a housing basic information input control and a text generation control;
[0036] A receiving module for obtaining housing property parameters of the housing to be described in response to an operation on the housing basic information input control;
[0037] A generation module for, in response to an operation on the text generation control, taking the housing property parameters of the housing to be described as input data and inputting them into a housing description text generation model to obtain a housing description text of the housing to be described; wherein, the housing description text generation model is obtained according to the above method;
[0038] A display module for displaying the housing description text of the housing to be described.
[0039] In an optional embodiment, the display module is further configured to: perform a compliance check on the housing description text of the housing to be described; display the housing description text of the housing to be described when the housing description text of the housing to be described passes the compliance check; and replace the illegal words in the housing description text of the housing to be described and display the replaced housing description text when the housing description text of the housing to be described fails to pass the compliance check.
[0040] In an optional embodiment, the housing description text generation page further includes a plurality of description angle controls;
[0041] The training module is further configured to: in response to a selection instruction for the description angle control, determine at least one selected description angle; screen out the selected housing parameters corresponding to the selected description angle from the housing property parameters of the housing to be described; and take the selected housing property parameters as input data and input them into a housing description text generation model to obtain a housing description text of the housing to be described.
[0042] In a fifth aspect, an embodiment of the present invention further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used for storing a computer program; and the processor is configured to, when executing the program stored in the memory, implement the training method or the text generation method of the text generation model according to any embodiment of the present invention.
[0043] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the training method or the text generation method of the text generation model according to any embodiment of the present invention.
[0044] The technical solutions provided by the embodiments of the present invention at least bring the following beneficial effects:
[0045] In the text generation model training method provided by the embodiments of the present invention, the housing property parameters of each housing, the text generation requirements corresponding to each housing, and at least one description example are respectively used as input data and input into the first large language model to obtain the housing description text corresponding to the housing property parameters of each housing. Training samples are constructed based on the housing property parameters and the corresponding housing description texts of each housing, where the housing description text is used as the label of the training sample. The pre-constructed second large language model is trained using the training samples, and the trained second large language model is used as the housing description text generation model. This method automatically generates the housing description text corresponding to each housing through the first large language model, text generation requirements, and at least one description example, and uses the housing description text as the label of the training sample, avoiding manual construction and annotation of samples and reducing the data collection cost and data annotation cost; by controlling the first large language model to generate the output expected by the user based on the housing property parameters of the housing through the text generation requirements and description examples, that is, controlling the style, format, and logic of the text generated by the first large language model based on the housing property parameters of the housing by combining the text generation requirements and description examples, using the housing description text as the label, and constructing training samples with the label and housing property parameters to train the second large language model, enabling the second large language model to learn the mapping relationship between the housing property parameters and the housing description text in the training samples, so that the second large language model can learn the training data in the real estate marketing scenario and obtain the housing description text generation model, and generating the description text in the real estate marketing scenario with the help of the inference ability of the housing description text generation model, which helps to improve the quality of the generated text and reduce the homogenization of the generated text. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required to be used in the description of the embodiments or the prior art.
[0047] Figure 1 The flowchart of the text generation model training method provided by an embodiment of the present invention is shown;
[0048] Figure 2 The flowchart of the text generation method provided by an embodiment of the present invention is shown;
[0049] Figure 3 The flowchart of the text generation method provided by another embodiment of the present invention is shown;
[0050] Figure 4 The structural diagram of the text generation model training device provided by the embodiments of the present invention is shown;
[0051] Figure 5 The structural schematic diagram of the text generation device provided by an embodiment of the present invention is shown;
[0052] Figure 6 The structural schematic diagram of the electronic device provided by an embodiment of the present invention is shown. Detailed implementation manners
[0053] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted below.
[0054] The terms "first", "second", etc. in the description and claims of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the description and claims means at least one of the connected objects. The character " / " generally indicates an "or" relationship between the associated objects before and after.
[0055] Figure 1 The flow schematic diagram of the training method of the text generation model provided by an embodiment of the present invention is shown. As Figure 1 shown, the training method of the text generation model includes:
[0056] Step S101: Obtain the housing property parameters of multiple housing units. Among them, the housing property parameters include basic parameters describing the housing unit, such as geographical location, building area, age of the house, orientation of the housing unit, housing type, floor, price, etc. As an optional example, the housing property parameters are shown as follows:
[0057] {
[0058] "Price": 680,000
[0059] "Purchase age": Five-year-old and the only one
[0060] "Area": 97.0
[0061] "Floor": 15 / 21
[0062] "Housing type": 2 bedrooms, 2 living rooms, and 1 bathroom
[0063] "Orientation": North-south
[0064] "Construction year": 2004
[0065] "Decoration": Fine decoration
[0066] "Sale type": Second-hand housing
[0067] "Property type": Ordinary residence
[0068] "Property right type": Commercial housing
[0069] "Property right term": 70 years
[0070] "Video": There is a real-shot video
[0071] "Panorama": There is a real-shot panorama
[0072] "Recommendation reasons": 1. The community is located on the shore of Taihu Lake, with a pleasant environment and a unique geographical location, making it an ideal place for living; 2. This house is located in the middle of the community, with unobstructed lighting and a very open view; 3. The house type is regular, and you can enjoy the beautiful scenery of Taihu Lake head-on.
[0073] }
[0074] Step S102: For each housing source, obtain the text generation requirements and at least one description example corresponding to the housing source, and use the housing source attribute parameters, the text generation requirements corresponding to the housing source, and at least one description example as input data to input into the first large language model to obtain the housing source description text corresponding to the housing source attribute parameters.
[0075] A large language model refers to a pre-trained language model that contains tens of billions or more parameters and is trained using large-scale corpus data. As an optional example, the first large language model can be a general large language model. The text generation requirements are used to guide the model to generate the output expected by the user and improve the quality of the generated text. The description example is used to assist the model in better understanding the user's intention and expected results, and it includes example input and example output. Optionally, the text generation requirements can also include constraint conditions, which control the style, format, and logic of the text generated by the model, and can also constrain the maximum length of the generated text to avoid the model outputting results that are too long or too short. In this step, the text generation requirements and the description example are used to control the first large language model to generate the output expected by the user based on the housing source attribute parameters, that is, to control the first large language model to generate the style, format, and logic of the text corresponding to the housing source attribute parameters in combination with the text generation requirements and the description example, so that the first large language model outputs the housing source description text with the style, format, logic, etc. expected by the user.
[0076] As an optional example, the text generation requirements provided in the embodiments of the present invention can be as follows:
[0077] Please generate a housing description text that matches the style based on the following description examples and in close combination with the provided housing parameters. Please strictly follow the above requirements to complete the generation of the housing description text.
[0078] As an optional example, a description example provided by an embodiment of the present invention is as follows:
[0079] Example input: "Price": "680,000", "Purchase years": "Full five and only one", "Area": 97.0, "Floor": "15 / 21", "House type": "2 bedrooms, 2 living rooms, 1 bathroom", "Orientation": "North and south".
[0080] Example output:
[0081]
Overview of the housing
[0082]
Advantages and features
[0083]
Reasons for recommendation
[0084] In this step, the housing attribute parameters, text generation requirements and description examples are used as input data to input into the first large language model. The first large language model accurately captures the user's intention according to the text generation requirements and description examples, and generates a housing description text that not only meets the specifications but also has unique personality, improving the flexibility and efficiency of text generation.
[0085] Step S103: Use the housing description text as the label corresponding to the housing attribute parameters. Based on the housing attribute parameters and the corresponding labels, construct a training sample, and train a pre-constructed second large language model according to the training sample to obtain a housing description text generation model. The second large language model can be the same as the first large language model or different from the first large language model. The present invention does not make any restrictions here.
[0086] In this step, training samples can be constructed according to a preset structured format. As an optional example, each training sample can include three key fields, namely: task requirements, input data, and output data. The task requirements field is used to clearly indicate the task requirements. For example, the task requirements can be to generate a concise and word-limited housing description text based on given housing property parameters. Optionally, the task requirements can also include constraints to control the style, format, and logic of the housing description text generated by the model, and can also constrain the maximum length of the generated text to avoid the model outputting overly long or short results. The input data field is used to list housing property parameters such as price, purchase years, area, floor, housing type, and orientation. The output data field is the housing description text output by the first large language model, which serves as the target label for the second large language model. The housing description text output by the first large language model is in the style, format, and logic expected by the user. Using this housing description text as a label to construct training samples enables the housing description text output by the second large language model to also be in the style, format, and logic expected by the user.
[0087] Construct a training sample set based on the housing property parameters of each housing unit and the corresponding housing description texts of the housing property parameters of each housing unit, and use this training sample set to train the second large language model to obtain housing description texts.
[0088] The text generation model training method provided by the embodiments of the present invention inputs the housing property parameters of each housing unit, the text generation requirements corresponding to each housing unit, and at least one description example as input data into a first large language model to obtain the housing description text corresponding to the housing property parameters of each housing unit. Training samples are constructed based on the housing property parameters and the corresponding housing description texts of each housing unit, where the housing description text is used as the label of the training sample. The pre-constructed second large language model is trained using the training sample, and the trained second large language model is used as the housing description text generation model. This method automatically generates the housing description text corresponding to each housing unit through the first large language model, text generation requirements, and description examples, and uses the housing description text as the label of the training sample, avoiding manual construction and annotation of samples, and reducing the data collection cost and data annotation cost; by controlling the first large language model based on the housing property parameters of the housing unit through the text generation requirements and description examples to generate the output expected by the user, that is, controlling the first large language model to generate the style, format, and logic of the text based on the housing property parameters of the housing unit in combination with the text generation requirements and description examples, using the housing description text as the label, and constructing a training sample with the label and housing property parameters to train the second large language model, so that the second large language model learns the mapping relationship between the housing property parameters and the housing description text in the training sample. Therefore, the second large language model can learn the training data in the real estate marketing scenario, obtain the housing description text generation model, and then use the housing description text generation model to generate the description text in the real estate marketing scenario, which helps to improve the quality of the generated text and reduce the homogenization of the generated text.
[0089] In the embodiments of the present application, since the first large language model is a general large language model, the housing description text generated by it may be incorrect. The effect of the housing description text generation model directly trained using these housing description texts is unstable, and the quality of the generated housing description text is unstable (such as having content errors or format errors). To improve the ability of the housing description text generation model, after the first large language model generates the housing description text, the generated housing description text is corrected (such as manually or using rules) to obtain a correct and high-quality housing description text, and then it is used as the label of the training sample to train the second large language model. Therefore, in an optional embodiment, the training method of the text generation model corrects the content and / or format of the obtained housing description text after obtaining the housing description text using the first large language model to obtain the corrected housing description text; uses the corrected housing description text as the label corresponding to the housing property parameters, and constructs a training sample based on the corrected housing description text.
[0090] The parameter scale of the housing source description text generation model obtained based on the second large language model in the embodiments of the present invention is relatively large, and requires a lot of resources during application, resulting in an increase in application costs. To reduce resource requirements and costs, when training the second large language model, it can be distilled based on a preset distillation method to obtain a distilled version model. The obtained distilled version model is used as the housing source description text generation model.
[0091] In an alternative embodiment, step S103 trains a pre-constructed second large language model according to training samples to obtain a housing source description text generation model, including:
[0092] Taking the pre-constructed second large language model as the teacher model;
[0093] Training the teacher model according to the training samples, and distilling the teacher model according to a preset distillation method to obtain a student model corresponding to the teacher model, and using the teacher model as the housing source description text generation model.
[0094] Among them, distilling the teacher model according to a preset distillation method is to transfer the knowledge of a large and complex model (teacher model) to a smaller and simpler model (referred to as the student model) using knowledge distillation technology (KD). Optionally, in the process of training the second large language model, the LORA (Low-Rank Adaptation) fine-tuning method can be adopted. While keeping most of the parameters of the second large language model unchanged, a small number of parameter adjustments are made to achieve rapid adaptation to specific tasks. At the same time, the cross-entropy loss function is introduced as the optimization objective to ensure the minimum error between the model output and the true label, thereby improving the accuracy and relevance of the generated copywriting.
[0095] In the embodiments of the present invention, by distilling the second large language model, a smaller and simpler housing source description text generation model is obtained, which not only reduces the computational and storage requirements of the model, but also makes the model easier to deploy, especially suitable for resource-constrained environments.
[0096] Figure 2 Shows a schematic flowchart of a text generation method provided by an embodiment of the present invention. As Figure 2 shown, the text generation method includes:
[0097] Step S201: Display a housing description text generation page. The housing description text generation page is used to receive user instructions and generate housing description text according to the user instructions. The housing description text generation page includes a housing basic information input control and a text generation control. The housing basic information input control is used to receive the housing basic information input by the user and obtain housing attribute parameters based on the housing basic information. The text generation control is used to call the housing description text generation model to generate housing description text. Among them, the housing description text generation model is obtained according to the text generation model training method provided in the embodiments of the present invention.
[0098] Step S202: In response to an operation on the housing basic information input control, obtain the housing attribute parameters of the housing to be described.
[0099] Step S203: In response to an operation on the text generation control, input the housing attribute parameters of the housing to be described as input data into the housing description text generation model, and obtain the housing description text of the housing to be described.
[0100] Step S204: Display the housing description text of the housing to be described.
[0101] The text generation method provided by the embodiments of the present invention receives the housing basic information input by the user through the housing basic information receiving control, thereby obtaining housing attribute parameters. In response to detecting an operation on the text generation control, the housing description text generation model is called, and the housing attribute parameters are processed by the housing description text generation model to generate a housing description text in a specified format, and the housing description text is displayed, which is convenient for users to quickly and comprehensively understand the housing.
[0102] In an optional embodiment, in order to ensure the compliance of the generated housing description text, it can be subjected to compliance verification before display. In the case where the housing description text of the housing to be described passes the compliance verification, the housing description text is directly displayed. In the case where the compliance verification is not passed, the illegal words in the housing description text are replaced, and the replaced housing description text is displayed. In an optional embodiment, an illegal word library and / or verification rules can be preset, and the housing description text is subjected to compliance verification based on the illegal word library. As an optional example, the illegal word library includes, but is not limited to, words that do not conform to relevant laws and regulations. The verification rules can include, but are not limited to, business restriction rules (such as prohibiting commitments and prohibiting the appearance of explicit contact information) and city restriction rules (such as xx community prohibits xx price in a certain area).
[0103] By performing compliance verification on the housing description text, the embodiments of the present invention can avoid risks caused by illegal content and reduce the complaint rate.
[0104] Figure 3The flowchart of the text generation method provided by another embodiment of the present invention is shown. As Figure 3 shown, the method includes:
[0105] Step S301: Display a housing description text generation page, which includes a housing basic information input control, a text generation control, and a description angle control. Among them, the description angle control is used to select different description angles. For different description angles, the housing attribute parameters for generating the housing description text are different, and the housing attribute parameters for generating the housing description text are controlled through different description angles. As an optional example, the description angles include but are not limited to the following angles: price and taxes, housing structure, housing quality, community advantages, and property rights, etc.
[0106] Step S302: In response to an operation on the housing basic information input control, obtain the housing attribute parameters of the housing to be described.
[0107] Step S303: In response to a selection instruction for the description angle control, determine at least one selected description angle.
[0108] Step S304: Screen out the selected housing parameters corresponding to the selected description angle from the housing attribute parameters of the housing to be described.
[0109] Step S305: In response to an operation on the text generation control, input the selected housing attribute parameters as input data into the housing description text generation model to obtain the housing description text of the housing to be described. Among them, the housing description text generation model is obtained according to the training method of the text generation model in any embodiment of the present invention.
[0110] Step S306: Display the housing description text of the housing to be described.
[0111] The text generation method provided by the embodiment of the present invention can control the housing attribute parameters for generating the housing description text through the description angle control, screen the housing attribute parameters from different angles to control the style of the generated housing description text, prevent the homogenization of the content of the housing description text, and improve the quality of the content of the generated housing description text.
[0112] In an optional embodiment, the housing description text generation page further includes a note control. The note control is used to receive the user's note information, such as the housing features customarily supplemented by the user. The text generation method further includes: in response to an operation on the note control, receive the note information input by the user, splice the note information with the generated housing description text, and display it.
[0113] Figure 4 The structural schematic diagram of the text generation model training device provided by the embodiment of the present invention is shown.
[0114] As shown Figure 4 in the figure, the text generation model training device 400 includes:
[0115] An acquisition module 401, configured to acquire housing property parameters of multiple housing units;
[0116] A data augmentation module 402, configured to, for each housing unit, acquire the text generation requirements and at least one description example corresponding to the housing unit, and use the housing property parameters of the housing unit, the text generation requirements corresponding to the housing unit, and at least one description example as input data to input into a first large language model, and obtain a housing description text corresponding to the housing property parameters;
[0117] A training module 403, configured to use the housing description text as a label corresponding to the housing property parameters, construct a training sample based on the housing property parameters and the corresponding labels, and train a pre-constructed second large language model according to the training sample to obtain a housing description text generation model.
[0118] In an optional embodiment, the data augmentation module is further configured to: perform content correction and / or format correction on the housing description text to obtain a corrected housing description text; use the corrected housing description text as a label corresponding to the housing property parameters, and construct a training sample based on the housing property parameters and the corresponding labels.
[0119] In an optional embodiment, the training module is further configured to: use the pre-constructed second large language model as a teacher model; train the teacher model according to the training sample, and perform distillation processing on the teacher model according to a preset distillation method to obtain a student model corresponding to the teacher model, and use the teacher model as a housing description text generation model.
[0120] Figure 5 shows a schematic structural diagram of a text generation device provided by an embodiment of the present invention. As shown Figure 5 in the figure, the text generation device 500 includes:
[0121] A display module 501, configured to display a housing description text generation page, where the housing description text generation page includes a housing basic information input control and a text generation control;
[0122] A receiving module 502, configured to acquire housing property parameters of a housing unit to be described in response to an operation on the housing basic information input control;
[0123] A generation module 503, configured to, in response to an operation on the text generation control, input the housing property parameters of the housing to be described as input data into a housing description text generation model, and obtain a housing description text of the housing to be described; wherein, the housing description text generation model is obtained according to the text generation model training method provided in any embodiment of the present invention;
[0124] A display module 504, configured to display the housing description text of the housing to be described.
[0125] In an optional embodiment, the display module is further configured to: perform compliance verification on the housing description text of the housing to be described; display the housing description text of the housing to be described when the housing description text of the housing to be described passes the compliance verification; and replace the illegal words in the housing description text of the housing to be described and display the replaced housing description text when the housing description text of the housing to be described fails to pass the compliance verification.
[0126] In an optional embodiment, the housing description text generation page further includes a plurality of description angle controls;
[0127] The generation module is further configured to: in response to a selection instruction for the description angle control, determine at least one selected description angle; screen out the selected housing parameters corresponding to the selected description angle from the housing property parameters of the housing to be described; and input the selected housing property parameters as input data into the housing description text generation model to obtain the housing description text of the housing to be described.
[0128] The above device can execute the method provided in the embodiment of the present invention, and has function modules and beneficial effects corresponding to the execution of the method. For technical details not described in detail in this embodiment, reference can be made to the method provided in the embodiment of the present invention.
[0129] Figure 6 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention. As Figure 6 shown, the electronic device includes:
[0130] A processor 601, a communication interface 602, a memory 603, and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604,
[0131] The memory 603 is used for storing a computer program;
[0132] The processor 601, when executing the program stored on the memory 603, implements the following steps:
[0133] Obtain housing property parameters of multiple housing units;
[0134] For each housing unit, obtain the text generation requirements and at least one description example corresponding to the housing unit, and use the housing unit attribute parameters of the housing unit, the text generation requirements corresponding to the housing unit, and at least one description example as input data to input into a first large language model to obtain a housing unit description text corresponding to the housing unit attribute parameters;
[0135] Use the housing unit description text as a label corresponding to the housing unit attribute parameters, construct a training sample based on the housing unit attribute parameters and the corresponding label, and train a pre-constructed second large language model according to the training sample to obtain a housing unit description text generation model.
[0136] The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0137] The communication interface is used for communication between the above terminal and other devices.
[0138] The memory may include a Random Access Memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0139] The above processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0140] In another embodiment provided by the present invention, there is also provided a computer-readable storage medium storing instructions, which when running on a computer, cause the computer to execute the text generation model training method or the text generation method described in any one of the above embodiments.
[0141] In another embodiment provided by the present invention, there is also provided a computer program product containing instructions, which when running on a computer, cause the computer to execute the text generation model training method or the text generation method described in any one of the above embodiments.
[0142] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, a computer, a server, or a data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0143] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "comprising a..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0144] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the related parts, reference can be made to the corresponding description in the method embodiment.
[0145] The above are only the preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are all included in the protection scope of the present invention.
Claims
1. A method for training a text generation model, characterized in that Including: Obtaining the housing property parameters of multiple housing units; For each housing unit, obtaining the text generation requirements and at least one description example corresponding to the housing unit, and using the housing property parameters of the housing unit, the text generation requirements corresponding to the housing unit, and at least one description example as input data to input into a first large language model to obtain the housing description text corresponding to the housing property parameters; Wherein, the description example includes an example input and an example output; the obtaining of the housing description text corresponding to the housing property parameters includes, in combination with the text generation requirements and at least one description example corresponding to the housing unit, controlling the first large language model to generate the style, format, and logic of the housing description text corresponding to the housing property parameters, so that the first large language model outputs the housing description text with the style, format, and logic expected by the user; Using the housing description text as the label corresponding to the housing property parameters, constructing a training sample based on the housing property parameters and the corresponding label, and training a pre-constructed second large language model according to the training sample to obtain a housing description text generation model.
2. The method according to claim 1, wherein The using the housing description text as the label corresponding to the housing property parameters and constructing a training sample based on the housing property parameters and the corresponding label includes: Performing content correction and / or format correction on the housing description text to obtain a corrected housing description text; Using the corrected housing description text as the label corresponding to the housing property parameters and constructing a training sample based on the housing property parameters and the corresponding label.
3. The method according to claim 1 or 2, characterized in that, The training the pre-constructed second large language model according to the training sample to obtain a housing description text generation model includes: Using the pre-constructed second large language model as a teacher model; Training the teacher model according to the training sample and performing distillation processing on the teacher model according to a preset distillation method to obtain a student model corresponding to the teacher model, and using the teacher model as a housing description text generation model.
4. A text generation method, characterized in that, Including: Displaying a housing description text generation page, where the housing description text generation page includes a housing basic information input control and a text generation control; In response to an operation on the housing basic information input control, obtaining the housing property parameters of the housing unit to be described; In response to an operation on the text generation control, using the housing property parameters of the housing unit to be described as input data to input into a housing description text generation model to obtain the housing description text of the housing unit to be described; wherein, the housing description text generation model is obtained according to the method of any one of claims 1-3; Displaying the housing description text of the housing unit to be described.
5. The method according to claim 4, wherein The displaying the housing description text of the housing unit to be described includes: Performing compliance verification on the housing description text of the housing unit to be described; When the housing description text of the housing unit to be described passes the compliance verification, displaying the housing description text of the housing unit to be described; When the housing description text of the housing unit to be described fails to pass the compliance verification, replacing the illegal words in the housing description text of the housing unit to be described and displaying the replaced housing description text.
6. The method according to claim 5, characterized in that The housing description text generation page further includes a plurality of description angle controls; Responding to an operation on the text generation control, inputting the housing property parameters of the housing to be described as input data into a housing description text generation model to obtain the housing description text of the housing to be described, including: Responding to a selection instruction for the description angle control to determine at least one selected description angle; Filtering out the selected housing parameters corresponding to the selected description angle from the housing property parameters of the housing to be described; Inputting the selected housing property parameters as input data into the housing description text generation model to obtain the housing description text of the housing to be described.
7. A text generation model training device, characterized in that, Including: An acquisition module for acquiring the housing property parameters of multiple housing units; A data enhancement module for, for each housing unit, acquiring the text generation requirements and at least one description example corresponding to the housing unit, and inputting the housing property parameters of the housing unit, the text generation requirements corresponding to the housing unit, and at least one description example as input data into a first large language model to obtain the housing description text corresponding to the housing property parameters; Wherein, the description example includes an example input and an example output; obtaining the housing description text corresponding to the housing property parameters includes, in combination with the text generation requirements corresponding to the housing unit and at least one description example, controlling the first large language model to generate the style, format, and logic of the housing description text corresponding to the housing property parameters, so that the first large language model outputs the housing description text with the style, format, and logic expected by the user; A training module for using the housing description text as the label corresponding to the housing property parameters, constructing a training sample based on the housing property parameters and the corresponding label, and training a pre-constructed second large language model according to the training sample to obtain a housing description text generation model.
8. A text generation device, characterized in that, Including: A display module for displaying a housing description text generation page, which includes a housing basic information input control and a text generation control; A receiving module for, in response to an operation on the housing basic information input control, acquiring the housing property parameters of the housing to be described; A generation module for, in response to an operation on the text generation control, inputting the housing property parameters of the housing to be described as input data into a housing description text generation model to obtain the housing description text of the housing to be described; wherein, the housing description text generation model is obtained according to the method described in any one of claims 1-3; A display module for displaying the housing description text of the housing to be described.
9. An electronic device, characterized in that, Including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used for storing a computer program; The processor, when executing the program stored on the memory, implements the method described in any one of claims 1-6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method described in any one of claims 1-6.
Citation Information
Patent Citations
House resource title generation model training method and device, house resource title generation model generation method and device and equipment
CN112711942A
Downstream task model generation method, task execution method, and device
WO2024099144A1