Text generation model training method and device, text generation method and device, equipment and medium
By using property attribute parameters and text generation requirements and description examples to generate property description text and train it as a tag, the problem of verbose and redundant and homogeneous content generation in real estate marketing is solved, and the problem of general big model generating content in real estate marketing is achieved. High-quality, low-homogeneous property description text generation.
Patent Information
- Application Number
- CN202411466843.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-18
AI Technical Summary
In the field of real estate marketing, general big models do not train the relevant data in the real estate industry enough, and the generated real estate description text is verbose and redundant, not intuitive and clear enough, and is seriously homogeneous.
By obtaining the property attribute parameters of multiple properties, and combining the text generation requirements and description examples of the corresponding text of the property, the first major language model is used to generate the property description text, and then using the text as a label to construct the training sample, The two major language models were trained to obtain the property description text generation model.
This method avoids manual construction and labeling of samples, reduces data collection and labeling costs, controls the style, format and logic of generated text through text generation requirements and description examples, improves the quality of generated text, and reduces homogeneity.
Smart Images

Figure CN119443264A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a text generation model training, a text generation method, a device, a equipment and a medium. Background Art
[0002] With the development of artificial intelligence technology, artificial intelligence has generated natural language text through natural language processing technology. This generative artificial intelligence can be used in many fields such as natural language question answering, machine translation, natural language summarization, chatbots, etc., and a general large model that can be applied in various scenarios is generated. For example, in the field of e-commerce, a general large model can be used to generate product details text, promotional text or marketing text. However, in the field of real estate marketing, the general large model is not sufficiently trained on the relevant data of the real estate industry, and the generated content is verbose and redundant, not intuitive and clear, and has serious homogeneity. Summary of the invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, an embodiment of the present invention provides a text generation model training, a text generation method, a device, an electronic device and a medium.
[0004] In a first aspect, an embodiment of the present invention provides a text generation model training method, comprising:
[0005] Get the property attribute parameters of multiple properties;
[0006] For each house listing, obtaining text generation requirements and at least one description example corresponding to the house listing, inputting the house listing attribute parameters, the text generation requirements and at least one description example corresponding to the house listing as input data into a first language model, and obtaining a house listing description text corresponding to the house listing attribute parameters;
[0007] The property description text is used as the label corresponding to the property attribute parameters, and training samples are constructed based on the property attribute parameters and the corresponding labels. The pre-constructed second largest language model is trained according to the training samples to obtain a property description text generation model.
[0008] In an optional embodiment, the step of using the property description text as a label corresponding to the property attribute parameter and constructing a training sample based on the property attribute parameter and the corresponding label includes:
[0009] Correcting the content and / or format of the property description text to obtain a corrected property description text;
[0010] The corrected property description text is used as a label corresponding to the property attribute parameter, and a training sample is constructed based on the property attribute parameter and the corresponding label.
[0011] In an optional embodiment, the pre-built second language model is trained according to the training samples to obtain a housing 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, and the teacher model is used as a housing 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, wherein the property description text generation page includes 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 a house attribute parameter of the house to be described;
[0017] In response to the operation of 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 training method of the text generation model 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 house description text of the house 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 to pass 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 the operation of the text generation control, inputting the property attribute parameters of the to-be-described property as input data into a property description text generation model to obtain the property description text of the to-be-described property, including:
[0025] In response to a selection instruction of the description angle control, determining at least one selected description angle;
[0026] Filtering out selected property parameters corresponding to the selected description angle from property attribute parameters of the property to be described;
[0027] The selected property attribute parameters are input as input data into a property description text generation model to obtain a property description text of the property to be described.
[0028] In a third aspect, an embodiment of the present invention provides a training device for a text generation model, comprising:
[0029] The acquisition module is used to obtain the property attribute parameters of multiple properties;
[0030] a data enhancement module, for obtaining, for each house listing, text generation requirements and at least one description example corresponding to the house listing, inputting the house listing attribute parameters, the text generation requirements and at least one description example corresponding to the house listing as input data into a first language model, and obtaining a house listing description text corresponding to the house listing attribute parameters;
[0031] The training module is used to use the property description text as the label corresponding to the property attribute parameters, construct training samples based on the property attribute parameters and the corresponding labels, and train the pre-constructed second largest language model according to the training samples to obtain a property description text generation model.
[0032] In an optional embodiment, the data enhancement module is further used to: perform content correction and / or format correction on the property description text to obtain a corrected property description text; use the corrected property description text as a label corresponding to the property attribute parameters, and construct training samples based on the property attribute parameters and the corresponding labels.
[0033] In an optional embodiment, the training module is also used to: use the pre-constructed second largest language model as a teacher model; train the teacher model according to the training samples, and distill 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 property description text generation model.
[0034] In a fourth aspect, an embodiment of the present invention further provides a text generation device, comprising:
[0035] A display module, used to display a page for generating a text description of a house, wherein the page includes a control for inputting basic information of the house and a control for generating a text;
[0036] A receiving module, configured to obtain property attribute parameters of the property to be described in response to an operation on the property basic information input control;
[0037] A generation module, configured to, in response to an operation on the text generation control, input the property attribute parameters of the property to be described 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 method according to any one of claims 1 to 3;
[0038] The display module is used to display the property description text of the property to be described.
[0039] In an optional embodiment, the display module is further used to: perform compliance verification on the property description text of the property to be described; if the property description text of the property to be described passes the compliance verification, display the property description text of the property to be described; if the property description text of the property to be described fails to pass the compliance verification, replace illegal words in the property description text of the property to be described, and display the replaced property description text.
[0040] In an optional embodiment, the property description text generation page further includes a plurality of description angle controls;
[0041] The training module is also used to: determine at least one selected description angle in response to a selection instruction for the description angle control; filter out selected property parameters corresponding to the selected description angle from the property attribute parameters of the property to be described; and input the selected property attribute parameters as input data into a property description text generation model to obtain the property description text of the property to be described.
[0042] In a fifth aspect, an embodiment of the present invention further provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is used to store computer programs; and the processor is used to implement the text generation model training method or the text generation method described in any embodiment of the present invention when executing the program stored in the memory.
[0043] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the text generation model training method or text generation method described in any embodiment of the present invention.
[0044] The technical solution provided by the embodiment of the present invention brings at least the following beneficial effects:
[0045] The text generation model training method provided by the embodiment of the present invention inputs the property parameters of each house, the text generation requirements corresponding to each house, and at least one description example as input data into a first language model, obtains the property description text corresponding to the property parameters of each house, constructs a training sample based on the property parameters of each house and the corresponding property description text, wherein the property description text is used as the label of the training sample, and uses the training sample to train a pre-constructed second language model, and uses the trained second language model as a property description text generation model. The method automatically generates a property description text corresponding to each property through a first language model, text generation requirements and at least one description example, uses the property description text as a label of a training sample, avoids manual construction and annotation of samples, and reduces data collection costs and data annotation costs; controls the first language model to generate a user-expected output based on the property attribute parameters of the property through text generation requirements and description examples, that is, controls the style, format and logic of the text generated by the first language model based on the property attribute parameters of the property in combination with the text generation requirements and description examples, uses the property description text as a label, constructs a training sample using the label and the property attribute parameters to train the second language model, enables the second language model to learn the mapping relationship between the property attribute parameters and the property description text in the training sample, thereby enabling the second language model to learn the training data in the real estate marketing scenario, obtains a property description text generation model, generates a description text in the real estate marketing scenario with the help of the reasoning ability of the property description text generation model, and helps to improve the quality of the generated text and reduce the homogeneity of the generated text. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0047] Figure 1 A schematic diagram of a flow chart of a text generation model training method provided by an embodiment of the present invention is shown;
[0048] Figure 2 A schematic diagram showing a flow chart of a text generation method provided by an embodiment of the present invention;
[0049] Figure 3 A schematic diagram showing a flow chart of a text generation method provided by another embodiment of the present invention;
[0050] Figure 4 A schematic diagram showing the structure of a text generation model training device provided by an embodiment of the present invention is shown;
[0051] Figure 5 A schematic diagram showing the structure of a text generation device provided by an embodiment of the present invention is shown;
[0052] Figure 6 A schematic structural diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0053] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention 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 invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0054] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0055] Figure 1 FIG. 1 is a flow chart of a method for training a text generation model provided by an embodiment of the present invention. Figure 1 As shown, the training method of the text generation model includes:
[0056] Step S101: Acquire property parameters of multiple properties. The property parameters include basic parameters describing the property, such as geographical location, building area, age, orientation, type of property, floor, price, etc. As an optional example, the property parameters are as follows:
[0057] {
[0058] "Price": 680,000
[0059] "Purchase Year": Fully five years old
[0060] "Area":97.0
[0061] "Floor":15 / 21
[0062] "House Type": 2 bedrooms, 2 living rooms, 1 bathroom
[0063] "Direction": North-South
[0064] "Construction Year": 2004
[0065] "Decoration": Fine decoration
[0066] "Sale Type": Second-hand House
[0067] "Property Type": Ordinary Residential
[0068] "Property Type": Commercial Housing
[0069] "Property Rights Period": 70 years
[0070] "Video": There is a real video
[0071] "Panorama": Real panoramic view
[0072] "Reasons for recommendation": 1. The community is located on the shore of Taihu Lake, with a pleasant environment and a unique geographical location, making it a great place to live; 2. The house is located in the middle of the community, with unobstructed lighting and a wide view; 3. The house has a decent layout and you can enjoy the beautiful scenery of Taihu Lake right in front of you.
[0073] }
[0074] Step S102: For each house, obtain text generation requirements and at least one description example corresponding to the house, input the house attribute parameters of the house, the text generation requirements corresponding to the house, and at least one description example into a first language model as input data, and obtain a house description text corresponding to the house 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 to better understand the user's intentions and expected results, which includes example inputs and example outputs. Optionally, the text generation requirements may also include constraints, which control the style, format and logic of the text generated by the model through the constraints, and may also constrain the maximum length of the generated text to avoid the model outputting too long or too short results. This step controls the first large language model to generate the output expected by the user based on the property parameters of the house through the text generation requirements and the description examples, that is, the style, format and logic of the text corresponding to the property parameters of the house are controlled by the first large language model in combination with the text generation requirements and the description examples, so that the first large language model outputs the house description text of the style, format, logic, etc. expected by the user.
[0076] As an optional example, the text generation requirement provided by the embodiment of the present invention may be as follows:
[0077] Please follow the description examples below and closely combine the provided property parameters to generate a property description text that matches the style. Please strictly follow the above requirements to complete the generation of the property description text.
[0078] As an optional example, a description example provided by an embodiment of the present invention is as follows:
[0079] Sample input: "Price":"680,000", "Years of Purchase":"Five years or more, only one", "Area":97.0", "Floor":"15 / 21", "Unit Type":"2 bedrooms, 2 living rooms, 1 bathroom", "Orientation":"North-South".
[0080] Sample output:
[0081] [Property Overview] Two bedrooms, two living rooms and one bathroom, north-south ventilation, good air circulation, good orientation. Good floor, wide view, plenty of light.
[0082] [Advantages and Features] The dining room and living room can be separated, and the space layout is flexible. Surrounded by mature communities, convenient living, and complete supporting facilities.
[0083] [Recommendation reason] The house is the only one that has been owned for five years, and the tax is favorable. It is only sold for 680,000 yuan, which is cost-effective. The owner is sincere in selling it, and welcomes your appreciation.
[0084] In this step, the property attribute parameters, text generation requirements and description examples are input into the first language model as input data. The first language model accurately captures the user's intention based on the text generation requirements and description examples, and generates a property description text that is both compliant with the specifications and unique, thereby improving the flexibility and efficiency of text generation.
[0085] Step S103: Using the property description text as the label corresponding to the property attribute parameter, constructing a training sample based on the property attribute parameter and the corresponding label, and training the pre-constructed second language model according to the training sample to obtain a property description text generation model. The second language model may be the same as the first language model or may be different from the first language model, and the present invention does not limit this.
[0086] In this step, training samples can be constructed according to a preset structured format. As an optional example, each training sample may include three key fields, namely: task requirements, input data, and output data. The task requirement field is used to clearly indicate the task requirements. For example, the task requirement may generate a concise and word-limited house description text according to given house attribute parameters. Optionally, the task requirements may also include constraints, which control the style, format, and logic of the house description text generated by the model through the constraints, and may also constrain the maximum length of the generated text to avoid the model outputting too long or too short results. The input data field is used to list the house attribute parameters, such as price, purchase year, area, floor, apartment type, and orientation. The output data field is the house description text output by the first language model, which serves as the target label of the second language model. The house description text output by the first language model is the style, format, and logic expected by the user. The house description text is used as a label to construct a training sample, so that the house description text output by the second language model is also the style, format, and logic expected by the user.
[0087] A training sample set is constructed based on the property attribute parameters of each property and the property description text corresponding to the property attribute parameters of each property, and the second largest language model is trained using the training sample set to obtain the property description text.
[0088] The text generation model training method provided by the embodiment of the present invention inputs the property parameters of each house, the text generation requirements corresponding to each house, and at least one description example as input data into a first language model, obtains the property description text corresponding to the property parameters of each house, constructs a training sample based on the property parameters of each house and the corresponding property description text, wherein the property description text is used as the label of the training sample, and uses the training sample to train a pre-constructed second language model, and uses the trained second language model as a property description text generation model. The method automatically generates a property description text corresponding to each property through a first language model, text generation requirements and description examples, uses the property description text as a label of a training sample, avoids manual construction and annotation of samples, and reduces data collection costs and data annotation costs; controls the first language model to generate user-expected output based on the property attribute parameters of the property through text generation requirements and description examples, that is, controls the style, format and logic of the text generated by the first language model based on the property attribute parameters of the property in combination with the text generation requirements and description examples, uses the property description text as a label, uses the label and the property attribute parameters to construct a training sample to train the second language model, so that the second language model learns the mapping relationship between the property attribute parameters and the property description text in the training sample, so that the second language model can learn the training data in the real estate marketing scenario, obtain a property description text generation model, and then uses the property description text generation model to generate description text in the real estate marketing scenario, which is helpful to improve the quality of the generated text and reduce the homogeneity of the generated text.
[0089] In the embodiment of the present application, since the first language model is a general language model, the house description text generated by it may contain errors. The effect of the house description text generation model directly trained by using these house description texts is unstable, and the quality of the generated house description text is unstable (such as content errors or format errors). In order to improve the ability of the house description text generation model, after the first language model generates the house description text, the generated house description text is corrected (such as manual correction or correction using rules) to obtain a correct and high-quality house description text, and then it is used as a label of the training sample to train the second language model. Therefore, in an optional embodiment, the training method of the text generation model, after obtaining the house description text using the first language model, corrects the content and / or format of the obtained house description text to obtain the corrected house description text; the corrected house description text is used as the label corresponding to the house attribute parameter, and the training sample is constructed based on the corrected house description text.
[0090] The parameter scale of the property description text generation model obtained by training the second largest language model in the embodiment of the present invention is relatively large, and more resources are required when applied, and the application cost increases accordingly. In order to reduce resource requirements and costs, when training the second largest 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 property description text generation model.
[0091] In an optional embodiment, step S103 trains the pre-built second language model according to the training samples to obtain a housing description text generation model, including:
[0092] Use the pre-built second language model as the teacher model;
[0093] 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, and the teacher model is used as a housing description text generation model.
[0094] Among them, the teacher model is distilled according to the preset distillation method, which uses the knowledge distillation technology (KD) to transfer the knowledge of a large and complex model (teacher model) to a smaller and simpler model (called the student model). Optionally, the LORA (Low-Rank Adaptation) fine-tuning method can be used in the process of training the second largest language model. While keeping most of the parameters of the second largest language model unchanged, rapid adaptation to specific tasks can be achieved through a small amount of parameter adjustment. At the same time, the cross entropy loss function is introduced as the optimization goal to ensure that the error between the model output and the true label is minimized, thereby improving the accuracy and relevance of the generated copy.
[0095] The embodiment of the present invention obtains a smaller and simpler housing description text generation model by distilling the second largest language model, which not only reduces the computing and storage requirements of the model, but also makes the model easier to deploy, which is particularly suitable for resource-constrained environments.
[0096] Figure 2 FIG. 1 is a flow chart of a text generation method provided by an embodiment of the present invention. Figure 2 As shown, the text generation method includes:
[0097] Step S201: Displaying a property description text generation page. The property description text generation page is used to receive user instructions and generate property description text according to the user instructions. The property description text generation page includes a property basic information input control and a text generation control. The property basic information input control is used to receive the property basic information input by the user and obtain property attribute parameters according to the property basic information. The text generation control is used to call a property description text generation model to generate property description text. The property description text generation model is obtained according to the text generation model training method provided in an embodiment of the present invention.
[0098] Step S202: in response to the operation on the house basic information input control, obtain the house attribute parameters of the house to be described.
[0099] Step S203: In response to the 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 the property description text of the property to be described.
[0100] Step S204: displaying the property description text of the property to be described.
[0101] The text generation method provided by the embodiment of the present invention receives the basic information of a house input by the user through the basic information receiving control of the house, thereby obtaining the property parameters of the house, and in response to detecting the operation of the text generation control, calls the house description text generation model, uses the house description text generation model to process the property parameters of the house, generates a house description text in a specified format, and displays the house description text, so that the user can quickly and comprehensively understand the house.
[0102] In an optional embodiment, in order to ensure the compliance of the generated property description text, it can be subjected to a compliance check before display. If the property description text of the property to be described passes the compliance check, the property description text is directly displayed. If the compliance check fails, the illegal words in the property description text are replaced, and the replaced property description text is displayed. In an optional embodiment, a violation word library and / or verification rules can be pre-set, and the property description text is subjected to a compliance check based on the violation word library. As an optional example, the violation word library includes but is not limited to words that do not comply with relevant laws and regulations. The verification rules may include but are not limited to business restriction rules (such as prohibiting commitments, prohibiting the appearance of plain text contact information) and city restriction rules (such as prohibiting regional xx prices in xx community).
[0103] The embodiment of the present invention can avoid the risks caused by violations of the content and reduce the complaint rate by performing compliance verification on the house description text.
[0104] Figure 3FIG. 2 is a flow chart of a text generation method provided by another embodiment of the present invention. Figure 3 As shown, the method includes:
[0105] Step S301: Displaying a page for generating a description text of a house, which includes a control for inputting basic information of a house, a control for generating a text, and a control for describing an angle. The control for describing an angle is used to select different description angles. Different description angles generate different property parameters for generating a description text of a house, and different description angles are used to control the property parameters for generating a description text of a house. As optional examples, description angles include but are not limited to the following angles: price and tax, house structure, quality of a house, advantages of a community, and property ownership, etc.
[0106] Step S302: in response to the operation on the basic information input control of the house, the property attribute parameters of the house to be described are obtained.
[0107] Step S303: In response to a selection instruction for a description angle control, determining at least one selected description angle.
[0108] Step S304: Filter out selected property parameters corresponding to the selected description angle from the property attribute parameters of the property to be described.
[0109] Step S305: In response to the operation of the text generation control, the selected property attribute parameters are input as input data into the property description text generation model to obtain the property description text of the property to be described. The property description text generation model is obtained according to the training method of the text generation model of any embodiment of the present invention.
[0110] Step S306: Display the property description text of the property to be described.
[0111] The text generation method provided by the embodiment of the present invention controls the property attribute parameters used to generate the property description text through the description angle control, and can screen the property attribute parameters from different angles to control the style of the generated property description text, prevent the homogenization of the property description text content, and improve the quality of the generated property description text content.
[0112] In an optional embodiment, the property description text generation page further includes a note control. The note control is used to receive user note information, such as property features customized by the user. The text generation method further includes: in response to an operation on the note control, receiving user input note information, splicing the note information with the generated property description text, and displaying the result.
[0113] Figure 4 A structural schematic diagram of a text generation model training device provided by an embodiment of the present invention is shown.
[0114] like Figure 4 As shown, the text generation model training device 400 includes:
[0115] The acquisition module 401 is used to acquire property attribute parameters of multiple properties;
[0116] The data enhancement module 402 is used to obtain, for each house, a text generation requirement and at least one description example corresponding to the house, and input the house attribute parameters of the house, the text generation requirement and at least one description example corresponding to the house as input data into a first language model to obtain a house description text corresponding to the house attribute parameters;
[0117] The training module 403 is used to use the property description text as the label corresponding to the property attribute parameters, construct training samples based on the property attribute parameters and the corresponding labels, and train the pre-constructed second language model according to the training samples to obtain a property description text generation model.
[0118] In an optional embodiment, the data enhancement module is further used to: perform content correction and / or format correction on the property description text to obtain a corrected property description text; use the corrected property description text as a label corresponding to the property attribute parameters, and construct training samples based on the property attribute parameters and the corresponding labels.
[0119] In an optional embodiment, the training module is also used to: use the pre-constructed second largest language model as a teacher model; train the teacher model according to the training samples, and distill 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 property description text generation model.
[0120] Figure 5 FIG. 1 is a schematic diagram showing the structure of a text generation device provided by an embodiment of the present invention. Figure 5 As shown, the text generation device 500 includes:
[0121] Display module 501, used to display a property description text generation page, the property description text generation page includes a property basic information input control and a text generation control;
[0122] A receiving module 502 is used to obtain property attribute parameters of the property to be described in response to an operation on the property basic information input control;
[0123] A generating module 503 is used for, in response to the operation of the text generating control, inputting the property attribute parameters of the property to be described as input data into a property description text generating model to obtain the property description text of the property to be described; wherein the property description text generating model is obtained according to the text generating model training method provided by any embodiment of the present invention;
[0124] The display module 504 is used to display the house description text of the house to be described.
[0125] In an optional embodiment, the display module is further used to: perform compliance verification on the property description text of the property to be described; if the property description text of the property to be described passes the compliance verification, display the property description text of the property to be described; if the property description text of the property to be described fails to pass the compliance verification, replace illegal words in the property description text of the property to be described, and display the replaced property description text.
[0126] In an optional embodiment, the property description text generation page further includes a plurality of description angle controls;
[0127] The generation module is also used to: determine at least one selected description angle in response to a selection instruction for the description angle control; filter out selected property parameters corresponding to the selected description angle from the property attribute parameters of the property to be described; input the selected property attribute parameters as input data into a property description text generation model to obtain the property description text of the property to be described.
[0128] The above device can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0129] Figure 6 FIG. 1 is a schematic diagram showing the structure of an electronic device according to an embodiment of the present invention. Figure 6 As shown, the electronic device includes:
[0130] Processor 601, communication interface 602, memory 603 and communication bus 604, wherein processor 601, communication interface 602, memory 603 communicate with each other via communication bus 604.
[0131] Memory 603, used for storing computer programs;
[0132] The processor 601 is used to execute the program stored in the memory 603 to implement the following steps:
[0133] Get the property attribute parameters of multiple properties;
[0134] For each house listing, obtaining text generation requirements and at least one description example corresponding to the house listing, inputting the house listing attribute parameters, the text generation requirements and at least one description example corresponding to the house listing as input data into a first language model, and obtaining a house listing description text corresponding to the house listing attribute parameters;
[0135] The property description text is used as the label corresponding to the property attribute parameters, and training samples are constructed based on the property attribute parameters and the corresponding labels. The pre-constructed second largest language model is trained according to the training samples to obtain a property description text generation model.
[0136] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one 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) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0139] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can 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, a computer-readable storage medium is also provided, which stores instructions. When the computer-readable storage medium is run on a computer, the computer executes the text generation model training method or text generation method described in any of the above embodiments.
[0141] In another embodiment provided by the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the text generation model training method or 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 by 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 process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0143] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0144] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and 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 the relevant parts can be referred to the partial description of the method embodiment.
[0145] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A text generation model training method, characterized in that: include: Get the property attribute parameters of multiple properties; For each house listing, obtaining text generation requirements and at least one description example corresponding to the house listing, inputting the house listing attribute parameters, the text generation requirements and at least one description example corresponding to the house listing as input data into a first language model, and obtaining a house listing description text corresponding to the house listing attribute parameters; The property description text is used as the label corresponding to the property attribute parameters, and training samples are constructed based on the property attribute parameters and the corresponding labels. The pre-constructed second largest language model is trained according to the training samples to obtain a property description text generation model.
2. The method according to claim 1, characterized in that The step of using the property description text as a label corresponding to the property attribute parameter and constructing a training sample based on the property attribute parameter and the corresponding label includes: Correcting the content and / or format of the property description text to obtain a corrected property description text; The corrected property description text is used as a label corresponding to the property attribute parameter, and a training sample is constructed based on the property attribute parameter and the corresponding label.
3. The method according to claim 1 or 2, characterized in that: The pre-built second language model is trained according to the training samples to obtain a house description text generation model, including: Use the pre-built second language model as the teacher model; 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, and the teacher model is used as a housing description text generation model.
4. A text generation method, characterized in that: include: Displaying a property description text generation page, wherein the property description text generation page includes a property basic information input control and a text generation control; In response to an operation on the house basic information input control, obtaining a house attribute parameter of the house to be described; In response to the operation of 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 method according to any one of claims 1 to 3; Display the property description text of the property to be described.
5. The method according to claim 4, characterized in that The display of the house description text of the house to be described includes: Performing compliance check on the property description text of the property to be described; 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; In the case that the property description text of the property to be described fails to pass 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.
6. The method according to claim 4 or 5, characterized in that: The property description text generation page also includes multiple description angle controls; In response to the 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 the property description text of the property to be described, including: In response to a selection instruction of the description angle control, determining at least one selected description angle; Filtering out selected property parameters corresponding to the selected description angle from property attribute parameters of the property to be described; The selected property attribute parameters are input as input data into a property description text generation model to obtain a property description text of the property to be described.
7. A text generation model training device, characterized in that: include: The acquisition module is used to obtain the property attribute parameters of multiple properties; a data enhancement module, for obtaining, for each house listing, text generation requirements and at least one description example corresponding to the house listing, inputting the house listing attribute parameters, the text generation requirements and at least one description example corresponding to the house listing as input data into a first language model, and obtaining a house listing description text corresponding to the house listing attribute parameters; The training module is used to use the property description text as the label corresponding to the property attribute parameters, construct training samples based on the property attribute parameters and the corresponding labels, and train the pre-constructed second largest language model according to the training samples to obtain a property description text generation model.
8. A text generation device, characterized in that: include: A display module, used to display a page for generating a text description of a house, wherein the page includes a control for inputting basic information of the house and a control for generating a text; A receiving module, configured to obtain property attribute parameters of the property to be described in response to an operation on the property basic information input control; A generation module, configured to, in response to an operation on the text generation control, input the property attribute parameters of the property to be described 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 method according to any one of claims 1 to 3; The display module is used to display the property description text of the property to be described.
9. An electronic device, characterized in that: It includes 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; Memory, used to store computer programs; A processor, configured to implement the method according to any one of claims 1 to 6 when executing a program stored in a memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
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
House listing information display method and apparatus, and electronic device and readable storage medium
WO2023185547A1
Downstream task model generation method, task execution method, and device
WO2024099144A1