Content processing method and related equipment
By employing a two-stage granular feature extraction method, which utilizes low-dimensional features for rapid filtering and high-dimensional features for precise matching, the problem of low efficiency and accuracy in content retrieval in existing technologies is solved, achieving fast and accurate content retrieval.
Patent Information
- Application Number
- CN202410977573.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2026-01-20
AI Technical Summary
Existing content retrieval methods are inefficient and inaccurate, making it difficult to quickly and accurately retrieve the content users need from massive amounts of information.
A two-stage granular feature extraction method is adopted. First, the initial matching content is recalled through low-dimensional features, and then the final matching content is determined through high-dimensional features. The low-dimensional features are used to process the rapid screening of large-scale content, and the high-dimensional features are used to process the precise matching of small-scale content.
It achieves rapid response and accuracy in large-scale content retrieval, improves the efficiency and accuracy of content retrieval, and balances retrieval speed and result accuracy.
Smart Images

Figure CN121365170A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a content processing method and related equipment. BACKGROUND
[0002] With the development of Internet technology, network information is growing rapidly, and there is a large amount of redundant information on the network. Users can quickly search for the content they need from the massive information data with the help of a content retrieval system.
[0003] In the related art, in order to retrieve the content required by the user from the massive content, a neural network model is generally used to directly extract the features of the query content provided by the user to obtain the content feature information of the query content, and then the content feature information of the query content is matched with the content feature information of each candidate content to calculate the matching degree, and the content matching the query content is retrieved from the candidate content according to the calculated matching degree. Since this content retrieval method is relatively rough and simple, it is not conducive to improving the efficiency and accuracy of content retrieval. SUMMARY
[0004] The embodiments of the present application provide a content processing method and related equipment, which can include a content processing device, an electronic device, a computer readable storage medium and a computer program product, and can balance the efficiency and accuracy of large-scale content retrieval, which is conducive to improving the efficiency and accuracy of content retrieval, and ensures both the fast response of large-scale content retrieval and the accuracy of the retrieval result.
[0005] The embodiments of the present application provide a content processing method, which includes:
[0006] obtaining target content to be processed and a plurality of candidate contents;
[0007] performing first dimension feature extraction processing on the target content to obtain content feature information of the target content in the first dimension;
[0008] based on the content feature information of the target content in the first dimension, recalling a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents;
[0009] performing second dimension feature extraction processing on the target content to obtain content feature information of the target content in the second dimension, the second dimension being greater than the first dimension;
[0010] based on the content feature information of the target content in the second dimension, determining at least one target matching content corresponding to the target content from the plurality of initial matching contents;
[0011] outputting the at least one target matching content corresponding to the target content.
[0012] Accordingly, an embodiment of the present application provides a content processing apparatus, comprising:
[0013] an acquisition unit configured to acquire target content to be processed and a plurality of candidate contents;
[0014] a first extraction unit configured to perform first-dimension feature extraction processing on the target content to obtain content feature information of the target content in a first dimension;
[0015] a recall unit configured to recall, based on the content feature information of the target content in the first dimension, a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents;
[0016] a second extraction unit configured to perform second-dimension feature extraction processing on the target content to obtain content feature information of the target content in a second dimension, the second dimension being greater than the first dimension;
[0017] a determination unit configured to determine, based on the content feature information of the target content in the second dimension, at least one target matching content corresponding to the target content from the plurality of initial matching contents;
[0018] an output unit configured to output the at least one target matching content corresponding to the target content.
[0019] Optionally, in some embodiments of the present application, the first extraction unit can comprise a dimension determination subunit, a dimension selection subunit and a feature extraction subunit, as follows:
[0020] the dimension determination subunit is configured to determine a plurality of preset first dimensions, each preset first dimension being less than the second dimension;
[0021] the dimension selection subunit is configured to select a first dimension from the plurality of preset first dimensions based on current computing resources;
[0022] the feature extraction subunit is configured to perform first-dimension feature extraction processing on the target content to obtain content feature information of the target content in the first dimension.
[0023] Optionally, in some embodiments of the present application, the first extraction unit can comprise an extraction subunit and a transformation subunit, as follows:
[0024] the extraction subunit is configured to perform feature extraction processing on the target content to obtain feature information of the target content;
[0025] The transformation subunit is configured to perform linear transformation processing on the feature information of the target content in a first dimension to obtain content feature information of the target content in the first dimension.
[0026] The second extraction subunit is configured to perform linear transformation processing on the feature information of the target content in a second dimension to obtain content feature information of the target content in the second dimension.
[0027] Optionally, in some embodiments of the present application, the recall unit can include a first extraction subunit, a first calculation subunit, and a recall subunit, as follows:
[0028] The first extraction subunit is configured to perform feature extraction processing on each candidate content in a first dimension to obtain first feature information of the candidate content in the first dimension.
[0029] The first calculation subunit is configured to calculate a matching degree between the content feature information of the target content in the first dimension and the first feature information of each candidate content in the first dimension.
[0030] The recall subunit is configured to recall, according to the matching degree, a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents.
[0031] Optionally, in some embodiments of the present application, the determination unit can include a second extraction subunit, a second calculation subunit, and a determination subunit, as follows:
[0032] The second extraction subunit is configured to perform feature extraction processing on each initial matching content in a second dimension to obtain second feature information of the initial matching content in the second dimension.
[0033] The second calculation subunit is configured to calculate a matching degree between the content feature information of the target content in the second dimension and the second feature information of each initial matching content in the second dimension.
[0034] The determination subunit is configured to determine, according to the matching degree, at least one target matching content corresponding to the target content from the plurality of initial matching contents.
[0035] Optionally, in some embodiments of the present application, the first extraction unit can be specifically configured to perform feature extraction processing on the target content in a first dimension by using a content processing model to obtain content feature information of the target content in the first dimension.
[0036] The second extraction unit can be specifically configured to perform feature extraction processing on the target content in a second dimension by using the content processing model to obtain content feature information of the target content in the second dimension.
[0037] Optionally, in some embodiments of the present application, the content processing apparatus can further include a training data acquisition unit, a query feature extraction unit, a structure feature extraction unit, a matching calculation unit and a parameter adjustment unit, as follows:
[0038] The training data acquisition unit is configured to acquire training data, the training data including a plurality of sample query contents and a plurality of query result contents corresponding to the sample query contents, and label information of the query result contents representing expected matching degrees of the query result contents with the sample query contents;
[0039] The query feature extraction unit is configured to perform feature extraction processing on the sample query contents in a plurality of preset dimensions by using a content processing model, to obtain query feature information of the sample query contents in each preset dimension;
[0040] The structure feature extraction unit is configured to perform feature extraction processing on the query result contents in a plurality of preset dimensions, to obtain result feature information of the query result contents in each preset dimension;
[0041] The matching calculation unit is configured to, for each preset dimension, perform matching degree calculation on the query feature information of the sample query content in the preset dimension and the result feature information of the query result content in the preset dimension, to obtain a matching degree of the sample query content and the query result content in the preset dimension;
[0042] The parameter adjustment unit is configured to adjust parameters of the content processing model according to the matching degrees of the sample query content and the query result content in each preset dimension, to obtain a trained content processing model.
[0043] Optionally, in some embodiments of the present application, the query result content corresponding to the sample query content includes a negative sample result content and a positive sample result content;
[0044] The parameter adjustment unit can include a loss calculation subunit, a loss fusion subunit and a parameter adjustment subunit, as follows:
[0045] The loss calculation subunit is configured to, for each preset dimension, calculate sub-loss information in the preset dimension based on the matching degrees of the sample query content and the negative sample result content in the preset dimension, and the matching degrees of the sample query content and the positive sample result content in the preset dimension;
[0046] The loss fusion subunit is configured to perform fusion processing on the sub-loss information in each preset dimension, to obtain total loss information;
[0047] The parameter adjusting subunit is configured to adjust parameters of the content processing model according to the total loss information, to obtain a trained content processing model.
[0048] Optionally, in some embodiments of the present application, the content processing model comprises a shared feature obtaining module and a plurality of linear transformation modules, each linear transformation module corresponding to a preset dimension;
[0049] The query feature extraction unit can comprise a query feature extraction subunit and a linear transformation subunit, as follows:
[0050] The query feature extraction subunit is configured to perform feature extraction processing on the sample query content by the shared feature obtaining module, to obtain feature information of the sample query content;
[0051] The linear transformation subunit is configured to perform linear transformation processing on the feature information of the sample query content by each linear transformation module, to obtain query feature information of the sample query content in each preset dimension.
[0052] Optionally, in some embodiments of the present application, the content processing device can further comprise a pre-training unit configured to train the shared feature obtaining module; the pre-training unit can comprise an obtaining subunit, a mask subunit, a content feature extraction subunit, a prediction subunit and a module parameter adjusting subunit, as follows:
[0053] The obtaining subunit is configured to obtain a preset shared feature obtaining module and a plurality of sample contents, the sample contents comprising a plurality of content units;
[0054] The mask subunit is configured to select at least one target content unit from the content units of the sample contents, and perform mask processing on the target content unit, to obtain a masked sample content;
[0055] The content feature extraction subunit is configured to perform feature extraction on the masked sample content by the preset shared feature obtaining module, to obtain content features of the masked sample content;
[0056] The prediction subunit is configured to perform prediction processing on the masked target content unit based on the content features, to obtain a predicted content unit;
[0057] The module parameter adjusting subunit is configured to adjust parameters in the preset shared feature obtaining module based on the predicted content unit and the target content unit corresponding thereto, to obtain the shared feature obtaining module.
[0058] Optionally, in some embodiments of the present application, the obtaining sub-unit can be specifically configured to obtain a preset shared feature obtaining module and original training data, the original training data comprising a plurality of original sample contents; perform a hash operation on each original sample content to obtain a hash value corresponding to each original sample content; and perform a deduplication process on the original sample contents in the original training data based on the hash values to obtain deduplicated sample contents.
[0059] Optionally, in some embodiments of the present application, the content feature extraction sub-unit can be specifically configured to perform attention encoding processing on the masked sample content by using a preset shared feature obtaining module to obtain an attention feature of the masked sample content; perform full connection processing and activation processing on the attention feature to obtain a processed feature of the masked sample content; and perform normalization processing on the processed feature to obtain a content feature of the masked sample content.
[0060] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an integral module or unit that includes the functions of the module or unit.
[0061] The electronic device provided in the embodiments of the present application includes a processor and a memory, the memory stores a plurality of instructions, and the processor loads the instructions to execute the steps in the content processing method provided in the embodiments of the present application.
[0062] The embodiments of the present application further provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps in the content processing method provided in the embodiments of the present application.
[0063] In addition, the embodiments of the present application further provide a computer program product including a computer program or instructions, which are executed by a processor to implement the steps in the content processing method provided in the embodiments of the present application.
[0064] The embodiment of the present application provides a content processing method and related equipment, which can acquire target content to be processed and a plurality of candidate contents; performing first-dimension feature extraction processing on the target content to obtain content feature information of the target content in the first dimension; based on the content feature information of the target content in the first dimension, recalling a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents; performing second-dimension feature extraction processing on the target content to obtain content feature information of the target content in the second dimension, the second dimension being greater than the first dimension; based on the content feature information of the target content in the second dimension, determining at least one target matching content corresponding to the target content from the plurality of initial matching contents; and outputting the at least one target matching content corresponding to the target content.
[0065] The present application can perform feature extraction of different dimensions on the target content, recall initial matching contents through coarse-grained first-dimension feature information first, and then determine target matching contents corresponding to the target content from the initial matching contents based on fine-grained second-dimension feature information. This two-stage, grain-size-based content retrieval method utilizes the respective advantages of low-dimension features and high-dimension features, the low-dimension features are used for processing large-scale content data for rapid screening, and the high-dimension features are used for processing small-scale content data for accurate matching, so that the efficiency and accuracy of large-scale content retrieval are balanced, which is beneficial to improving the efficiency and accuracy of content retrieval, ensures the rapid response of large-scale content retrieval, and ensures the accuracy of the retrieval result. BRIEF DESCRIPTION OF DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0067] Figure 1a is a scene schematic diagram of the content processing method provided by the embodiment of the present application;
[0068] Figure 1b is a flowchart of the content processing method provided by the embodiment of the present application;
[0069] Figure 1c is another flowchart of the content processing method provided by the embodiment of the present application;
[0070] Figure 2a is a model architecture diagram of the content processing method provided by the embodiment of the present application;
[0071] Figure 2bis another model architecture diagram of the content processing method provided by the embodiment of the present application;
[0072] Figure 2c is another flowchart of the content processing method provided by the embodiment of the present application;
[0073] Figure 3 is a structural schematic diagram of the content processing device provided by the embodiment of the present application;
[0074] Figure 4 is a structural schematic diagram of the electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0075] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0076] The embodiments of the present application provide a content processing method and related devices, which can include a content processing device, an electronic device, a computer readable storage medium and a computer program product. The content processing device can be specifically integrated in an electronic device, which can be a terminal or a server, etc.
[0077] It can be understood that the content processing method of the present embodiment can be executed on a terminal, or executed on a server, or executed by the terminal and the server together. The above examples should not be understood as limiting the present application.
[0078] As shown in Figure 1a , taking the content processing method executed by the terminal and the server together as an example. The content processing system provided by the embodiment of the present application includes a terminal 10 and a server 11, etc. The terminal 10 and the server 11 are connected through a network, such as a wired or wireless network connection, etc., wherein the content processing device can be integrated in the server.
[0079] The server 11 can be configured to: acquire target content to be processed and a plurality of candidate contents; perform first-dimension feature extraction processing on the target content to obtain content feature information of the target content in the first dimension; based on the content feature information of the target content in the first dimension, recall a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents; perform second-dimension feature extraction processing on the target content to obtain content feature information of the target content in the second dimension, the second dimension being greater than the first dimension; based on the content feature information of the target content in the second dimension, determine at least one target matching content corresponding to the target content from the plurality of initial matching contents; and output the at least one target matching content corresponding to the target content to the terminal 10. The server 11 can be a physical server, a server cluster composed of a plurality of physical servers, or a distributed system, or a cloud server providing cloud computing services.
[0080] The terminal 10 can be configured to: send target content to be processed to the server 11, so that the server 11 retrieves target matching content corresponding to the target content; and receive the target matching content corresponding to the target content sent by the server 11. The terminal 10 can include a mobile phone, a vehicle-mounted terminal, an aircraft, a tablet computer, a notebook computer, or a personal computer (PC), etc. The terminal 10 can further include a client, which can be an application program client or a browser client, etc.
[0081] The steps of content processing in the server 11 described above can also be performed by the terminal 10.
[0082] The following will be described in detail. It should be noted that the order of the following embodiments is not limited to the preferred order of the embodiments.
[0083] This embodiment will be described from the perspective of a content processing device, which can be integrated in an electronic device, such as a server or a terminal.
[0084] It can be understood that in the specific embodiments of the present application, data related to user information is involved. When the above embodiments of the present application are applied to specific products or technologies, the user's permission or consent is required, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of the country and region.
[0085] As shown in Figure 1b The specific process of the content processing method can be as follows:
[0086] 101、acquire target content to be processed and a plurality of candidate contents.
[0087] The content modalities of the target content and the candidate content are not limited, for example, the target content or the candidate content can be text, audio, image, or video, etc. Specifically, the target content and the candidate content can be single-modal content such as pure text content, or multi-modal content such as image-text combined content, etc.
[0088] The content processing method provided by the present application has a wide range of application scenarios, such as can be applied to intelligent question answering, search engine, etc. In the intelligent question answering system or chat robot, the content processing method of the present application can help the robot to more accurately understand the user's demand, retrieve the most relevant answer to the user's question from the knowledge base, and thus provide more targeted answers; the target content can be specifically the user question input by the user in the intelligent question answering system or chat robot, and the candidate content can be the candidate answer. In the search engine scenario, for the search engine of web pages, documents or other resources, the content processing method of the present application can help the user to more accurately find the content related to the query, and specifically by capturing the deep semantic relationship between the query and the document, the relevance and quality of the search result can be improved; the target content can be the query content input by the user in the search bar, and the candidate content can be a large number of documents.
[0089] 102. performing first-dimension feature extraction processing on the target content to obtain content feature information of the target content in the first dimension.
[0090] The target content can be processed by a content processing model to perform first-dimension feature extraction processing, thereby obtaining the content feature information of the target content in the first dimension. Specifically, by using the content processing model, the feature information of the target content can be obtained by first performing feature extraction processing on the target content; then performing linear transformation processing on the feature information of the target content in the first dimension, and finally obtaining the content feature information of the target content in the first dimension.
[0091] The first dimension can be determined according to actual conditions, and the dimension here specifically refers to the dimension of the feature, that is, the vector dimension of the feature vector.
[0092] In the content processing method of the present application, the initial matching content of the target content can be recalled through the coarse-grained content feature information of the target content in the first dimension, and then the target matching content corresponding to the target content can be determined from the initial matching content based on the fine-grained content feature information of the target content in the second dimension.
[0093] Specifically, the first dimension can be a relatively low dimension, and the second dimension can be a relatively high dimension.
[0094] Optionally, in this embodiment, the step of "performing feature extraction processing on the target content in the first dimension to obtain content feature information of the target content in the first dimension" can include:
[0095] determining a plurality of preset first dimensions, each preset first dimension being smaller than the second dimension;
[0096] selecting a first dimension from the plurality of preset first dimensions based on the current computing resource;
[0097] performing feature extraction processing on the target content in the first dimension to obtain content feature information of the target content in the first dimension.
[0098] In this embodiment, the first dimension can be flexibly adjusted according to the current computing resource. Specifically, there are a plurality of computing resource levels and a mapping relationship between each computing resource level and each preset first dimension, and each computing resource level corresponds to a computing resource range. In this embodiment, the target computing resource level in which the current computing resource is located is first determined, and then the first dimension is selected from the plurality of preset first dimensions based on the target computing resource level.
[0099] In a specific scenario, the preset first dimensions can include 32, 64, 128, 256, 512, 1024, and 2048, and the second dimension can be 4096. If the current computing resource is particularly tight, 32 can be selected as the first dimension, content feature information of the target content in the first dimension of 32 is extracted, initial matching content of the target content is recalled based on the content feature information, and then content feature information of the target content in the second dimension of 4096 is extracted for final-stage screening, thereby improving the accuracy of the search result. If the current computing resource is relatively sufficient, a higher preset first dimension can be selected as the first dimension for initial matching content recall, such as 2048, which can be selected as the first dimension for initial matching content recall, and then content feature information of the target content in the second dimension of 4096 is extracted, and finally-stage screening is performed based on the content feature information of the target content in the second dimension of 4096.
[0100] 103、based on the content feature information of the target content in the first dimension, recalling a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents.
[0101] Optionally, in this embodiment, the step of "based on the content feature information of the target content in the first dimension, recalling a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents" can include:
[0102] performing feature extraction processing on each candidate content in the first dimension to obtain first feature information of each candidate content in the first dimension;
[0103] calculate a matching degree between the content feature information of the target content in the first dimension and first feature information of each candidate content in the first dimension;
[0104] recall, from the plurality of candidate contents, a plurality of initial matching contents corresponding to the target content according to the matching degrees.
[0105] In some embodiments, the low-dimensional features are used in the recall stage of large-scale content retrieval, which can improve the efficiency of large-scale content retrieval.
[0106] In particular, a vector distance between the content feature information of the target content in the first dimension and the first feature information of each candidate content in the first dimension can be calculated, and the matching degree between the two can be determined according to the vector distance. The greater the vector distance, the smaller the matching degree; otherwise, the smaller the vector distance, the greater the matching degree.
[0107] In some embodiments, candidate contents with a matching degree greater than a preset matching degree can be recalled as initial matching contents corresponding to the target content, and the preset matching degree can be set according to actual conditions. In other embodiments, each candidate content can be sorted according to the matching degree. In particular, the candidate contents can be sorted in descending order according to the size of the matching degree to obtain sorted candidate contents, and the first n candidate contents of the sorted candidate contents can be selected as the initial matching contents of the target content.
[0108] 104. performing a feature extraction process on the target content in a second dimension to obtain content feature information of the target content in the second dimension, the second dimension being greater than the first dimension.
[0109] Optionally, in the present embodiment, the step of "performing a feature extraction process on the target content in a first dimension to obtain content feature information of the target content in the first dimension" can include:
[0110] performing a feature extraction process on the target content to obtain feature information of the target content;
[0111] performing a linear transformation process on the feature information of the target content in a first dimension to obtain content feature information of the target content in the first dimension;
[0112] The step of "performing a feature extraction process on the target content in a second dimension to obtain content feature information of the target content in the second dimension" can include:
[0113] performing a linear transformation process on the feature information of the target content in a second dimension to obtain content feature information of the target content in the second dimension.
[0114] The content feature information of the target content in the first dimension and the content feature information of the target content in the second dimension have a certain correlation, and both are obtained by linear transformation processing based on the extracted feature information. In this embodiment, the feature information is extracted by the shared feature acquisition module of the content processing model, and the shared feature acquisition module learns the features of multiple dimensions of sample content, so the extracted feature information of the target content has stronger content semanticity.
[0115] The content processing model can further include multiple linear transformation modules, and different linear transformation modules correspond to different dimensions. The content feature information of the target content in the first dimension can be obtained by linear transformation processing of the feature information of the target content by the linear transformation module corresponding to the first dimension, and the content feature information of the target content in the second dimension can be obtained by linear transformation processing of the feature information of the target content by the linear transformation module corresponding to the second dimension.
[0116] 105. Based on the content feature information of the target content in the second dimension, at least one target matching content corresponding to the target content is determined from the multiple initial matching contents.
[0117] Optionally, in this embodiment, the step of "determining at least one target matching content corresponding to the target content from the multiple initial matching contents based on the content feature information of the target content in the second dimension" can include:
[0118] performing second dimension feature extraction processing on each initial matching content to obtain second feature information of each initial matching content in the second dimension;
[0119] calculating the matching degree between the content feature information of the target content in the second dimension and the second feature information of each initial matching content in the second dimension;
[0120] According to the matching degree, at least one target matching content corresponding to the target content is determined from the multiple initial matching contents.
[0121] In this embodiment, the high-dimensional feature is used for precise matching of small-scale content data, which can improve the precision of content retrieval.
[0122] Specifically, the vector distance between the content feature information of the target content in the second dimension and the second feature information of each initial matching content in the second dimension can be calculated, and the matching degree between the two is determined according to the vector distance. The greater the vector distance, the smaller the matching degree; on the contrary, the smaller the vector distance, the greater the matching degree. The vector distance can be calculated in multiple ways, such as cosine similarity or Euclidean distance.
[0123] In some embodiments, the initial matching content with a matching degree greater than a preset matching degree can be used as the target matching content of the target content, and the preset matching degree can be set according to actual conditions. In another embodiment, the initial matching contents can be sorted according to the matching degrees, and the sorted initial matching contents can be sorted from large to small according to the sizes of the matching degrees, and the first m initial matching contents of the sorted initial matching contents can be selected as the final target matching contents of the target content.
[0124] 106、outputting at least one target matching content corresponding to the target content.
[0125] The content processing method of the present application uses low-dimensional vectors in the recall stage of large-scale content retrieval and high-dimensional vectors in the sorting stage of initial matching content, which can achieve efficient and accurate content retrieval. This process takes advantage of the respective advantages of low-dimensional vectors and high-dimensional vectors, achieving a balance between the efficiency and accuracy of large-scale content retrieval. Low-dimensional vectors are used to quickly screen large-scale content data, and high-dimensional vectors are used to accurately match small-scale content data. This ensures both fast response of large-scale content retrieval and accuracy of the retrieval results. This method has good flexibility and can adjust the vector dimension according to actual needs and computing resource limitations. This method better and more efficiently utilizes resources, reducing storage space and computing resource consumption in the recall stage.
[0126] Optionally, in the present embodiment, the step of "performing first-dimensional feature extraction processing on the target content to obtain content feature information of the target content in the first dimension" can include:
[0127] performing first-dimensional feature extraction processing on the target content by a content processing model to obtain content feature information of the target content in the first dimension;
[0128] The step of "performing second-dimensional feature extraction processing on the target content to obtain content feature information of the target content in the second dimension" can include:
[0129] performing second-dimensional feature extraction processing on the target content by the content processing model to obtain content feature information of the target content in the second dimension.
[0130] The content processing model can be a neural network model, which can be an LSTM (Long Short-Term Memory), an RNN (Recurrent Neural Network), a GRU (Gate Recurrent Unit), a transformer, or the like. However, it should be understood that the neural network model of the present embodiment is not limited to the above-mentioned types.
[0131] It should be noted that the content processing device can be trained by other devices and then provided to the content processing device, or the content processing device can also be trained by itself.
[0132] If the content processing device is trained by itself, before the step of "performing first-dimension feature extraction processing on the target content by the content processing model to obtain content feature information of the target content in the first dimension", the content processing method can further include:
[0133] obtaining training data, the training data including a plurality of sample query contents and a plurality of query result contents corresponding to the sample query contents, and label information of the query result contents representing expected matching degrees between the query result contents and the sample query contents;
[0134] performing feature extraction processing on the sample query contents in a plurality of preset dimensions by a content processing model to obtain query feature information of the sample query contents in each of the preset dimensions;
[0135] performing feature extraction processing on the query result contents in a plurality of preset dimensions to obtain result feature information of the query result contents in each of the preset dimensions;
[0136] For each preset dimension, performing matching degree calculation on the query feature information of the sample query content in the preset dimension and the result feature information of the query result content in the preset dimension to obtain a matching degree between the sample query content and the query result content in the preset dimension;
[0137] According to the matching degrees between the sample query contents and the query result contents in each of the preset dimensions, adjusting parameters of the content processing model to obtain a trained content processing model.
[0138] Specifically, the label information of the query result content can include 0 and 1, 1 indicating that the query result content is a positive sample result content of the sample query content, i.e., the expected matching degree of the query result content and the sample query content is 1 (complete matching); and 0 indicating that the query result content is a negative sample result content of the sample query content, i.e., the expected matching degree of the query result content and the sample query content is 0 (complete non-matching).
[0139] For the calculation of the matching degree, specifically, the vector distance between the query feature information of the sample query content in the preset dimension and the result feature information of the query result content in the preset dimension can be calculated first, and then the matching degree in the preset dimension is determined based on the vector distance. The greater the vector distance, the lower the matching degree; on the contrary, the smaller the vector distance, the higher the matching degree.
[0140] Optionally, in the embodiment, the query result content corresponding to the sample query content includes negative sample result content and positive sample result content; and the step of "adjusting the parameters of the content processing model according to the matching degrees of the sample query content and the query result content in each preset dimension to obtain the trained content processing model" can include:
[0141] For each preset dimension, the sub-loss information in the preset dimension is calculated based on the matching degrees of the sample query content and the negative sample result content in the preset dimension and the matching degrees of the sample query content and the positive sample result content in the preset dimension.
[0142] The sub-loss information in each preset dimension is fused to obtain total loss information;
[0143] The parameters of the content processing model are adjusted according to the total loss information to obtain the trained content processing model.
[0144] The fusion manner of the sub-loss information in each preset dimension can be various, and the embodiment does not limit the fusion manner. For example, the fusion manner can be weighted summation, etc.
[0145] In the embodiment, the sample query content, the negative sample result content and the positive sample result content thereof form a triple data, and the model can be trained based on the triple data. The training process is to calculate the total loss information first, and then the parameters of the content processing model are adjusted based on the total loss information using the back propagation algorithm. The parameters of the content processing model are optimized based on the total loss information, so that the total loss information is less than a preset loss value, and the trained content processing model is obtained.
[0146] In a specific embodiment, the i-th sample query content is denoted as q i , and the corresponding positive sample result content is denoted as Corresponding to the plurality of (specifically, l) negative sample result contents The jth negative sample result content of the ith sample query content is represented as q i And the positive sample result content The matching degree in the preset dimension m can be denoted as The sample query content q i And the negative sample result content The matching degree in the preset dimension m can be denoted as The preset dimension d m The sub-loss information L m The comparison loss can be calculated, and the calculation method is specifically shown in formula (1):
[0147]
[0148] Wherein, n is the number of sample query contents. Each preset dimension d m corresponds to a contrastive learning loss function L m The final total loss information L can be obtained by weighted sum of the contrastive learning loss functions of each preset dimension, as shown in formula (2):
[0149]
[0150] Wherein, the embodiment specifically has 8 preset dimensions, c m ≥ 0, c m represents the relative importance factor of the preset dimension d m In the training process of contrastive learning, the model parameters of the vector model are optimized and updated by minimizing the loss function L, so that the similarity of the positive sample is as high as possible, and the similarity of the negative sample is as low as possible.
[0151] Optionally, in the embodiment, the content processing model comprises a shared feature acquisition module and a plurality of linear transformation modules, each linear transformation module corresponding to a preset dimension;
[0152] The step "performing feature extraction processing on the sample query content in multiple preset dimensions by the content processing model to obtain query feature information of the sample query content in each preset dimension" can include:
[0153] Performing feature extraction processing on the sample query content by the shared feature acquisition module to obtain the feature information of the sample query content;
[0154] The feature information of the sample query content is linearly transformed by each linear transformation module to obtain query feature information of the sample query content in each preset dimension.
[0155] The shared feature acquisition module is a base model of the content processing model, and can be BERT (Bidirectional Encoder Representations from Transformers), RoBERTa (Robustly Optimized BERT Pretraining Approach), or the like.
[0156] The linear transformation module can be configured to perform linear transformation processing on the feature information output by the shared feature acquisition module in a corresponding preset dimension. In this embodiment, the feature output by the content processing model is not of a fixed dimension, and can realize multi-granularity perception from coarse granularity to fine granularity to obtain features of multiple dimensions. The content processing model of this application only needs to be trained to output multiple dimensions, which significantly saves computing resources and improves training efficiency.
[0157] Moreover, in the multi-dimensional output content processing model of this application, all the features of different dimensions are generated by the same model, and the parameters of the model are shared between the output features of different dimensions; thus, the knowledge learned by the model in one dimension can be utilized by other dimensions. Specifically, when there is a certain correlation between multiple tasks, simultaneously learning these tasks can improve the performance of the model. In this case, different dimensions can be regarded as different tasks because they are all different ways of extracting information from content. Therefore, a model that can output multiple dimensions can improve the quality of the features of each dimension through multi-task learning.
[0158] Optionally, in this embodiment, the step of "performing feature extraction processing on the query result content in multiple preset dimensions to obtain result feature information of the query result content in each preset dimension" can include:
[0159] The query result content is subjected to feature extraction processing by the shared feature acquisition module to obtain feature information of the query result content.
[0160] The feature information of the query result content is linearly transformed by each linear transformation module to obtain result feature information of the query result content in each preset dimension.
[0161] The application provides a multi-granularity perception dense vector content retrieval method. In a specific scenario, the content retrieval is text retrieval, and a shared feature acquisition module can be unsupervised trained on a large corpus to learn rich language knowledge. Figure 1c As shown in the figure, a large amount of unlabeled general field text corpus can be collected first, and after data cleaning, filtering and text deduplication processing, a large-scale high-quality general text dataset is constructed. Then, a language model is pre-trained on the general text dataset, and the training task is to predict the masked words to restore and reconstruct the original text. The pre-trained language model (PLM) has learned the basic grammar and language structure and can better understand the meaning of each word in the context. Then, the pre-trained language model is used as a base model (i.e., the shared feature acquisition module in the above embodiment) to train a multi-dimensional output vector model (i.e., the content processing model in the above embodiment), which can output a vector representation of multiple dimensions to capture text information at different granularity levels. Finally, the trained content processing model can be used to retrieve related text in the inference stage.
[0162] Among them, the lower-dimensional vector representation can capture coarse-grained text information, and the higher-dimensional vector representation can capture finer-grained text information.
[0163] It should be noted that the base model is connected to multiple linear transformation modules to obtain the above-mentioned content processing model.
[0164] In the content processing method of the application, the shared feature acquisition module (i.e., the base model) can be trained by other devices and provided to the content processing device, or it can also be trained by the content processing device itself.
[0165] If it is trained by the content processing device itself, before the step of "performing feature extraction processing on the sample query content by the shared feature acquisition module to obtain feature information of the sample query content", it can also include:
[0166] Obtain a preset shared feature acquisition module and a plurality of sample contents, the sample contents comprising a plurality of content units;
[0167] Select at least one target content unit in the content units of the sample contents, and perform mask processing on the target content unit to obtain a masked sample content;
[0168] Perform feature extraction on the masked sample content by the preset shared feature acquisition module to obtain content features of the masked sample content;
[0169] based on the content features, performing prediction processing on the masked target content unit to obtain a predicted content unit;
[0170] based on the predicted content unit and the target content unit corresponding thereto, adjusting parameters in a preset shared feature acquisition module to obtain the shared feature acquisition module.
[0171] In some embodiments, a plurality of target content units can be randomly selected from the content units of the sample content for masking.
[0172] In some embodiments, the training process of the preset shared feature acquisition module can include the following steps: calculating a loss value of the predicted content unit and the target content unit corresponding thereto, adjusting the parameters of the preset shared feature acquisition module based on the loss value using a back propagation algorithm, optimizing the parameters of the preset shared feature acquisition module based on the loss value, and making the loss value less than a preset loss value to obtain the trained shared feature acquisition module.
[0173] Optionally, in the present embodiment, the step of "obtaining a preset shared feature acquisition module and a plurality of sample contents" can include the following steps:
[0174] obtaining a preset shared feature acquisition module and original training data, wherein the original training data includes a plurality of original sample contents;
[0175] performing a hash operation on each original sample content to obtain a hash value corresponding to each original sample content;
[0176] based on the hash value, performing a deduplication processing on the original sample contents in the original training data to obtain deduplicated sample contents.
[0177] In some embodiments, the original sample contents can be deduplicated through a hash operation to improve the quality of the training data. Specifically, a unique hash value of the original sample content can be calculated through a hash algorithm, and the hash value can be stored in a hash table. Then, the hash values of other original sample contents in the original training data can be calculated, and it can be detected whether the new hash value exists in the hash table. If the hash value exists in the hash table, the corresponding original sample content can be considered as a duplicate, and the corresponding original sample content can be deleted.
[0178] Hash Function is an encryption algorithm mainly used in the field of information security. Hash Function, also known as Hash function, is a function that converts an input of arbitrary length into a fixed length output through a hash algorithm. The output is a fixed length string, called hash value. Different input values correspond to different output values, and different output values correspond to different input values.
[0179] Optionally, in the embodiment, the step of "obtaining content features of the masked sample content through a preset shared feature acquisition module" can include:
[0180] performing attention encoding processing on the masked sample content through the preset shared feature acquisition module to obtain attention features of the masked sample content;
[0181] performing full connection processing and activation processing on the attention features to obtain processed features of the masked sample content;
[0182] performing normalization processing on the processed features to obtain the content features of the masked sample content.
[0183] The preset shared feature acquisition module can be a transformer model, which can be stacked by multiple identical transformer layers. Each transformer layer includes two sub-layers: multi-head self-attention mechanism and feed-forward neural network. In addition, each sub-layer is followed by a residual connection and layer normalization. The multi-head self-attention mechanism calculates the correlation between each content unit and other content units in the input content sequence, thereby capturing the long-distance dependency relationship in the content. The multi-head mechanism allows the transformer model to focus on information at different positions in the content sequence simultaneously. The feed-forward neural network is used to extract local features of the input sequence, which usually includes two fully connected layers and an activation function.
[0184] Optionally, in the embodiment, the step of "obtaining content features of the masked sample content through a preset shared feature acquisition module" can include:
[0185] extracting features of each content unit in the masked sample content through the preset shared feature acquisition module to obtain a content vector of each content unit in the masked sample content;
[0186] encoding position information of each content unit in the masked sample content, to obtain a position vector corresponding to each content unit;
[0187] fusing the content vector and the position vector to obtain feature information of each content unit in the masked sample content;
[0188] determining a content feature of the masked sample content based on the feature information of each content unit in the masked sample content.
[0189] If the content unit is a text unit, the content vector corresponding to the content unit can be a word vector of the text unit, and the text unit can be a word or a character. If the content unit is a video frame unit, the content vector corresponding to the content unit can be visual feature information of the video frame unit. If the content unit is an audio frame unit, the content vector corresponding to the content unit can be audio feature information of the audio frame unit.
[0190] The position vector of the content unit can represent the position of the content unit in the content sequence. If the content unit is a text unit, the position vector can specifically represent that the content unit is at the beginning of a sentence or at the end of a sentence. If the content unit is a video frame unit, the position vector can specifically represent that the video frame unit is at the beginning of a video clip or at the end of a video clip. If the content unit is an audio frame unit, the position vector can specifically represent that the audio frame unit is at the beginning of an audio or at the end of an audio.
[0191] The fusion of the content vector and the position vector can be in various ways, such as splicing processing, and the splicing order is not limited. For example, the fusion can be weighted fusion, and the weights corresponding to the content vector and the position vector are determined first, and then the fusion is performed according to the weights. Through the fusion processing, the feature information of the content unit can be obtained.
[0192] In the specific scenario of text retrieval, a large amount of unlabeled general text corpus can be collected first, and after data cleaning and filtering and text deduplication processing, a large-scale high-quality general text dataset is constructed. Then, a language model is pre-trained on the general text dataset, and the training task is to predict the masked words to recover and reconstruct the original text. The pre-trained language model has learned the basic grammar and language structure, and can better understand the meaning of each word in the context. Then, a vector model with multi-dimensional output is trained based on the pre-trained language model as a base model. The vector model can output vector representations in multiple dimensions, so as to capture text information at different granularity levels. Lower-dimensional vector representations can capture coarse-grained text information, and higher-dimensional vector representations can capture finer-grained text information.
[0193] In addition, when performing large-scale text retrieval in the inference stage, the low-dimensional vector is used in the recall stage of large-scale text retrieval, and the high-dimensional vector is used in the sorting stage of the initial matching text, which can realize efficient and accurate text retrieval. This process takes advantage of the respective advantages of low-dimensional vectors and high-dimensional vectors, achieving a balance between efficiency and accuracy in large-scale text retrieval. Low-dimensional vectors are used for fast screening of large-scale text data, and high-dimensional vectors are used for accurate matching of small-scale text data. This ensures both fast response of large-scale text retrieval and accuracy of the search results. This method has good flexibility and can adjust the vector dimension according to actual needs and computing resource limitations. This method better and more efficiently utilizes resources, reducing storage space and computing resource consumption in the recall stage.
[0194] As can be seen from the above, the embodiment can obtain a target content to be processed and a plurality of candidate contents; perform first-dimensional feature extraction processing on the target content to obtain content feature information of the target content in the first dimension; based on the content feature information of the target content in the first dimension, recall a plurality of initial matching contents corresponding to the target content from the plurality of candidate contents; perform second-dimensional feature extraction processing on the target content to obtain content feature information of the target content in the second dimension, the second dimension being greater than the first dimension; based on the content feature information of the target content in the second dimension, determine at least one target matching content corresponding to the target content from the plurality of initial matching contents; and output the at least one target matching content corresponding to the target content.
[0195] The present application can perform feature extraction of different dimensions on the target content, first recall the initial matching content through the coarse-grained first-dimensional feature information, and then determine the target matching content corresponding to the target content from the initial matching content based on the fine-grained second-dimensional feature information. This two-stage, grain-size-based content retrieval method takes advantage of the respective advantages of low-dimensional features and high-dimensional features, with low-dimensional features used for fast screening of large-scale content data and high-dimensional features used for accurate matching of small-scale content data. This achieves a balance between efficiency and accuracy in large-scale content retrieval, which is beneficial to improving the efficiency and accuracy of content retrieval, ensuring both fast response of large-scale content retrieval and accuracy of the search results.
[0196] According to the method described in the foregoing embodiments, the following will be further described in detail with the content processing device specifically integrated in a server as an example.
[0197] The content processing method provided by the embodiments of the present application involves machine learning and natural language processing technologies of artificial intelligence, which is specifically described as follows:
[0198] (a) Training the content processing model can be done as follows:
[0199] (1) Training of the base model.
[0200] In this embodiment, the content processing model may include a shared feature acquisition module and multiple linear transformation modules, each corresponding to a preset dimension; the shared feature acquisition module is the base model of the content processing model.
[0201] In specific text retrieval scenarios, we can first collect general domain text corpora, and then train a base model based on large-scale unlabeled text corpus data.
[0202] Specifically, a large amount of unlabeled and unannotated Chinese text data can be collected from the public internet. This text data can include news articles, online texts, etc., and the data should cover as many fields as possible, such as news, novels, articles, comments, and reviews. It is necessary to ensure that the data is diverse and covers a wide range of fields so that the pre-trained language model has strong generalization ability.
[0203] Collecting general text data can be done in two ways. First, existing public text datasets, such as encyclopedia data and news corpora, can be used. These datasets are usually processed to some extent and can be directly used to train models. Second, text data can be scraped from various websites (such as news websites and forums) using web crawlers.
[0204] After collecting the text data, preprocessing and data cleaning are necessary to improve data quality. The preprocessing and data cleaning steps include:
[0205] (1) Remove special characters and tags: Clean the collected text data to remove irrelevant content such as HTML (HyperText Markup Language) tags, JavaScript code, and special symbols, and keep the plain text;
[0206] (2) Unified encoding method: Unify the text data into a single character encoding (such as UTF-8) to avoid garbled characters during processing;
[0207] (3) Remove low-quality text: Identify and remove text containing too many errors, meaningless or repetitive texts to ensure the quality of training text corpus data.
[0208] After data cleaning and filtering, text deduplication is also needed to identify and remove duplicate or highly similar texts from the massive amount of general text data collected, in order to reduce redundant information and improve data quality. Specifically, a hash deduplication algorithm can be used for text deduplication. First, a unique hash value is calculated for each text using a hash algorithm. The hash value is stored in a hash table. When the hash value of a new text already exists in the hash table, it is considered to be a duplicate and the duplicate text is deleted.
[0209] In general, a large amount of unlabeled and unannotated general Chinese text corpus data can be collected, and data cleaning, filtering and text deduplication can be performed to obtain a large amount of high-quality Chinese text dataset for subsequent model pre-training.
[0210] A language model is pre-trained on the constructed large-scale unlabeled Chinese text corpus dataset. The language model adopts a transformer model structure, which has strong modeling capability, good scalability, and can be well parallel computed. As shown in Figure 2a the structure diagram of the pre-trained language model, the language model is stacked by multiple identical transformer layers, each transformer layer contains two sub-layers: multi-head self-attention mechanism and feed-forward neural network. In addition, each sub-layer is followed by a residual connection and layer normalization. The multi-head self-attention mechanism calculates the correlation between each word and other words in the input sequence, thereby capturing the long-distance dependency relationship in the sentence. The multi-head mechanism allows the transformer model to simultaneously focus on the information at different positions in the text sequence. The feed-forward neural network is used to extract local features of the input sequence, usually containing two fully connected layers and an activation function.
[0211] The language model adopts a bidirectional attention mechanism, which can simultaneously consider and focus on the context information of each word in the text sequence when encoding the input text and outputting a low-dimensional dense vector. The bidirectional attention mechanism enables the language model to better capture semantic information in the context when encoding and understanding the input text. In the language model, the representation of each word is calculated based on the entire input text sequence, which enables the language model to better understand the meaning of each word in the context.
[0212] A language model is pre-trained on a large-scale, unlabeled, general Chinese text corpus. The training objective of the pre-trained language model is a masked language model (MLM). A masked language model refers to masking a certain proportion of words in a sentence, and the trained model predicts and recovers these masked words based on the other words in the sentence.
[0213] The purpose of the pre-training phase is to enable the language model to learn basic grammar, syntax, and semantics of natural language, as well as general domain background knowledge, from massive amounts of unlabeled text corpora. This gives the model strong versatility and generalization ability, providing a powerful foundation model (the pre-trained language model) for further training. By pre-training the masked language model on large-scale general text, the language model can learn rich grammatical knowledge and semantic representations of the language, providing a powerful pre-training foundation for subsequent model training.
[0214] When inputting text data into a language model, preprocessing of the general text data is necessary to transform it into a form acceptable to the language model. First, a special symbol "cls" is added to the beginning of the text to indicate the start of a sentence, and a special symbol "sep" is added to the end of the text to indicate the end of a sentence. Next, the text is segmented and indexed. During the pre-training phase of the masked language model, noise is added to the input text X to obtain perturbed text. The specific process for obtaining the perturbed text involves randomly replacing a small subset of words in the input text (e.g., 20%–30% of the mask ratio) with a special character "mask," while leaving the other words unchanged. This perturbation process... As input to the language model, positional encoding needs to be added to the input data so that the transformer model can learn the positional information of words in a sentence. The training task of the language model is to predict these masked words, thereby recovering and reconstructing the perturbed text.
[0215] For example, refer to Figure 2a The sentence contains six content units: x0, x1, x2, x3, x4, and x5. We can mask x2 and x4, and then input the masked sentence into the language model. The language model will predict x2 and x4, and then perform cross-entropy loss calculation on the predicted and true values of x2 and x4. The parameters in the language model will be adjusted based on the loss value.
[0216] In one specific embodiment, the original text is "Apple cider vinegar may help lower blood sugar levels in diabetic patients by altering how food is absorbed from the intestines," then the above X and They can be:
[0217] X = ['cls','apple','fruit','vinegar','may','help','lower','blood','glucose','level'' by','changing','the'way''food','is''absorbed'''from','in','the'intestinal','.','sep']
[0218]
[0219]
[0220] In the pre-training stage of the language model, the cross-entropy loss function is used to measure the difference between the predicted words and the actual words. The parameters of the language model can be updated by minimizing this loss function, L. MLM As shown in equation (3):
[0221]
[0222] Where M represents the masked word, x i Represents a text unit.
[0223] A language model with a pre-trained transformer architecture is built on massive (tens of billions) general-purpose text corpora. Thanks to the large volume of unlabeled and unannotated general-purpose text data, the pre-trained language model has already learned basic grammar and language structure, and can better understand the meaning of each word in context.
[0224] (2) Use contrastive learning to train the content processing model.
[0225] The content processing model is specifically a multi-dimensional output vector model capable of perceiving multi-granular features. The training scheme for the content processing model provided by the content processing method in this application may include:
[0226] Acquire training data, which includes multiple sample query contents and multiple query result contents corresponding to the sample query contents. The label information of the query result contents represents the expected matching degree between the query result contents and the sample query contents.
[0227] Using a content processing model, feature extraction processing is performed on the sample query content under multiple preset dimensions to obtain the query feature information of the sample query content under each preset dimension.
[0228] The query results are subjected to feature extraction processing under multiple preset dimensions to obtain the result feature information of the query results under each preset dimension.
[0229] For each preset dimension, the matching degree is calculated for the query feature information of the sample query content under the preset dimension and the result feature information of the query result content under the preset dimension, so as to obtain the matching degree of the sample query content and the query result content under the preset dimension;
[0230] Based on the matching degree between the sample query content and the query result content under various preset dimensions, the parameters of the content processing model are adjusted to obtain the trained content processing model.
[0231] Optionally, in this embodiment, the query result content corresponding to the sample query content includes negative sample result content and positive sample result content; the step "adjusting the parameters of the content processing model according to the matching degree of the sample query content and the query result content in each preset dimension to obtain the trained content processing model" may include:
[0232] For each preset dimension, sub-loss information under the preset dimension is calculated based on the matching degree between the sample query content and the negative sample result content under the preset dimension, and the matching degree between the sample query content and the positive sample result content under the preset dimension.
[0233] The sub-loss information under each preset dimension is fused to obtain the total loss information;
[0234] Based on the total loss information, the parameters of the content processing model are adjusted to obtain the trained content processing model.
[0235] Optionally, in this embodiment, the content processing model includes a shared feature acquisition module and multiple linear transformation modules, each linear transformation module corresponding to a preset dimension;
[0236] The step "using a content processing model to perform feature extraction processing on the sample query content under multiple preset dimensions to obtain query feature information of the sample query content under each preset dimension" may include:
[0237] The shared feature acquisition module performs feature extraction processing on the sample query content to obtain the feature information of the sample query content.
[0238] Through various linear transformation modules, the feature information of the sample query content is linearly transformed to obtain the query feature information of the sample query content under each preset dimension.
[0239] The linear transformation module can be used to perform linear transformation processing on the feature information output by the shared feature acquisition module with a corresponding preset dimension. In this embodiment, the features output by the content processing model are not fixed-dimensional, enabling multi-granularity perception from coarse to fine granular, and obtaining features of multiple dimensions. This application only needs to train a multi-dimensional output content processing model, which significantly saves computing resources and improves training efficiency.
[0240] Furthermore, in the multi-dimensional output content processing model of this application, features of all dimensions are generated by the same model, and the model parameters are shared among the output features of different dimensions; thus, knowledge learned by the model in one dimension can be utilized in other dimensions. Specifically, when there is a certain correlation between multiple tasks, learning these tasks simultaneously can improve the model's performance. In this case, different dimensions can be regarded as different tasks because they are all different ways of extracting information from content. Therefore, a model that can output multiple dimensions can improve the quality of features in each dimension through multi-task learning.
[0241] In specific text retrieval scenarios, the pre-trained language model mentioned above can be used as a base model to train the vector model. Training the vector model based on the pre-trained language model has significant advantages. Firstly, the pre-trained language model, trained on large-scale unlabeled text corpora, has already learned basic grammar and language structure, and can capture rich syntactic and semantic information. The vector model based on the pre-trained language model can model and capture complex semantic relationships between words, phrases, and sentences, exhibiting strong text representation capabilities. Secondly, the pre-trained language model is trained on a large number of language samples and text corpora from different domains. The vector model based on the pre-trained language model has good generalization ability, good robustness in handling imbalanced data, and good performance in modeling text vector representations for different domains and tasks, without requiring a large amount of task-specific training data.
[0242] like Figure 2b The diagram shows the structure of a multi-dimensional output vector model. This model can include a base model and multiple linear layers. Through these linear layers, the vector model can output vector representations in multiple dimensions, thereby capturing text information at different granular levels. Lower-dimensional vector representations can capture coarse-grained text information, while higher-dimensional vector representations can capture finer-grained text information.
[0243] Specifically, this application proposes training a vector model with multi-dimensional output, which can output vector representations of multiple dimensions to encode vector representations from coarse-grained to fine-grained. The multi-dimensional output vector model learns a set of vector dimensions D = {d1, d2, ..., d...}. k}, different vector dimensions d m Vector representations can capture textual information at different granularities. For example, learning a set of vector dimensions:
[0244] D={d1, d2,···,d8}={32, 64, 128, 256, 512, 1024, 2048, 4096}.
[0245] This embodiment employs contrastive learning to train the vector model. Contrastive learning refers to identifying and distinguishing relevant positive sample text from other unrelated negative sample text. Positive sample pairs are similar or related data pairs, while negative sample pairs are dissimilar or unrelated data pairs. The basic idea of contrastive learning is to bring similar and related samples closer together (positive samples) and push dissimilar and unrelated samples further apart (negative samples).
[0246] When training the vector model using contrastive learning as the training objective, T2Ranking and the mMARCO dataset (with hundreds of thousands of samples) are used for training. These datasets are manually labeled, and each query text has multiple high-quality negative sample document texts. Each training data point for contrastive learning is a triple: (query text, positive sample document text, list of negative sample document texts). Each query text corresponds to one positive sample document text (positive sample passage) and multiple negative sample document texts (negative sample passages). A sample training data point is given below:
[0247] query: foods that help lower blood sugar
[0248] Positive sample passage: Lemons are rich in vitamin C, and their acidity helps lower the glycemic index of other foods.
[0249] List of negative sample passages:
[0250] Negative Sample 1: Glycemic Index (GI) of 20 or lower. Foods without carbohydrates, including meat, eggs, and fish, have no GI ranking and will not have a significant impact on your blood sugar levels.
[0251] Negative Sample 2: Weight loss can be achieved through a high-fiber diet consisting of a variety of fruits, vegetables, proteins, and whole grains.
[0252] Negative Sample 3: The notes on the foods you eat will show how these foods affect your blood sugar levels and can help your doctor determine the best treatment for you.
[0253] Specifically, given a training dataset containing many triples For the i-th training data, q i This represents the query text. This represents the corresponding positive sample document text (passage). This represents l negative sample document texts (passages).
[0254] Before inputting text data into the vector model, the query text and document text need to be preprocessed to convert the text data into a form acceptable to the vector model. First, a special symbol "cls" is added to the beginning of the query text to indicate the start of a sentence. Then, the query text is segmented and indexed to obtain the query text q = {cls, x0, x1, ..., x...}. l}, which is used as the input to the vector model, x0, x1, ..., x l These represent text units within the query text. A set of 8 vector dimensions is learned.
[0255] When D = {d1, d2, ..., d8} = {32, 64, 128, 256, 512, 1024, 2048, 4096}, eight linear layers are appended after the last transformer layer of the pre-trained language model, each corresponding to a vector dimension. The output vector h ∈ R of the last transformer layer corresponding to the starting character "cls" is then used. d (d represents the dimension of the output vector of the last transformer layer, for example, 1024 dimensions) These are fed into 8 different linear layers to obtain query vector representations of the query text in 8 different vector dimensions. Among them, W m Here are the weight matrix parameters for the m-th linear layer. The weight matrix parameters for the 8 linear layers are... The calculation methods for the query vector representations (i.e., content feature information) of the eight different vector dimensions are as follows:
[0256]
[0257] Among them, b1, b2, ..., b8 are bias terms.
[0258] Similarly, for document text, a special symbol "cls" can be added to the beginning of the document text to indicate the start of a sentence. Then, the document text is segmented and indexed to obtain the query text p = {cls, y0}. , y1, ..., y k}, and use it as input to the transformer model. The starting character "cls" corresponds to the output vector h∈R of the last transformer layer. dThe data are fed into eight different linear layers to obtain document vector representations of the document text with eight different vector dimensions. The calculation methods for document vector representations (feature information) with 8 different vector dimensions are as follows:
[0259]
[0260] Among them, b1, b2, ..., b8 are bias terms.
[0261] This yields eight sets of query vectors and document vectors with different vector dimensions. We learned about vector representations from coarse-grained to fine-grained. As the vector dimension increases, the query vector and document vector contain richer information. We can calculate the cosine similarity between query vectors and document vectors of different dimensions to measure the relevance between the query text and the document text. For the m-th group of vectors with dimension d... m Query vectors and document vectors Calculate the cosine similarity s between the two vectors. w (p, q), the cosine similarity is the matching degree mentioned in the above embodiment, and its calculation process is shown in formula (4):
[0262]
[0263] Where τ is the temperature coefficient used for scaling.
[0264] This yields eight cosine similarity scores: {s1(q, p), s2(q, p), ..., s8(q, p)}. For the m-th vector group with dimension d... m Query vectors and document vectors The loss function for contrastive learning can be expressed as shown in equation (1) above. This loss function is calculated for each vector dimension d. m Loss function L for contrastive learning m Then, it can be based on each vector dimension d m Loss function L for contrastive learning m Calculate the total loss information and adjust the parameters of the vector model based on the total loss information.
[0265] (ii) The target content is retrieved using the trained content processing model.
[0266] like Figure 2c As shown, a content processing method can be described in the following steps:
[0267] 201. The server obtains the target content to be processed and multiple candidate contents.
[0268] The content modality of the target content and candidate content is not limited. For example, the target content or candidate content can be text, audio, image, or video. Specifically, the target content and candidate content can be unimodal, such as plain text, or multimodal, such as a combination of text and images.
[0269] 202. The server performs feature extraction processing on the target content to obtain the feature information of the target content.
[0270] In this process, the shared feature acquisition module in the content processing model can be used to extract features from the target content and obtain the feature information of the target content.
[0271] 203. The server performs a linear transformation on the feature information of the target content in the first dimension to obtain the content feature information of the target content in the first dimension.
[0272] The first dimension can be determined based on the actual situation. Here, the dimension specifically refers to the dimension of the feature, that is, the vector dimension of the feature vector.
[0273] In this embodiment, the feature information of the target content can be linearly transformed in the first dimension by the linear transformation module corresponding to the first dimension in the content processing model to obtain the content feature information of the target content in the first dimension.
[0274] Optionally, in this embodiment, the step "performing a linear transformation of the feature information of the target content in the first dimension to obtain the content feature information of the target content in the first dimension" may include:
[0275] Determine multiple preset first dimensions, where each preset first dimension is smaller than the second dimension;
[0276] Based on the current computing resources, a first dimension is selected from the plurality of preset first dimensions;
[0277] The feature information of the target content is subjected to a linear transformation in the first dimension to obtain the content feature information of the target content in the first dimension.
[0278] Specifically, the first dimension can be flexibly adjusted based on the current computing resources. There are multiple computing resource levels and mapping relationships between each computing resource level and each preset first dimension, with each computing resource level corresponding to a computing resource range. In this embodiment, the target computing resource level of the current computing resources can be determined first, and then the first dimension can be selected from multiple preset first dimensions based on the target computing resource level.
[0279] 204. Based on the content feature information of the target content in the first dimension, the server recalls multiple initial matching contents corresponding to the target content from the multiple candidate contents.
[0280] Optionally, in this embodiment, the step "based on the content feature information of the target content in the first dimension, recalling multiple initial matching contents corresponding to the target content from the multiple candidate contents" may include:
[0281] Each candidate content is subjected to feature extraction processing in the first dimension to obtain the first feature information of each candidate content in the first dimension.
[0282] Calculate the matching degree between the content feature information of the target content in the first dimension and the first feature information of each candidate content in the first dimension;
[0283] Based on the matching degree, multiple initial matching contents corresponding to the target content are recalled from the multiple candidate contents.
[0284] Using low-dimensional features in the recall stage of large-scale content retrieval can improve the efficiency of large-scale content retrieval.
[0285] 205. The server performs a second-dimensional linear transformation on the feature information of the target content to obtain the content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension.
[0286] The content feature information of the target content in the first dimension and the content feature information in the second dimension are correlated to a certain extent. Both are obtained by linear transformation based on the previously extracted feature information. In this embodiment, the feature information is extracted by the shared feature acquisition module of the content processing model. The shared feature acquisition module learns from the features of the sample content in multiple dimensions and contains knowledge of multiple dimensions. Therefore, the extracted feature information of the target content has stronger semantic meaning.
[0287] The content processing model can include multiple linear transformation modules, each corresponding to a different dimension. The content feature information of the target content in the first dimension can be obtained by performing a linear transformation on the feature information of the target content using the corresponding linear transformation module. Similarly, the content feature information of the target content in the second dimension can be obtained by performing a linear transformation on the feature information of the target content using the corresponding linear transformation module.
[0288] 206. Based on the content feature information of the target content in the second dimension, the server determines at least one target matching content corresponding to the target content from the plurality of initial matching contents.
[0289] Optionally, in this embodiment, the step "determining at least one target matching content corresponding to the target content from the plurality of initial matching contents based on the content feature information of the target content in the second dimension" may include:
[0290] The second dimension feature extraction process is performed on each initial matching content to obtain the second feature information of each initial matching content in the second dimension.
[0291] Calculate the matching degree between the content feature information of the target content in the second dimension and the second feature information of each initial matching content in the second dimension;
[0292] Based on the matching degree, at least one target matching content corresponding to the target content is determined from the plurality of initial matching contents.
[0293] Using high-dimensional features for precise matching of small-scale content data can improve the accuracy of content retrieval.
[0294] 207. The server outputs at least one target matching content corresponding to the target content to the terminal.
[0295] The content processing model, also known as the multi-dimensional output vector model, learns vector representations from coarse-grained to fine-grained. As the vector dimension increases, the higher-dimensional vector representation contains richer information, resulting in better retrieval performance and higher accuracy.
[0296] In specific text retrieval scenarios, after training a vector model that can output multiple vector dimensions, the low-dimensional vectors are used for the recall phase of large-scale text retrieval, while the high-dimensional vectors are used for the ranking phase of the initial matched text. This approach enables efficient and accurate text retrieval. The recall and ranking phases are explained in detail below:
[0297] During the recall phase, an index can be built first, pre-encoding each text in the document library into a low-dimensional vector representation using a multi-dimensional output vector model; then, these low-dimensional vectors are stored in a vector index. When a new query request arrives, the query text is first encoded into a vector representation of the same low dimension using the multi-dimensional output vector model. Then, the top k (e.g., the top 100) document vectors most similar to this vector are searched in the vector index. This step can quickly filter out the initial matching documents.
[0298] In the ranking phase, the initial matching documents are first encoded using a multi-dimensional output vector model to encode the initial matching documents obtained in the recall phase into high-dimensional vector representations. These vectors typically do not require further indexing because the number of initial matching documents is relatively small. Then, the query text is encoded into the same high-dimensional query vector representation using the multi-dimensional output vector model, and a cosine similarity score is calculated between the query text and the initial matching document vectors to obtain a more accurate similarity score. The initial matching documents are then ranked based on these scores. The goal of the ranking phase is to find the most relevant documents among the initial matching documents.
[0299] This process leverages the strengths of both low-dimensional and high-dimensional vectors to achieve a balance between efficiency and accuracy in large-scale text retrieval. Low-dimensional vectors are used for fast filtering of large-scale text data, while high-dimensional vectors are used for precise matching of small-scale text data.
[0300] The content processing method provided in this application can flexibly adjust the vector dimension according to actual needs and computational resource limitations. For example, when computational resources are sufficient, the vector dimension in the recall stage can be increased to improve retrieval accuracy; when computational resources are limited, the vector dimension in the recall stage can be reduced to improve retrieval speed.
[0301] Furthermore, during the recall phase, using low-dimensional vectors can reduce storage space and computational resource consumption, thus facilitating better resource utilization. In the ranking phase, since the initial number of matched texts is relatively small, the computational burden of using high-dimensional vectors for precise matching is acceptable.
[0302] Furthermore, by using low-dimensional vectors for the recall stage and high-dimensional vectors for the ranking stage, a balance between computational efficiency and retrieval accuracy is achieved. This ensures both rapid response in large-scale text retrieval and accurate search results.
[0303] In summary, using a vector model that can output multiple vector dimensions for text retrieval, first using low-dimensional vectors to recall multiple initial matching texts, and then using high-dimensional vectors to sort the initial matching texts, can achieve efficient and accurate text retrieval, while making full use of computing resources and having good flexibility and scalability.
[0304] As can be seen from the above, this embodiment can obtain the target content to be processed and multiple candidate contents through a server; perform feature extraction processing on the target content to obtain the features of the target content; perform linear transformation processing on the feature information of the target content in a first dimension to obtain the content feature information of the target content in the first dimension; based on the content feature information of the target content in the first dimension, recall multiple initial matching contents corresponding to the target content from the multiple candidate contents; perform linear transformation processing on the feature information of the target content in a second dimension to obtain the content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension; based on the content feature information of the target content in the second dimension, determine at least one target matching content corresponding to the target content from the multiple initial matching contents; and output at least one target matching content corresponding to the target content to the terminal.
[0305] This application can extract features from target content in different dimensions. First, it recalls initial matching content using coarse-grained first-dimensional feature information. Then, it determines the target matching content corresponding to the target content from the initial matching content based on fine-grained second-dimensional feature information. This two-stage, granular content retrieval method utilizes the advantages of both low-dimensional and high-dimensional features. Low-dimensional features are used for fast filtering of large-scale content data, while high-dimensional features are used for precise matching of small-scale content data. This achieves a balance between efficiency and accuracy in large-scale content retrieval, which is beneficial for improving the efficiency and accuracy of content retrieval. It ensures both rapid response in large-scale content retrieval and accuracy of retrieval results.
[0306] To better implement the above methods, embodiments of this application also provide a content processing apparatus, such as... Figure 3 As shown, the content processing device may include an acquisition unit 301, a first extraction unit 302, a recall unit 303, a second extraction unit 304, a determination unit 305, and an output unit 306, as follows:
[0307] (1) Obtain unit 301;
[0308] The acquisition unit is used to acquire the target content to be processed and multiple candidate contents.
[0309] (2) First extraction unit 302;
[0310] The first extraction unit is used to perform feature extraction processing on the target content in the first dimension to obtain the content feature information of the target content in the first dimension.
[0311] Optionally, in some embodiments of this application, the first extraction unit may include a dimension determination subunit, a dimension selection subunit, and a feature extraction subunit, as follows:
[0312] The dimension determining subunit is used to determine multiple preset first dimensions, each preset first dimension being smaller than the second dimension;
[0313] The dimension selection subunit is used to select a first dimension from the plurality of preset first dimensions based on the current computing resources;
[0314] The feature extraction subunit is used to perform feature extraction processing on the target content in the first dimension to obtain the content feature information of the target content in the first dimension.
[0315] (3) Recall Unit 303;
[0316] The recall unit is used to recall multiple initial matching contents corresponding to the target content from the multiple candidate contents based on the content feature information of the target content in the first dimension.
[0317] Optionally, in some embodiments of this application, the recall unit may include a first extraction subunit, a first calculation subunit, and a recall subunit, as follows:
[0318] The first extraction subunit is used to perform feature extraction processing on each candidate content in the first dimension to obtain the first feature information of each candidate content in the first dimension;
[0319] The first calculation subunit is used to calculate the matching degree between the content feature information of the target content in the first dimension and the first feature information of each candidate content in the first dimension;
[0320] The recall subunit is used to recall multiple initial matching contents corresponding to the target content from the multiple candidate contents based on the matching degree.
[0321] (4) Second extraction unit 304;
[0322] The second extraction unit is used to perform second-dimensional feature extraction processing on the target content to obtain the content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension.
[0323] Optionally, in some embodiments of this application, the first extraction unit may include an extraction subunit and a transformation subunit, as follows:
[0324] The extraction subunit is used to perform feature extraction processing on the target content to obtain the feature information of the target content;
[0325] The transformation subunit is used to perform a linear transformation on the feature information of the target content in the first dimension to obtain the content feature information of the target content in the first dimension.
[0326] The second extraction unit can be used to perform a second-dimensional linear transformation on the feature information of the target content to obtain the content feature information of the target content in the second dimension.
[0327] Optionally, in some embodiments of this application, the first extraction unit may be specifically used to perform feature extraction processing on the target content in the first dimension through a content processing model to obtain content feature information of the target content in the first dimension;
[0328] The second extraction unit can be used to perform second-dimensional feature extraction processing on the target content through the content processing model to obtain the content feature information of the target content in the second dimension.
[0329] (5) Determine unit 305;
[0330] The determining unit is used to determine at least one target matching content corresponding to the target content from the plurality of initial matching contents based on the content feature information of the target content in the second dimension.
[0331] Optionally, in some embodiments of this application, the determining unit may include a second extraction subunit, a second calculation subunit, and a determining subunit, as follows:
[0332] The second extraction subunit is used to perform second-dimensional feature extraction processing on each initial matching content to obtain the second feature information of each initial matching content in the second dimension;
[0333] The second calculation subunit is used to calculate the matching degree between the content feature information of the target content in the second dimension and the second feature information of each initial matching content in the second dimension.
[0334] A determining subunit is configured to determine at least one target matching content corresponding to the target content from the plurality of initial matching contents based on the matching degree.
[0335] (6) Output unit 306;
[0336] The output unit is used to output at least one target matching content corresponding to the target content.
[0337] Optionally, in some embodiments of this application, the content processing device may further include a training data acquisition unit, a query feature extraction unit, a structural feature extraction unit, a matching calculation unit, and a parameter adjustment unit, as follows:
[0338] The training data acquisition unit is used to acquire training data, which includes multiple sample query contents and multiple query result contents corresponding to the sample query contents. The tag information of the query result contents represents the expected matching degree between the query result contents and the sample query contents.
[0339] The query feature extraction unit is used to perform feature extraction processing on the sample query content under multiple preset dimensions through the content processing model, so as to obtain the query feature information of the sample query content under each preset dimension.
[0340] The structural feature extraction unit is used to perform feature extraction processing on the query result content under multiple preset dimensions to obtain the result feature information of the query result content under each preset dimension.
[0341] The matching calculation unit is used to calculate the matching degree of the sample query content under the preset dimension and the result feature information of the query result content under the preset dimension for each preset dimension, so as to obtain the matching degree of the sample query content and the query result content under the preset dimension.
[0342] The parameter adjustment unit is used to adjust the parameters of the content processing model according to the matching degree of the sample query content and the query result content under various preset dimensions, so as to obtain the trained content processing model.
[0343] Optionally, in some embodiments of this application, the query result content corresponding to the sample query content includes negative sample result content and positive sample result content;
[0344] The parameter adjustment unit may include a loss calculation subunit, a loss fusion subunit, and a parameter adjustment subunit, as follows:
[0345] The loss calculation subunit is used to calculate sub-loss information for each preset dimension based on the matching degree between the sample query content and the negative sample result content in the preset dimension, and the matching degree between the sample query content and the positive sample result content in the preset dimension.
[0346] The loss fusion subunit is used to fuse the sub-loss information under each preset dimension to obtain the total loss information;
[0347] The parameter adjustment subunit is used to adjust the parameters of the content processing model based on the total loss information to obtain the trained content processing model.
[0348] Optionally, in some embodiments of this application, the content processing model includes a shared feature acquisition module and multiple linear transformation modules, each linear transformation module corresponding to a preset dimension;
[0349] The query feature extraction unit may include a query feature extraction subunit and a linear transformation subunit, as follows:
[0350] The query feature extraction subunit is used to perform feature extraction processing on the sample query content through the shared feature acquisition module to obtain the feature information of the sample query content;
[0351] The linear transformation subunit is used to perform linear transformation processing on the feature information of the sample query content through various linear transformation modules to obtain the query feature information of the sample query content under each preset dimension.
[0352] Optionally, in some embodiments of this application, the content processing apparatus may further include a pre-training unit for training the shared feature acquisition module; the pre-training unit may include an acquisition sub-unit, a masking sub-unit, a content feature extraction sub-unit, a prediction sub-unit, and a module parameter adjustment sub-unit, as follows:
[0353] The acquisition subunit is used to acquire a preset shared feature acquisition module and multiple sample contents, wherein the sample contents include multiple content units;
[0354] A masking subunit is used to select at least one target content unit from the content units of the sample content, perform masking processing on the target content unit, and obtain masked sample content.
[0355] The content feature extraction subunit is used to extract features from the masked sample content through a preset shared feature acquisition module to obtain the content features of the masked sample content.
[0356] The prediction subunit is used to perform prediction processing on the masked target content unit based on the content features to obtain the predicted content unit;
[0357] The module parameter adjustment subunit is used to adjust the parameters in the preset shared feature acquisition module based on the predicted content unit and its corresponding target content unit, so as to obtain the shared feature acquisition module.
[0358] Optionally, in some embodiments of this application, the acquisition subunit may be specifically used to acquire a preset shared feature acquisition module and original training data, wherein the original training data includes multiple original sample contents; perform a hash operation on each original sample content to obtain a hash value corresponding to each original sample content; and perform deduplication processing on the original sample contents in the original training data based on the hash value to obtain deduplicated sample contents.
[0359] Optionally, in some embodiments of this application, the content feature extraction subunit may be specifically used to perform attention encoding processing on the masked sample content through a preset shared feature acquisition module to obtain the attention features of the masked sample content; perform fully connected processing and activation processing on the attention features to obtain the processed features of the masked sample content; and perform normalization processing on the processed features to obtain the content features of the masked sample content.
[0360] As can be seen from the above, in this embodiment, the acquisition unit 301 acquires the target content to be processed and multiple candidate contents; the first extraction unit 302 performs feature extraction processing on the target content in the first dimension to obtain the content feature information of the target content in the first dimension; the recall unit 303 recalls multiple initial matching contents corresponding to the target content from the multiple candidate contents based on the content feature information of the target content in the first dimension; the second extraction unit 304 performs feature extraction processing on the target content in the second dimension to obtain the content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension; the determination unit 305 determines at least one target matching content corresponding to the target content from the multiple initial matching contents based on the content feature information of the target content in the second dimension; and the output unit 306 outputs at least one target matching content corresponding to the target content.
[0361] This application can extract features from target content in different dimensions. First, it recalls initial matching content using coarse-grained first-dimensional feature information. Then, it determines the target matching content corresponding to the target content from the initial matching content based on fine-grained second-dimensional feature information. This two-stage, granular content retrieval method utilizes the advantages of both low-dimensional and high-dimensional features. Low-dimensional features are used for fast filtering of large-scale content data, while high-dimensional features are used for precise matching of small-scale content data. This achieves a balance between efficiency and accuracy in large-scale content retrieval, which is beneficial for improving the efficiency and accuracy of content retrieval. It ensures both rapid response in large-scale content retrieval and accuracy of retrieval results.
[0362] This application also provides an electronic device, such as... Figure 4The diagram shows a structural schematic of an electronic device involved in an embodiment of this application. This electronic device can be a terminal or a server, specifically:
[0363] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0364] The processor 401 is the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes software programs and / or modules stored in the memory 402, and calls data stored in the memory 402, to perform various functions and process data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.
[0365] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0366] The electronic device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0367] The electronic device may also include an input unit 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0368] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:
[0369] The process involves: acquiring the target content to be processed and multiple candidate content; performing feature extraction processing on the target content in a first dimension to obtain content feature information of the target content in the first dimension; based on the content feature information of the target content in the first dimension, recalling multiple initial matching content corresponding to the target content from the multiple candidate content; performing feature extraction processing on the target content in a second dimension to obtain content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension; based on the content feature information of the target content in the second dimension, determining at least one target matching content corresponding to the target content from the multiple initial matching content; and outputting at least one target matching content corresponding to the target content.
[0370] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0371] As can be seen from the above, this embodiment can obtain the target content to be processed and multiple candidate contents; perform feature extraction processing on the target content in the first dimension to obtain the content feature information of the target content in the first dimension; based on the content feature information of the target content in the first dimension, recall multiple initial matching contents corresponding to the target content from the multiple candidate contents; perform feature extraction processing on the target content in the second dimension to obtain the content feature information of the target content in the second dimension, wherein the second dimension is greater than the first dimension; based on the content feature information of the target content in the second dimension, determine at least one target matching content corresponding to the target content from the multiple initial matching contents; and output at least one target matching content corresponding to the target content.
[0372] This application can extract features from target content in different dimensions. First, it recalls initial matching content using coarse-grained first-dimensional feature information. Then, it determines the target matching content corresponding to the target content from the initial matching content based on fine-grained second-dimensional feature information. This two-stage, granular content retrieval method utilizes the advantages of both low-dimensional and high-dimensional features. Low-dimensional features are used for fast filtering of large-scale content data, while high-dimensional features are used for precise matching of small-scale content data. This achieves a balance between efficiency and accuracy in large-scale content retrieval, which is beneficial for improving the efficiency and accuracy of content retrieval. It ensures both rapid response in large-scale content retrieval and accuracy of retrieval results.
[0373] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0374] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the content processing methods provided in embodiments of this application. For example, the instructions can execute the following steps:
[0375] The process involves: acquiring the target content to be processed and multiple candidate content; performing feature extraction processing on the target content in a first dimension to obtain content feature information of the target content in the first dimension; based on the content feature information of the target content in the first dimension, recalling multiple initial matching content corresponding to the target content from the multiple candidate content; performing feature extraction processing on the target content in a second dimension to obtain content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension; based on the content feature information of the target content in the second dimension, determining at least one target matching content corresponding to the target content from the multiple initial matching content; and outputting at least one target matching content corresponding to the target content.
[0376] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0377] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0378] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the content processing methods provided in the embodiments of this application, the beneficial effects that any of the content processing methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0379] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various alternative implementations of the above-described processing aspects.
[0380] The above provides a detailed description of a content processing method and related equipment provided by the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A content processing method, characterized in that, include: Obtain the target content to be processed and multiple candidate content; The target content is subjected to feature extraction processing in the first dimension to obtain the content feature information of the target content in the first dimension; Based on the content feature information of the target content in the first dimension, multiple initial matching contents corresponding to the target content are recalled from the multiple candidate contents; The target content is subjected to a second-dimensional feature extraction process to obtain the content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension. Based on the content feature information of the target content in the second dimension, at least one target matching content corresponding to the target content is determined from the plurality of initial matching contents; Output at least one target matching content corresponding to the target content.
2. The method according to claim 1, characterized in that, The first-dimensional feature extraction process on the target content, to obtain the content feature information of the target content in the first dimension, includes: Determine multiple preset first dimensions, where each preset first dimension is smaller than the second dimension; Based on the current computing resources, a first dimension is selected from the plurality of preset first dimensions; The target content is subjected to feature extraction processing in the first dimension to obtain the content feature information of the target content in the first dimension.
3. The method according to claim 1, characterized in that, The first-dimensional feature extraction process on the target content, to obtain the content feature information of the target content in the first dimension, includes: The target content is subjected to feature extraction processing to obtain the feature information of the target content; The feature information of the target content is subjected to a linear transformation in the first dimension to obtain the content feature information of the target content in the first dimension; The second-dimensional feature extraction process on the target content, to obtain the content feature information of the target content in the second dimension, includes: The feature information of the target content is subjected to a second-dimensional linear transformation to obtain the content feature information of the target content in the second dimension.
4. The method according to claim 1, characterized in that, The step of recalling multiple initial matching contents corresponding to the target content from the multiple candidate contents based on the content feature information of the target content in the first dimension includes: Each candidate content is subjected to feature extraction processing in the first dimension to obtain the first feature information of each candidate content in the first dimension. Calculate the matching degree between the content feature information of the target content in the first dimension and the first feature information of each candidate content in the first dimension; Based on the matching degree, multiple initial matching contents corresponding to the target content are recalled from the multiple candidate contents.
5. The method according to claim 1, characterized in that, The step of determining at least one target matching content corresponding to the target content from the plurality of initial matching contents based on the content feature information of the target content in the second dimension includes: The second dimension feature extraction process is performed on each initial matching content to obtain the second feature information of each initial matching content in the second dimension. Calculate the matching degree between the content feature information of the target content in the second dimension and the second feature information of each initial matching content in the second dimension; Based on the matching degree, at least one target matching content corresponding to the target content is determined from the plurality of initial matching contents.
6. The method according to claim 1, characterized in that, The first-dimensional feature extraction process on the target content, to obtain the content feature information of the target content in the first dimension, includes: By using a content processing model, the target content is subjected to feature extraction processing in the first dimension to obtain the content feature information of the target content in the first dimension; The second-dimensional feature extraction process on the target content, to obtain the content feature information of the target content in the second dimension, includes: The target content is processed by the content processing model to extract features in the second dimension, thereby obtaining the content feature information of the target content in the second dimension.
7. The method according to claim 6, characterized in that, Before performing first-dimensional feature extraction processing on the target content using a content processing model to obtain the content feature information of the target content in the first dimension, the method further includes: Acquire training data, which includes multiple sample query contents and multiple query result contents corresponding to the sample query contents. The label information of the query result contents represents the expected matching degree between the query result contents and the sample query contents. Using a content processing model, feature extraction processing is performed on the sample query content under multiple preset dimensions to obtain the query feature information of the sample query content under each preset dimension. The query results are subjected to feature extraction processing under multiple preset dimensions to obtain the result feature information of the query results under each preset dimension. For each preset dimension, the matching degree is calculated for the query feature information of the sample query content under the preset dimension and the result feature information of the query result content under the preset dimension, so as to obtain the matching degree of the sample query content and the query result content under the preset dimension; Based on the matching degree between the sample query content and the query result content under various preset dimensions, the parameters of the content processing model are adjusted to obtain the trained content processing model.
8. The method according to claim 7, characterized in that, The query results corresponding to the sample query content include negative sample results and positive sample results. The step of adjusting the parameters of the content processing model based on the matching degree between the sample query content and the query result content in various preset dimensions to obtain the trained content processing model includes: For each preset dimension, sub-loss information under the preset dimension is calculated based on the matching degree between the sample query content and the negative sample result content under the preset dimension, and the matching degree between the sample query content and the positive sample result content under the preset dimension. The sub-loss information under each preset dimension is fused to obtain the total loss information; Based on the total loss information, the parameters of the content processing model are adjusted to obtain the trained content processing model.
9. The method according to claim 7, characterized in that, The content processing model includes a shared feature acquisition module and multiple linear transformation modules, each linear transformation module corresponding to a preset dimension. The step involves using a content processing model to extract features from the sample query content across multiple preset dimensions, obtaining query feature information for the sample query content in each preset dimension, including: The shared feature acquisition module performs feature extraction processing on the sample query content to obtain the feature information of the sample query content. Through various linear transformation modules, the feature information of the sample query content is linearly transformed to obtain the query feature information of the sample query content under each preset dimension.
10. The method according to claim 9, characterized in that, Before the step of performing feature extraction processing on the sample query content through the shared feature acquisition module to obtain the feature information of the sample query content, the method further includes: A preset shared feature acquisition module and multiple sample contents are obtained, wherein the sample contents include multiple content units; At least one target content unit is selected from the content units of the sample content, and the target content unit is masked to obtain the masked sample content. The content features of the masked sample are extracted by a preset shared feature acquisition module to obtain the content features of the masked sample. Based on the content features, the masked target content unit is predicted to obtain the predicted content unit. Based on the predicted content unit and its corresponding target content unit, the parameters in the preset shared feature acquisition module are adjusted to obtain the shared feature acquisition module.
11. The method according to claim 10, characterized in that, The module for acquiring preset shared features and multiple sample contents includes: Acquire a preset shared feature acquisition module and raw training data, wherein the raw training data includes the contents of multiple raw samples; Perform a hash operation on each original sample content to obtain the hash value corresponding to each original sample content; Based on the hash value, the original sample content in the original training data is deduplicated to obtain the deduplicated sample content.
12. The method according to claim 10, characterized in that, The step of extracting features from the masked sample content using a preset shared feature acquisition module to obtain the content features of the masked sample content includes: The attention features of the masked sample content are obtained by using a preset shared feature acquisition module to perform attention encoding processing on the masked sample content. The attention features are subjected to fully connected processing and activation processing to obtain the processed features of the masked sample content; The processed features are normalized to obtain the content features of the masked sample content.
13. A content processing apparatus, characterized in that, include: The acquisition unit is used to acquire the target content to be processed and multiple candidate contents; The first extraction unit is used to perform feature extraction processing on the target content in the first dimension to obtain the content feature information of the target content in the first dimension. The recall unit is used to recall multiple initial matching contents corresponding to the target content from the multiple candidate contents based on the content feature information of the target content in the first dimension. The second extraction unit is used to perform second-dimensional feature extraction processing on the target content to obtain content feature information of the target content in the second dimension, where the second dimension is greater than the first dimension. The determining unit is configured to determine at least one target matching content corresponding to the target content from the plurality of initial matching contents based on the content feature information of the target content in the second dimension. The output unit is used to output at least one target matching content corresponding to the target content.
14. An electronic device, characterized in that, It includes a memory and a processor; the memory stores an application program, and the processor runs the application program within the memory to perform the operations in the content processing method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the content processing method according to any one of claims 1 to 12.
16. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the content processing method according to any one of claims 1 to 12.