A method, system and medium for constructing a portrait system based on a large language model
By introducing a large language model to the portrait system, the problem of insufficient comprehensive text data processing and high resource consumption in the existing technology is solved, and a more accurate and efficient user portrait construction is achieved.
Patent Information
- Application Number
- CN202411263178.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-09-10
AI Technical Summary
When processing original text data, the existing portrait system has a low degree of direct utilization, which ignores the correlation between texts, resulting in the generated portrait expression being incomplete. At the same time, large-scale data input leads to increased resource consumption and improved training complexity, which affects the training efficiency of AI models.
The portrait system construction method based on the large language model is adopted, and the original text data is classified, filtered, sliced and merged, and the large language model is used for in-depth processing, multi-level portrait labels are generated, and user portraits are generated through iterative clustering and structured processing.
Effectively capture complex patterns and deep-level features in text data, improve the accuracy and comprehensiveness of the portrait system, reduce resource consumption, and improve the training efficiency of AI models.
Smart Images

Figure CN119204183B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and system for constructing a portrait system based on a large language model, and a medium. Background Art
[0002] Existing portrait systems usually rely on knowledge graph technology, which organizes and manages portrait data through structured representation. In this data organization process, the original text data must first be converted into structured data through a variety of preprocessing methods, including text segmentation, entity recognition, relationship extraction, etc. These preprocessing methods are used to ensure the readability and operability of the data. Then, labels are generated based on the structured data to achieve feature description and classification of individuals or entities. In this data processing process, the direct use of the original text data is low, and the correlation between the original text data is often ignored, resulting in the generated portrait system being not comprehensive enough.
[0003] With the advent of the data-driven AI era, huge amounts of data and diverse data sources have provided rich resources for AI model training. However, if such a large amount of data is directly used as AI model input, resource consumption will increase significantly, the complexity of training operations will increase significantly, and the demand for computing resources will surge, affecting the training efficiency of the AI model.
[0004] Based on the above technical problems, the applicant proposed the technical solution of this application. Summary of the invention
[0005] In view of the above-mentioned defects of the prior art, the present invention provides a method, system and medium for constructing a portrait system based on a large language model, which deeply processes text data through a large language model to capture complex patterns and deep-level features in the text, providing strong support for the accurate depiction of the portrait system.
[0006] In order to achieve the above object, the present invention discloses a method for constructing a portrait system based on a large language model, comprising the following steps:
[0007] Acquire original text data, and classify and process the original text data;
[0008] Screening the original text data after classification processing to obtain initial text data related to the target portrait entity;
[0009] Slicing the initial text data to obtain a plurality of sliced text segments, calculating similarity values between adjacent sliced text segments, and merging the plurality of sliced text segments according to the similarity values to obtain a plurality of first text segments;
[0010] Summarizing each of the first text segments based on the large language model to generate a primary portrait label corresponding to each of the first text segments;
[0011] Clustering each of the primary portrait labels based on a large language model to generate multiple secondary portrait labels;
[0012] Performing a relevance check on each of the secondary portrait tags based on the large language model, and iteratively clustering multiple strongly correlated secondary portrait tags until the correlations between the generated cluster tags are all less than a first threshold or the large language model determines that the generated cluster tags cannot be clustered again;
[0013] The primary portrait label, the secondary portrait label and the clustering label are structured, and a user portrait of the target portrait entity is generated using a knowledge graph.
[0014] Preferably, the method further comprises:
[0015] Fine-tuning training is performed on the large language model, and the fine-tuning data set used for the fine-tuning training includes a first data set, a second data set, and a third data set set according to a preset ratio, the first data set is used to train the large language model to summarize the core ideas of any text fragment, the second data set is used to train the large language model to recognize the connection between any text fragment and a specific subject, and the third data set is used to train the versatility of the large language model.
[0016] Preferably, the data volumes of the first data set, the second data set and the third data set are similar. Preferably, the preset ratio between the first data set, the second data set and the third data set is 3:3:4.
[0017] Preferably, summarizing the opinions of each of the first text segments based on the large language model to generate a primary portrait label corresponding to each of the first text segments includes the following steps:
[0018] Constructing a first prompt word, wherein the first prompt word instructs the large language model to summarize the first text segment related to the target portrait entity, and specifies a first recommended tag according to the summarized content;
[0019] The target portrait entity, the first prompt word and the first text segment are input into a large language model to obtain a first recommended label corresponding to the first text segment, and the recommended label output by the large language model is used as the primary portrait label.
[0020] Preferably, clustering each of the primary portrait labels based on the large language model to generate multiple secondary portrait labels includes the following steps:
[0021] Constructing a second prompt word, wherein the second prompt word instructs the large language model to cluster the merged content consisting of the primary portrait label and the first text segment and then assign a second recommended label;
[0022] The target portrait entity, the second prompt word, the primary portrait label and the first text segment are input into a large language model to obtain a second recommended label corresponding to the first text segment, and the recommended label output by the large language model is used as the secondary portrait label.
[0023] Preferably, the relevance check is performed on each of the secondary portrait tags based on the large language model, and multiple strongly correlated secondary portrait tags are iteratively clustered until the correlations between the generated clustering tags are all less than a first threshold or the large language model considers that the generated clustering tags cannot be clustered again, including the following steps:
[0024] Constructing a third prompt word, wherein the third prompt word instructs the large language model to perform a relevance check on the secondary portrait tags and iteratively cluster the strongly correlated secondary portrait tags;
[0025] The target portrait entity, the third prompt word and the secondary portrait label are input into the large language model. If the correlations between the cluster labels output by the large language model are all less than a first threshold, the iterative clustering is stopped. If the correlations between the cluster labels output by the large language model are greater than the first threshold or the large language model believes that the generated cluster labels can be clustered again, the iterative clustering is continued.
[0026] Preferably, the screening of the original text data after classification processing to obtain the initial text data related to the target portrait entity includes the following steps:
[0027] After the original text data is subjected to word embedding conversion, it is input into a pre-trained BERT model to obtain a correlation value between the original text data and the target portrait entity;
[0028] Target text data whose correlation value is higher than a preset value is screened out from the original text data, and the target text data is used as initial text data related to the target portrait entity.
[0029] Preferably, the BERT model is pre-trained using a large amount of unlabeled text data, and the pre-trained BERT model is used to capture contextual information in the text data.
[0030] The present invention also discloses a portrait system construction system based on a large language model, comprising the following modules:
[0031] A classification module, used to obtain original text data and perform classification processing on the original text data;
[0032] A screening module is used to screen the original text data after classification processing to obtain initial text data related to the target portrait entity;
[0033] A slicing module, used for slicing the initial text data to obtain a plurality of sliced text segments, calculating similarity values between adjacent sliced text segments, and merging the plurality of sliced text segments according to the similarity values to obtain a plurality of first text segments;
[0034] A primary portrait module, used for summarizing each of the first text segments based on a large language model to generate a primary portrait label corresponding to each of the first text segments;
[0035] A secondary portrait module, used for clustering each of the primary portrait labels based on a large language model to generate multiple secondary portrait labels;
[0036] An iterative clustering module, used for checking the relevance of each of the secondary portrait labels based on the large language model, and iteratively clustering multiple strongly correlated secondary portrait labels until the correlations between the generated cluster labels are all less than a first threshold or the large language model considers that the generated cluster labels cannot be clustered again;
[0037] A portrait generation module is used to perform structured processing on the primary portrait label, the secondary portrait label and the clustering label, and use the knowledge graph to generate a user portrait of the target portrait entity.
[0038] Preferably, the portrait system construction system based on the large language model further includes:
[0039] A fine-tuning training module is used to perform fine-tuning training on the large language model. The fine-tuning data set used for the fine-tuning training includes a first data set, a second data set and a third data set set according to a preset ratio. The first data set is used to train the large language model to summarize the core ideas of any text fragment, the second data set is used to train the large language model to identify the connection between any text fragment and a specific subject, and the third data set is used to train the versatility of the large language model.
[0040] Preferably, the primary portrait module includes:
[0041] An induction module, configured to construct a first prompt word, wherein the first prompt word instructs the large language model to summarize the first text segment related to the target portrait entity, and specifies a first recommended tag according to the summarized content;
[0042] The primary portrait generation module is used to input the target portrait entity, the first prompt word and the first text fragment into a large language model, obtain a first recommended label corresponding to the first text fragment, and use the recommended label output by the large language model as the primary portrait label.
[0043] Preferably, the secondary portrait module includes:
[0044] A clustering module, used for constructing a second prompt word, wherein the second prompt word instructs the large language model to assign a second recommended tag after clustering the combined content consisting of the primary portrait tag and the first text segment;
[0045] A secondary portrait generation module is used to input the target portrait entity, the second prompt word, the primary portrait label and the first text fragment into a large language model to obtain a second recommended label corresponding to the first text fragment, and use the recommended label output by the large language model as the secondary portrait label.
[0046] Preferably, the iterative clustering module comprises:
[0047] A checking module, used for constructing a third prompt word, wherein the third prompt word instructs the large language model to perform a relevance check on the secondary portrait tags and iteratively cluster the strongly correlated secondary portrait tags;
[0048] The iterative module is used to input the target portrait entity, the third prompt word and the secondary portrait label into the large language model. If the correlations between the cluster labels output by the large language model are all less than a first threshold, the iterative clustering is stopped; if the correlations between the cluster labels output by the large language model are greater than the first threshold or the large language model believes that the generated cluster labels can be clustered again, the iterative clustering is continued.
[0049] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for constructing a portrait system based on a large language model are implemented.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] 1. After acquiring multi-source data, the present invention performs efficient screening and classification to obtain initial text data related to the target portrait entity, which not only optimizes the data processing flow, but also ensures efficient use of data, maintains data integrity and overall coverage, and reduces resource consumption rate of subsequent data processing.
[0052] 2. When constructing the portrait system, the present invention uses a large language model to perform in-depth processing on the screened and classified text data, effectively capturing the complex patterns and deep-level features in the text data, providing data support for the accurate depiction of the portrait system, and effectively making up for the limitations of traditional portrait methods in text data processing capabilities.
[0053] 3. The present invention generates multi-level recommendation tags and performs iterative clustering of tags. It adopts the mode of text slicing, summarizing, tag generation, clustering, re-summarizing, re-tag generation, and re-clustering to generate multi-level portrait tags, avoid the loss of contextual relationships when processing long texts, reduce information omissions, ensure the comprehensiveness and contextual consistency of portrait data, effectively avoid information redundancy and loss, and thus construct an accurate and comprehensive user portrait.
[0054] The concept, specific structure and technical effects of the present invention will be further described below in conjunction with the accompanying drawings to fully understand the purpose, characteristics and effects of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flow chart of the method for constructing a portrait system based on a large language model of the present invention.
[0056] Figure 2 A schematic diagram of a user portrait generated by the portrait system construction method based on a large language model of the present invention.
[0057] Figure 3 It is a schematic diagram of the framework of the portrait system construction system based on the large language model of the present invention. DETAILED DESCRIPTION
[0058] In order to make the technical means, creative features, objectives and effects of the invention easier to understand, the invention is further described below with reference to specific diagrams. However, the invention is not limited to the following implementation cases.
[0059] It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with this technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantive technical significance. Any structural modification, change in proportion or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical contents disclosed by the present invention.
[0060] "Large Language Model" refers to a large-scale language model (LLM), which is a language model with a large parameter scale. It is designed to be trained with a large amount of text data to achieve the purpose of understanding and generating human language. It can perform a wide range of tasks including text summarization, translation, sentiment analysis, etc. When using LLM to complete certain specific tasks, prompt words are needed to guide LLM to complete the tasks expected by the user. However, when processing long texts, large language models face the dual challenges of resource consumption and reduced context understanding ability. On the one hand, the huge computing resource requirements may limit the practicality and efficiency of large language models. On the other hand, long texts have high information density and complex context correlation. Large models may experience disconnection or misunderstanding when understanding and processing, affecting the final text output quality.
[0061] The first embodiment of the present application discloses a method for constructing a portrait system based on a large language model. The large language model is applied to the construction of the portrait system, and the large language model is used to perform in-depth processing on text data, which can effectively make up for the limitations of traditional portrait methods in text data processing capabilities.
[0062] like Figure 1 As shown in the figure, the method for constructing a portrait system based on a large language model includes the following steps:
[0063] Step S1: Acquire original text data, and classify the original text data.
[0064] The data sources of raw text data include various data collection channels, such as public databases, social media, internal corporate documents, academic journals, etc. The data formats of raw text data include txt, doc, docx, pdf, json, etc.
[0065] After obtaining the original text data, it is necessary to classify the original text data obtained from these multi-source channels. The classification processing in this embodiment includes two processing methods, one is a method defined by rules, and the other is a method matched by keywords. The method defined by rules is specifically to first preset a classification rule to classify the original text data, for example, to classify according to the data field and the data subject. The data field represents the professional scope of the original text data, and the data subject represents the key objects involved in the original text data. The method matched by keywords is to use regular expressions or natural language processing technology to identify keywords in the text title, and classify the original text data using the identified keywords as matching objects. For example, when the original text data including artificial intelligence in the text title is automatically classified, the regular expression used is: (?i)\b(Artificial Intelligence|Artificial Intelligence)\b, and the keyword identified by the regular expression natural language processing technology is artificial intelligence.
[0066] Step S2: Screen the original text data after classification to obtain initial text data related to the target portrait entity.
[0067] Specifically, after the original text data is classified in step S1, the classification model is used to screen the classified original text data. The classification model used in this embodiment can be a deep learning classification model such as Bert, XLNet, ENRIE, Transformer-XL, T5, GPT, MoE, etc.
[0068] In this embodiment, the screening process using the Bert model is described as an example. First, the Bert model is pre-trained and trained using large-scale unlabeled text data, so that the trained Bert model has the ability to capture contextual information in the text.
[0069] The training method of the Bert model is:
[0070] BERT (Bidirectional Encoder Representations from Transformers) is a method for pre-training language representations that processes language data using a transformer architecture. BERT training mainly consists of two steps:
[0071] (1) Pre-training stage:
[0072] Masked Language Model (MLM): Randomly mask some words (e.g., 15%) in the input sentence and then predict these masked words. This helps the model learn contextual information.
[0073] Next Sentence Prediction(NSP): Given two sentences, the model needs to predict whether the second sentence is the context of the first sentence. This helps the model understand the relationship between sentences.
[0074] (2) Fine-tuning stage:
[0075] Fine-tune the BERT model on a specific task of text classification. Continue training BERT using a text classification dataset so that the model can be adapted to a specific task.
[0076] After the Bert model is pre-trained, the original text data after classification obtained in step S1 is input into the Bert model after word embedding conversion. The Bert model outputs a score representing the importance or relevance of each text data.
[0077] Among them, word embedding conversion is a method of converting text data into numerical vectors, so that semantically similar words are also similar in vector space. The word embedding conversion method of the present invention is the Word2Vec model. Word2Vec is a popular word embedding technology that can generate vector representations of words. These vectors can capture the semantic relationship between words. Word2Vec mainly has two models: CBOW (Continuous Bag of Words) and Skip-Gram.
[0078] Data example: For example, after training with the Word2Vec model, we can get the word vectors of two words with similar meanings. Suppose we have two English words "listen" and "hear", their word vectors may be as follows:
[0079] The word vector of "listen": [0.267, 0.595, -0.239, ...]
[0080] Word vector for "hear": [0.275, 0.584, -0.224, ...]
[0081] By calculating the cosine value of two word vectors, we can get the relevance score.
[0082] According to the relevance score output by the Bert model, the initial text data that is strongly related to the target portrait entity is retained, and the initial text data that is weakly related or irrelevant to the target portrait entity is screened out. In the specific implementation, a preset score can be set, and the initial text data with a relevance score greater than the preset score is determined to be strongly related to the target portrait entity, and the initial text data with a relevance score less than or equal to the preset score is determined to be weakly related or irrelevant to the target portrait entity. After the Bert model performs relevance screening, the initial text data is obtained, and the initial text data is all related to the target portrait entity.
[0083] Step S3: Slice the initial text data to obtain a plurality of sliced text segments, calculate similarity values between adjacent sliced text segments, and merge the plurality of sliced text segments according to the similarity values to obtain a plurality of first text segments.
[0084] Specifically, the initial text data is sliced, and the slicing rule is to slice according to the natural segmentation of the text or the preset number of characters. The natural segmentation of the text includes paragraphs, titles, and subtitles, and the preset number of characters is set between 250 and 300 characters.
[0085] After slicing, several slice text segments are obtained, and then similarity calculation is performed on these slice text segments, and the slice text segments with high similarity are merged. After the merging process, it can be ensured that the generated first text segment is semantically continuous and logical.
[0086] The text similarity algorithm used in this embodiment calculates the similarity values between each adjacent slice text segment, and the text similarity algorithm includes cosine similarity, Jaccard similarity, etc. Taking cosine similarity as an example, the similarity values of adjacent slice text segments are calculated in the following manner.
[0087] Suppose there are two text vectors A and B, which are represented in n-dimensional space as (a1, a2, ..., an) and (b1, b2, ..., bn) respectively.
[0088] The calculation formula for cosine similarity is:
[0089] Cos(A,B)=(A·B) / ‖A‖‖B‖
[0090] Step S4: Summarize each of the first text segments based on the large language model to generate a primary portrait label corresponding to each of the first text segments.
[0091] In this embodiment, a first prompt word is first constructed, and the first prompt word instructs the large language model to summarize the first text segment related to the target portrait entity, and specifies a first recommended tag according to the summarized content. Then, the target portrait entity, the first prompt word and the first text segment are input into the large language model to obtain a first recommended tag corresponding to the first text segment, and the recommended tag output by the large language model is used as the primary portrait tag.
[0092] The large language model of this embodiment uses a pre-trained open source large model or a large model that is fine-tuned based on an open source large model. In order to retain the generalization ability of the large model while enhancing its ability to handle professional problems in a specific field, the large model is fine-tuned to optimize its performance on a specific task. The fine-tuning training includes adjusting the model parameters so that it can learn and represent more accurately on a specific data set. During the fine-tuning training process, a fine-tuning data set is constructed for a specific field.
[0093] When fine-tuning the large language model, the strategy for constructing the fine-tuning dataset is to set the first dataset, the second dataset and the third dataset in a preset proportion. The first dataset is used to train the large language model to summarize the core ideas of any text fragment, the second dataset is used to train the large language model to identify the connection between any text fragment and a specific subject, and the third dataset is used to train the versatility of the large language model.
[0094] When constructing a fine-tuning data set, it is necessary to balance different types of training data to ensure that the large model is both universal and can adapt to field-specific needs, so the three data sets need to be set according to a preset ratio. In this embodiment, the preset ratio can be flexibly adjusted according to actual needs. When adjusting the ratio of the three data sets, it is necessary to ensure the training intensity of the large language model for various data sets, so that the large language model can integrate opinion question and answer pairs, label question and answer pairs, and general question and answer pairs. In the actual training process, if the number of general question and answer pairs is small, it is easy for the large language model to forget the basic general functions, but if the number of general question and answer pairs is large, it is easy for the large language model to lose the training effect of specific tasks. Therefore, when performing fine-tuning training, it is necessary to ensure that the fine-tuning data set includes the first data set as the opinion question and answer pair, the second data set as the label question and answer pair, and the third data set as the general question and answer pair. In addition, the data volume of the first data set and the second data set is the same or similar, and the data volume of the third data set is higher than the data volume of the first data set and the data volume of the second data set.
[0095] In this embodiment, the preset ratio is 3:3:4 as an example. When summarizing opinions, the first data set is a question-and-answer pair that summarizes opinions on professional issues, which is used to train the model to accurately summarize the core opinions of the text fragment. For example, "Given an abstract of a paper on climate change, the model should be able to summarize its main opinions." The second data set is a question-and-answer pair for professional question labels, which is used to train the model to identify and associate the connection between the text and a specific topic or concept, that is, to generate relevant labels for the text fragment. For example, "Given a paper on artificial intelligence, the model should be able to recognize labels such as 'machine learning' and 'deep learning'." The third data set is a general question-and-answer pair. As a balance, this part of the data helps to maintain the versatility of the model and avoid its over-specialization. For example, a general question like "Explain what is artificial intelligence?"
[0096] After fine-tuning the large language model, the first prompt word is constructed. The first prompt word includes three steps. The large model first determines whether the content of the text segment is related to the target portrait entity. If so, the text segment is summarized and then a recommended tag is given based on the summarized content.
[0097] For example, the first prompt word is constructed as follows:
[0098] Step 1: Determine the relevance of text content and image entities
[0099] Prompt:
[0100] Please analyze the relevance of the following text fragment to the specified entity. If the text is relevant to the entity, please give a description of the relevance in the summary. If not, please simply answer "not relevant".
[0101] Entity: [Entity Description]
[0102] Text snippet: [specific text]
[0103] Example:
[0104] Entity: The Statue of Liberty in New York City
[0105] Text excerpt: Although located in San Francisco, the spectacular view of the Golden Gate Bridge is also worth seeing.
[0106] Correlation analysis: No correlation
[0107] Step 2: Summarize the relevant text
[0108] Prompt:
[0109] Please summarize the analyzed content related to the specified entity and summarize its key information and characteristics.
[0110] Entity: [Entity Description]
[0111] Text snippet: [specific text]
[0112] Example:
[0113] Entity: The Statue of Liberty in New York City
[0114] Text excerpt: The Statue of Liberty, whose full name is "Liberty Enlightening the World", is located on Liberty Island in the harbor of New York City, USA. It is one of the symbols of New York City and a famous landmark in the United States and even the world. This bronze statue was given to the United States by France in 1876 to celebrate the 100th anniversary of the founding of the two countries. It symbolizes the friendship and cooperation between the two countries. The Statue of Liberty is not only an important milestone in American history, but also a treasure in the world's cultural treasure house. The main body of the Statue of Liberty is 46 meters high (excluding the base), and the total height with the base reaches 93 meters. This sculpture is not only a visual spectacle, but also a product of the fusion of human history and culture. The designer is French sculptor Frederic Auguste Bartholdi, and the engineering construction was completed by French engineer Edgar Aix. The sculpture of the Statue of Liberty is extremely rich in details. In her right hand, she holds a torch symbolizing freedom, symbolizing the message that the United States hopes to bring freedom to the world. In her left hand, she holds an open book with the words "July 4, 1776" engraved on it, which is the date when the United States declared independence. The crown on the goddess's head is surrounded by 7 long bands symbolizing the seven continents and oceans where the Statue of Liberty is located. The interior of the bronze statue is a complex structure, including steel frames that provide support for the sculpture and passages that allow maintenance personnel to enter the sculpture for maintenance and restoration. There is a museum inside the base of the statue, which displays exhibitions about the history, design and construction process of the Statue of Liberty. The Statue of Liberty is not only a tourist attraction, but also a witness to many historical events in the United States, such as the symbol of the reconstruction of the New York Port after the New York Fire in 1834. In addition, the Statue of Liberty is the starting point for many important immigrations in history. Thousands of immigrants entered the United States through the port where it is located to start a new life.
[0115] Summary: The Statue of Liberty is located in New York Harbor. It is a symbolic building of the United States. It was given to the United States by France to celebrate the 100th anniversary of its founding. It is a bronze statue with a height of 46 meters. The total height including the base is 93 meters. It is one of the tallest bronze statues in the world.
[0116] Step 3: Give recommended tags based on the summary content
[0117] Prompt:
[0118] Based on the summary of the text fragment, one or more recommended tags are given that best represent the main content and entity characteristics of the text.
[0119] Entity: [Entity Description]
[0120] Text snippet: [specific text]
[0121] Summary: [Summary generated in step 2]
[0122] Example:
[0123] Entity: The Statue of Liberty in New York City
[0124] Text excerpt: The Statue of Liberty, whose full name is "Liberty Enlightening the World", is located on Liberty Island in the harbor of New York City, USA. It is one of the symbols of New York City and a famous landmark in the United States and even the world. This bronze statue was given to the United States by France in 1876 to celebrate the 100th anniversary of the founding of the two countries. It symbolizes the friendship and cooperation between the two countries. The Statue of Liberty is not only an important milestone in American history, but also a treasure in the world's cultural treasure house. The main body of the Statue of Liberty is 46 meters high (excluding the base), and the total height with the base reaches 93 meters. This sculpture is not only a visual spectacle, but also a product of the fusion of human history and culture. The designer is French sculptor Frederic Auguste Bartholdi, and the engineering construction was completed by French engineer Edgar Aix. The sculpture of the Statue of Liberty is extremely rich in details. In her right hand, she holds a torch symbolizing freedom, symbolizing the message that the United States hopes to bring freedom to the world. In her left hand, she holds an open book with the words "July 4, 1776" engraved on it, which is the date when the United States declared independence. The crown on the goddess's head is surrounded by 7 long bands symbolizing the seven continents and oceans where the Statue of Liberty is located. The interior of the bronze statue is a complex structure, including steel frames that provide support for the sculpture and passages that allow maintenance personnel to enter the sculpture for maintenance and restoration. There is a museum inside the base of the statue, which displays exhibitions about the history, design and construction process of the Statue of Liberty. The Statue of Liberty is not only a tourist attraction, but also a witness to many historical events in the United States, such as the symbol of the reconstruction of the New York Port after the New York Fire in 1834. In addition, the Statue of Liberty is the starting point for many important immigrations in history. Thousands of immigrants entered the United States through the port where it is located to start a new life.
[0125] Summary: The Statue of Liberty is located in New York Harbor. It is a symbolic building of the United States. It was given to the United States by France to celebrate the 100th anniversary of its founding. It is a bronze statue with a height of 46 meters. The total height including the base is 93 meters. It is one of the tallest bronze statues in the world.
[0126] Recommended tags: American symbol, gift from France, New York Harbor, tallest bronze statue.
[0127] Step S5: clustering each of the primary portrait labels based on the large language model to generate multiple secondary portrait labels.
[0128] In this embodiment, a second prompt word is first constructed, and the second prompt word instructs the large language model to cluster the merged content consisting of the primary portrait label and the first text segment and then assign a second recommended label. Then, the target portrait entity, the second prompt word, the primary portrait label and the first text segment are input into the large language model to obtain a second recommended label corresponding to the first text segment, and the recommended label output by the large language model is used as the secondary portrait label.
[0129] After generating the primary portrait label, construct a second prompt word. In the second prompt word, first, based on the content summarized and recommended by all the first text fragments in step S4, merge the related or similar contents together, summarize them again, and then generate a secondary portrait label based on the summarized content.
[0130] Through step S4, multiple primary portrait labels are obtained. Take the crude oil industry chain research report as an example, for example, primary label 1: -**U.S. shale oil production continues to increase**: U.S. production has hit a record high and is expected to remain above 13 million barrels per day in 2024, making it one of the world's largest crude oil producers.
[0131] Primary label 2: -**OPEC production cuts**: OPEC continues to cut production, but faces challenges within its member countries, such as Angola's withdrawal from OPEC and African countries' dissatisfaction with the production cut quota.
[0132] Primary label 3: -**Increase in production in non-OPEC countries**: Production in Brazil, Canada and other countries increased, while the growth of shale oil production in the United States slowed down but remained high overall.
[0133] Primary label 4: -**Global economic recovery is slowing down**: The incremental demand brought about by the epidemic recovery is coming to an end, and the global economy is facing the risk of recession. The demand growth estimates given by the three major institutions vary greatly.
[0134] Primary Tag 5: - **China’s New Energy Vehicle Penetration**: The rapid growth of China’s new energy vehicle market may affect the demand for traditional fuel vehicles.
[0135] Primary Tag 6: - **European Economic Recession**: The European economy is facing recessionary pressure, which may lead to a decrease in crude oil demand.
[0136] Primary Tag 7: - **The market generally believes**: Crude oil prices will return to supply and demand fundamentals in 2024, and the impact of geopolitical factors will decrease marginally.
[0137] Primary Tag 8: - **Policy makers**: Pay attention to the implementation of OPEC's production cuts and the potential for increased production of US shale oil, and be wary of the impact of price fluctuations on the economy.
[0138] Primary Tag 9: -**Tight balance between supply and demand**: The supply and demand relationship tends to be balanced, but the uncertainty of OPEC's production cut implementation increases, and the effect of US production increase to offset OPEC's production cut weakens.
[0139] Primary label 10: - **Price trend**: It is expected that the central price of crude oil will decline in 2024, and the WTI price will fluctuate widely in the range of US$65-75 per barrel, and there is a possibility of testing the cost line of shale oil production increase.
[0140] Afterwards, multiple secondary portrait labels are obtained through step S5. Still taking the crude oil industry chain research report as an example, multiple primary portrait labels are clustered to obtain secondary portrait label A1: supply side. Secondary portrait label A1 is a clustering of primary labels A1, primary label A2, and primary label A3. Secondary portrait label A2: demand side. Secondary portrait label A2 is a clustering of primary labels 4, primary label 5, and primary label 6. Secondary portrait label A3: views of all parties. Secondary portrait label A3 is a clustering of primary label 7 and primary label 8. Secondary portrait label A4: event impact. Secondary portrait label A4 is a clustering of primary label 9 and primary label 10.
[0141] Step S6: Check the relevance of each of the secondary portrait tags based on the large language model, and iteratively cluster multiple strongly correlated secondary portrait tags until the correlations between the generated cluster tags are all less than the first threshold or the large language model considers that the generated cluster tags cannot be clustered again.
[0142] In this embodiment, a third prompt word is first constructed, and the third prompt word instructs the large language model to perform a relevance check on the secondary portrait tags, and iteratively cluster the strongly correlated secondary portrait tags. Then, the target portrait entity, the third prompt word, and the secondary portrait tags are input into the large language model. If the correlations between the clustering tags output by the large language model are all less than the first threshold, the iterative clustering is stopped. If the correlations between the clustering tags output by the large language model are greater than the first threshold or the large language model believes that the generated clustering tags can be clustered again, the iterative clustering continues.
[0143] Still taking the crude oil industry chain research report as an example, after obtaining multiple secondary portrait tags in step S5, each secondary portrait tag is checked for relevance, and the secondary portrait tag A1 supply side and the secondary portrait tag A2 demand side can continue to be clustered to generate the secondary portrait tag B1 again: event cause. Afterwards, if the correlation between the tags generated after clustering between the secondary portrait tag B1, the secondary portrait tag A3, and the secondary portrait tag A4 is less than the first threshold, the clustering is completed. Here, the correlation between the tags generated after clustering is expressed by cosine similarity, and the threshold range of the first threshold is 0 to 0.2, which means that the tags generated after clustering are consistent with the target portrait entity crude oil market analysis report.
[0144] Step S7: Structural processing is performed on the primary portrait label, the secondary portrait label and the clustering label, and a user portrait of the target portrait entity is generated using a knowledge graph.
[0145] After steps S4, S5 and S6, multiple primary portrait labels, secondary portrait labels and cluster labels are obtained, and then structured processing is performed to sort out the hierarchical relationship between the labels, organize the labels at all levels in the form of a graph, and use the knowledge graph to generate user portraits. Taking the crude oil industry chain research report as an example, the following is generated: Figure 2 User portrait shown.
[0146] The knowledge graph is a structured way of representing knowledge, organizing entities, concepts and their relationships in the form of a graph. After steps S5 and S6, the big model outputs the opinions and multi-level labeling results in the form of markdown, tables, etc. to form semi-structured data. In step S7, the markdown title level, table format, special separators such as ":" will be identified to form structured relational data, thereby constructing a knowledge graph.
[0147] This embodiment implements the construction of a portrait system through the above steps, which can effectively make up for the limitations of traditional portrait methods in text data processing capabilities. It deeply processes text data through a large language model, captures complex patterns and deep-level features in the text, and provides strong support for the accurate description of the portrait system.
[0148] The second embodiment of the present invention provides a portrait system construction system based on a large language model, which is implemented using the method steps in the first embodiment, such as Figure 3 As shown, the system includes a classification module 1, a screening module 2, a slicing module 3, a primary portrait module 4, a secondary portrait module 5, an iterative clustering module 6 and a portrait generation module 7.
[0149] Classification module 1, used to obtain original text data and classify the original text data;
[0150] Screening module 2, used to screen the original text data after classification processing to obtain initial text data related to the target portrait entity;
[0151] A slicing module 3 is used to slice the initial text data to obtain a plurality of sliced text segments, calculate the similarity values between adjacent sliced text segments, and merge the plurality of sliced text segments according to the similarity values to obtain a plurality of first text segments;
[0152] A primary portrait module 4 is used to summarize each of the first text segments based on a large language model and generate a primary portrait label corresponding to each of the first text segments;
[0153] A secondary portrait module 5, used for clustering each of the primary portrait labels based on a large language model to generate multiple secondary portrait labels;
[0154] Iterative clustering module 6, used for checking the relevance of each of the secondary portrait tags based on the large language model, and iteratively clustering multiple strongly correlated secondary portrait tags until the correlation between the generated cluster tags is greater than the first threshold or the large language model considers that the generated cluster tags can be clustered again;
[0155] The portrait generation module 7 is used to perform structured processing on the primary portrait label, the secondary portrait label and the clustering label, and generate a user portrait of the target portrait entity using the knowledge graph.
[0156] The fine-tuning training module 8 is used to perform fine-tuning training on the large language model. The fine-tuning data set used for the fine-tuning training includes a first data set, a second data set and a third data set set according to a preset ratio. The first data set is used to train the large language model to summarize the core ideas of any text fragment, the second data set is used to train the large language model to recognize the connection between any text fragment and a specific subject, and the third data set is used to train the versatility of the large language model.
[0157] The primary portrait module 4 includes an induction module and a primary portrait generation module. The induction module is used to construct a first prompt word, which instructs the large language model to summarize the first text segment related to the target portrait entity and specify a first recommended tag according to the summarized content. The primary portrait generation module is used to input the target portrait entity, the first prompt word and the first text segment into the large language model, obtain a first recommended tag corresponding to the first text segment, and use the recommended tag output by the large language model as the primary portrait tag.
[0158] The secondary portrait module 5 includes a clustering module and a secondary portrait generation module. The clustering module is used to construct a second prompt word, and the second prompt word instructs the large language model to assign a second recommended label after clustering the merged content consisting of the primary portrait label and the first text segment. The secondary portrait generation module is used to input the target portrait entity, the second prompt word, the primary portrait label and the first text segment into the large language model, obtain a second recommended label corresponding to the first text segment, and use the recommended label output by the large language model as the secondary portrait label.
[0159] The iterative clustering module 6 includes a checking module and an iterative module. The checking module is used to construct a third prompt word, and the third prompt word instructs the large language model to perform a relevance check on the secondary portrait tags and iteratively cluster the strongly correlated secondary portrait tags. The iterative module is used to input the target portrait entity, the third prompt word and the secondary portrait tags into the large language model. If the correlations between the clustering tags output by the large language model are all less than the first threshold, the iterative clustering is stopped. If the correlations between the clustering tags output by the large language model are greater than the first threshold or the large language model believes that the generated clustering tags can be clustered again, the iterative clustering continues.
[0160] A third embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the first embodiment are implemented.
[0161] The preferred specific embodiments of the present invention are described in detail above. It should be understood that ordinary technicians in the field can make many modifications and changes based on the concept of the present invention without creative work. Therefore, all technical solutions that can be obtained by technicians in the technical field based on the concept of the present invention through logical analysis, reasoning or limited experiments on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A method for constructing a portrait system based on a large language model, characterized in that: The following steps are involved: Acquire original text data, and classify and process the original text data; Screening the original text data after classification processing to obtain initial text data related to the target portrait entity; Slicing the initial text data to obtain a plurality of sliced text segments, calculating similarity values between adjacent sliced text segments, and merging the plurality of sliced text segments according to the similarity values to obtain a plurality of first text segments; Summarizing each of the first text segments based on the large language model to generate a primary portrait label corresponding to each of the first text segments; Clustering each of the primary portrait labels based on a large language model to generate multiple secondary portrait labels; Performing a relevance check on each of the secondary portrait tags based on the large language model, and iteratively clustering multiple strongly correlated secondary portrait tags until the correlations between the generated cluster tags are all less than a first threshold or the large language model determines that the generated cluster tags cannot be clustered again; The primary portrait label, the secondary portrait label and the clustering label are structured, and a user portrait of the target portrait entity is generated using a knowledge graph.
2. The method for constructing a portrait system based on a large language model according to claim 1, characterized in that: The method further comprises: Fine-tuning training is performed on the large language model, and the fine-tuning data set used for the fine-tuning training includes a first data set, a second data set, and a third data set set according to a preset ratio, the first data set is used to train the large language model to summarize the core ideas of any text fragment, the second data set is used to train the large language model to recognize the connection between any text fragment and a specific subject, and the third data set is used to train the versatility of the large language model.
3. The method for constructing a portrait system based on a large language model according to claim 2, characterized in that: The data volumes of the first data set, the second data set, and the third data set are all similar.
4. The method for constructing a portrait system based on a large language model according to claim 1, characterized in that: The method of summarizing the opinions of each of the first text segments based on the large language model to generate a primary portrait label corresponding to each of the first text segments includes the following steps: Constructing a first prompt word, wherein the first prompt word instructs the large language model to summarize the first text segment related to the target portrait entity, and specifies a first recommended tag according to the summarized content; The target portrait entity, the first prompt word and the first text segment are input into a large language model to obtain a first recommended label corresponding to the first text segment, and the recommended label output by the large language model is used as the primary portrait label.
5. The method for constructing a portrait system based on a large language model according to claim 4, characterized in that: The step of clustering each of the primary portrait labels based on the large language model to generate multiple secondary portrait labels includes the following steps: Constructing a second prompt word, wherein the second prompt word instructs the large language model to cluster the merged content consisting of the primary portrait label and the first text segment and then assign a second recommended label; The target portrait entity, the second prompt word, the primary portrait label and the first text fragment are input into a large language model to obtain a second recommended label corresponding to the first text fragment, and the recommended label output by the large language model is used as the secondary portrait label.
6. The method for constructing a portrait system based on a large language model according to claim 5, characterized in that: The step of checking the relevance of each of the secondary portrait labels based on the large language model and iteratively clustering multiple strongly correlated secondary portrait labels until the correlations between the generated cluster labels are all less than a first threshold or the large language model considers that the generated cluster labels cannot be clustered again includes the following steps: Constructing a third prompt word, wherein the third prompt word instructs the large language model to perform a relevance check on the secondary portrait tags and iteratively cluster the strongly correlated secondary portrait tags; The target portrait entity, the third prompt word and the secondary portrait label are input into the large language model. If the correlations between the cluster labels output by the large language model are all less than a first threshold, the iterative clustering is stopped. If the correlations between the cluster labels output by the large language model are greater than the first threshold or the large language model believes that the generated cluster labels can be clustered again, the iterative clustering is continued.
7. The method for constructing a portrait system based on a large language model according to claim 1, characterized in that: The method of screening the original text data after classification processing to obtain initial text data related to the target portrait entity includes the following steps: After the original text data is converted into word embedding, it is input into a pre-trained BERT model to obtain a correlation value between the original text data and the target portrait entity; Target text data whose correlation value is higher than a preset value is screened out from the original text data, and the target text data is used as initial text data related to the target portrait entity.
8. The method for constructing a portrait system based on a large language model according to claim 7, characterized in that: The BERT model is pre-trained using a large amount of unlabeled text data, and the pre-trained BERT model is used to capture contextual information in the text data.
9. A portrait system construction system based on a large language model, characterized in that: Includes the following modules: A classification module, used to obtain original text data and perform classification processing on the original text data; A screening module is used to screen the original text data after classification processing to obtain initial text data related to the target portrait entity; A slicing module, used for slicing the initial text data to obtain a plurality of sliced text segments, calculating similarity values between adjacent sliced text segments, and merging the plurality of sliced text segments according to the similarity values to obtain a plurality of first text segments; A primary portrait module, used for summarizing each of the first text segments based on a large language model to generate a primary portrait label corresponding to each of the first text segments; A secondary portrait module, used for clustering each of the primary portrait labels based on a large language model to generate multiple secondary portrait labels; An iterative clustering module, used for checking the relevance of each of the secondary portrait labels based on the large language model, and iteratively clustering multiple strongly correlated secondary portrait labels until the correlations between the generated cluster labels are all less than a first threshold or the large language model considers that the generated cluster labels cannot be clustered again; A portrait generation module is used to perform structured processing on the primary portrait label, the secondary portrait label and the clustering label, and use the knowledge graph to generate a user portrait of the target portrait entity.
10. The portrait system construction system based on a large language model according to claim 9, characterized in that: Also includes: A fine-tuning training module is used to perform fine-tuning training on the large language model. The fine-tuning data set used for the fine-tuning training includes a first data set, a second data set and a third data set set according to a preset ratio. The first data set is used to train the large language model to summarize the core ideas of any text fragment, the second data set is used to train the large language model to identify the connection between any text fragment and a specific subject, and the third data set is used to train the versatility of the large language model.
11. The portrait system construction system based on a large language model according to claim 9, characterized in that: The primary portrait module includes: An induction module, configured to construct a first prompt word, wherein the first prompt word instructs the large language model to summarize the first text segment related to the target portrait entity, and specifies a first recommended tag according to the summarized content; The primary portrait generation module is used to input the target portrait entity, the first prompt word and the first text fragment into a large language model, obtain a first recommended label corresponding to the first text fragment, and use the recommended label output by the large language model as the primary portrait label.
12. The portrait system construction system based on a large language model according to claim 11, characterized in that: The secondary portrait module includes: A clustering module, used for constructing a second prompt word, wherein the second prompt word instructs the large language model to assign a second recommended tag after clustering the combined content consisting of the primary portrait tag and the first text segment; A secondary portrait generation module is used to input the target portrait entity, the second prompt word, the primary portrait label and the first text fragment into a large language model to obtain a second recommended label corresponding to the first text fragment, and use the recommended label output by the large language model as the secondary portrait label.
13. The portrait system construction system based on a large language model according to claim 12, characterized in that: The iterative clustering module comprises: A checking module, used for constructing a third prompt word, wherein the third prompt word instructs the large language model to perform a relevance check on the secondary portrait tags and iteratively cluster the strongly correlated secondary portrait tags; The iterative module is used to input the target portrait entity, the third prompt word and the secondary portrait label into the large language model. If the correlations between the cluster labels output by the large language model are all less than a first threshold, the iterative clustering is stopped; if the correlations between the cluster labels output by the large language model are greater than the first threshold or the large language model believes that the generated cluster labels can be clustered again, the iterative clustering is continued.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method for constructing a portrait system based on a large language model as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Teacher portrait construction method based on teaching and research data
CN113656687A
Detection method and device based on user overall behavior portrait, medium and equipment
CN117874681A