WO2025007461A1 - 基于嵌入表压缩的信息推荐方法、装置、设备和介质 - Google Patents
基于嵌入表压缩的信息推荐方法、装置、设备和介质 Download PDFInfo
- Publication number
- WO2025007461A1 WO2025007461A1 PCT/CN2023/128561 CN2023128561W WO2025007461A1 WO 2025007461 A1 WO2025007461 A1 WO 2025007461A1 CN 2023128561 W CN2023128561 W CN 2023128561W WO 2025007461 A1 WO2025007461 A1 WO 2025007461A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- feature
- compressed
- model
- similarity
- features
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/951—Indexing; Web crawling techniques
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/194—Calculation of difference between files
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/237—Lexical tools
- G06F40/242—Dictionaries
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/06—Buying, selling or leasing transactions
- G06Q30/0601—Electronic shopping [e-shopping]
- G06Q30/0631—Recommending goods or services
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- recommendation system As a technical means to help users find information of interest from massive amounts of information, recommendation system has become an indispensable and important tool on the Internet.
- a method, apparatus, computer device and storage medium for information recommendation based on embedded table compression are provided.
- a similarity matrix is generated
- generating a similarity matrix based on the similarity between the feature to be compressed and the non-compressed feature includes:
- the method further includes:
- model accuracy change value is not greater than a preset model accuracy drop threshold value, and if so, the second feature mapping dictionary is saved.
- the compression ratio is changed and the second feature mapping dictionary is reacquired until the model accuracy change value of the recommended model is no greater than the preset model accuracy threshold.
- the first feature mapping dictionary is generated based on the data set and includes:
- the attribute feature data in the data set is masked to generate a first feature mapping dictionary.
- the method further includes:
- the recommendation model is trained according to the training set and the validation set, and after the training is completed, the initial model accuracy of the recommendation model is obtained based on the test set.
- the present application further provides an information recommendation device based on embedded table compression, the device comprising:
- An acquisition module used for acquiring features to be compressed and non-compressed features in a to-be-compressed embedding table of a recommendation model according to a preset compression ratio
- a compression module configured to generate a similarity index matrix based on the similarity between the feature to be compressed and the non-compressed feature; and generate an index dictionary based on the similarity index matrix;
- An indexing module configured to replace a first feature mapping dictionary according to the index dictionary to generate a second feature mapping dictionary, wherein the first feature mapping dictionary is generated based on a data set;
- the present application further provides a computer device.
- the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
- the data to be recommended is obtained, features in the data to be recommended are replaced according to the second feature mapping dictionary, the replaced features are input into the recommendation model, and a prediction result is output.
- the present application further provides a computer-readable storage medium.
- the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
- a similarity index matrix is generated
- the data to be recommended is obtained, features in the data to be recommended are replaced according to the second feature mapping dictionary, the replaced features are input into the recommendation model, and a prediction result is output.
- FIG. 1 is a diagram showing an application environment of an information recommendation method based on embedded table compression in one embodiment.
- FIG. 2 is a schematic flow chart of an information recommendation method based on embedded table compression in one embodiment.
- FIG. 3 is a schematic diagram of an embedded table lookup process in the related art.
- FIG. 4 is a schematic flow chart of an information recommendation method based on embedded table compression in an optional embodiment.
- FIG5 is a comparison diagram of the compression effect of the recommended model on a real data set after compression in an exemplary embodiment.
- FIG. 6 is a schematic diagram of the structure of an information recommendation device based on embedded table compression in one embodiment.
- FIG. 7 is a diagram showing the internal structure of a computer device in one embodiment.
- the recommendation model contains many tables, each of which can contain up to 10 million embedding vectors of 16 to 300 dimensions, with a size of 10 TB. More than 99% of the memory is used to store the embedding table.
- the embedding table also occupies an important position in large models such as natural language processing (NLP) and graph representation learning. Therefore, it is necessary to explore compression methods that can efficiently compress without reducing the accuracy of model recommendations.
- NLP natural language processing
- the present application embodiment provides an information recommendation method based on embedded table compression, which can be applied to the application environment shown in FIG1. environment.
- the terminal 102 communicates with the server 104 through the network.
- the data storage system can store the data that the server 104 needs to process.
- the data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers.
- the server 104 can determine the features to be compressed and the non-compressed features in the embedded table to be compressed of the recommendation model according to the preset compression ratio, and generate a similarity index matrix based on the similarity between the features to be compressed and the non-compressed features.
- the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc.
- the server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
- FIG2 is a flow chart of an information recommendation method based on embedded table compression in one embodiment, as shown in FIG2 , including the following steps:
- the preset compression ratio is a percentage point data predetermined by professionals, which is not fixed data and can be further adjusted according to the accuracy of the recommended model. Furthermore, the preset compression ratio can be used to determine the boundary position between the features to be compressed and the non-compressed features corresponding to the embedded table to be compressed, and then determine the features to be compressed and the non-compressed features in the embedded table to be compressed.
- the embedding table to be compressed is a data table stored in the embedding layer of the recommendation model.
- a corresponding embedding table to be compressed can be established for each attribute of the product or each behavioral attribute of the user.
- corresponding embedding tables to be compressed are established for the color, price, shape, origin and other attributes of the product, namely, the color embedding table, price embedding table, shape embedding table, and origin embedding table.
- each row of data can represent a color feature category.
- the number of rows in the color embedding table is the number of color feature categories, and the columns of the color embedding table are represented as the vector dimension T_N of the embedding table.
- the vector dimension T_N of the embedding table can be 8, 16, 32, 64, and other powers of 2.
- the current preset compression ratio is 40%, for a 5-row embedded table to be compressed, the first 2 rows in the table are non-compressed features, and the last 3 rows are features to be compressed.
- the embedded table to be compressed it is also necessary to obtain a category number threshold of the embedded table to be compressed.
- the category number of the embedded table to be compressed is not greater than the category number threshold, the embedded table to be compressed does not need to be compressed. For example, if there are only three color feature categories in the color embedded table, and the category number threshold of the embedded table is exactly 3, then the color embedded table does not need to be compressed at this time.
- S202 Generate a similarity index matrix based on the similarity between the feature to be compressed and the non-compressed feature.
- generating a similarity index matrix based on the similarity between the compressed features and the non-compressed features includes: generating a similarity matrix based on the similarity between the features to be compressed and the non-compressed features, determining a numerical ordering of matrix elements in each row of the similarity matrix, and generating a similarity index matrix according to the numerical ordering of the matrix elements.
- generating a similarity matrix based on the similarity between the features to be compressed and the non-compressed features includes: obtaining a first eigenvector of each of the features to be compressed and a second eigenvector of each of the non-compressed features; obtaining a vector distance between each of the first eigenvectors and each of the second eigenvectors, determining the similarity between each of the compressed features and each of the non-compressed features based on the vector distance, and generating a similarity matrix.
- the color embedding table in the current recommendation model has 8 vector dimensions, and its value in each dimension is shown in Table 1.
- the vector distance between each of the first eigenvectors and each of the second eigenvectors is obtained by calculating the cosine distance.
- the calculation formula of the cosine distance is:
- A represents the first eigenvector corresponding to the uncompressed feature
- B represents the second eigenvector corresponding to the feature to be compressed
- Ai represents the value of the first eigenvector in the i-th vector dimension
- Bi represents the value of the second eigenvector in the i-th vector dimension
- n represents the total vector dimension of the embedded table to be compressed.
- the above vector distance can represent the similarity between two vectors. Therefore, the similarity between each compressed feature and each non-compressed feature can be determined based on the above vector distance to generate a similarity matrix.
- the first part of the corresponding Table 2 is the color similarity matrix generated based on the similarity.
- the cosine distance calculation formula can also be used to calculate the similarity between each compressed feature and each non-compressed feature to generate the corresponding price similarity matrix, shape similarity matrix, and origin similarity matrix. The specific four-segment results are shown in Table 2.
- the corresponding similarity is determined by determining the vector distance between each compressed feature and each non-compressed feature, so that the relationship between each compressed feature and the non-compressed feature can be determined according to the similarity, providing a data basis for the subsequent compression embedding table according to the relationship between each feature.
- the matrix elements of each row in the similarity matrix can be numerically sorted, and the most similar non-compressed feature of each feature to be compressed can be determined according to the numerical sorting of the matrix elements.
- Table 2 the similarities between the feature to be compressed with index number 2 and the non-compressed features with index number 0 and index number 1 have been calculated respectively according to the cosine distance, and the similarity between the feature to be compressed with index number 2 and the non-compressed feature with index number 0 is 0.8, and the similarity between the feature to be compressed with index number 1 is 0.9.
- the two similarities obtained are sorted, and according to the characteristics of the cosine distance, the greater the similarity between the two vectors with the larger cosine distance, the greater the similarity between the two vectors, and the non-compressed feature with index number 1 is determined to be the most similar non-compressed feature of the feature to be compressed with index number 2. Therefore, when determining the color similarity index matrix, the first row can be determined as (1, 0), where 1 represents the index number corresponding to the non-compressed feature most similar to the feature to be compressed, and 0 represents the index number corresponding to the non-compressed feature second most similar to the feature to be compressed. Similarly, for the features to be compressed with index numbers 3 and 4, the color similarity index matrix that can be determined according to their similarity matrix is shown in Table 3.
- each row of the matrix represents the feature to be compressed
- each column represents the non-compressed feature
- the matrix element represents whether each feature to be compressed is similar to each non-compressed feature, where 1 represents similarity and 0 represents dissimilarity.
- the similarity index matrix corresponding to each feature is determined by the similarity between the feature to be compressed and the uncompressed feature.
- the index mapping relationship between the two can be quickly determined with the help of the similarity between the feature to be compressed and the uncompressed feature, which provides data support for the subsequent compression of the embedded table, thereby realizing the rapid compression of the embedded table to be compressed.
- the feature to be compressed corresponding to index number 2 is similar to the non-compressed feature corresponding to index number 0, and is not similar to the non-compressed feature corresponding to index number 1. Then, it can be determined that the feature to be compressed corresponding to index number 2 has an index mapping relationship with the non-compressed feature corresponding to index number 0.
- the data of the feature to be compressed corresponding to index number 2 can be determined through the above index mapping relationship, without recording the data of the feature to be compressed itself.
- the price index dictionary can be determined as: ⁇ 1ABCDE:0, A1BCDE:1, AB1CDE:1, ABC1DE:1, ABCD1E:1 ⁇
- the shape index dictionary is: ⁇ 2ABCDE:0, A2BCDE:1, AB2CDE:0, ABC2DE:0, ABCD2E:1 ⁇
- the origin index dictionary is: ⁇ 3ABCDE:0, A3BCDE:1, AB3CDE:1, ABC3DE:1, ABCD3E:0 ⁇ .
- the index dictionary can be obtained as follows: color index dictionary ⁇ 0ABCDE:0, A0BCDE:1, AB0CDE:1, ABC0DE:0, ABCD0E:0 ⁇ , price index dictionary ⁇ 1ABCDE:0, A1BCDE:1, AB1CDE:1, ABC1DE:1, ABCD1E:1 ⁇ , shape index dictionary ⁇ 2ABCDE:0, A2BCDE:1, AB2CDE:0, ABC2DE:0, ABCD2E:1 ⁇ , origin index dictionary ⁇ 3ABCDE:0, A3BCDE:1, AB3CDE:1, ABC3DE:1, ABCD3E:0 ⁇ .
- the generation of the first feature mapping dictionary based on the data set includes: acquiring the data set, counting the attribute feature data of the commodities in the data set, masking the attribute feature data in the data set, and generating the first feature mapping dictionary.
- each category contained in each embedding table contains 5 feature categories, namely 0ABCDE, A0BCDE, AB0CDE, ABC0DE, and ABCD0E, among which the quantity corresponding to the feature category 0ABCDE is 6, the quantity corresponding to the feature category A0BCDE is 5, the quantity corresponding to the feature category AB0CDE is 4, the quantity corresponding to the feature category ABC0DE is 3, and the quantity corresponding to the feature category ABCD0E is 2.
- the price embedding table contains 5 feature categories, namely 0ABCDE, A0BCDE, AB0CDE, ABC0DE, and ABCD0E, among which the quantity corresponding to the feature category 0ABCDE is 6, the quantity corresponding to the feature category A0BCDE is 5, the quantity corresponding to the feature category AB0CDE is 4, the quantity corresponding to the feature category ABC0DE is 3, and the quantity corresponding to the feature category ABCD0E is 2.
- the shape embedding table contains 5 feature categories, namely 0ABCDE, A0BCDE, AB0CDE, ABC0DE, and ABCD0E, among which the number corresponding to the feature category 0ABCDE is 6, the number corresponding to the feature category A0BCDE is 5, the number corresponding to the feature category AB0CDE is 4, the number corresponding to the feature category ABC0DE is 3, and the number corresponding to the feature category ABCD0E is 2.
- the origin embedding table it contains 5 feature categories, namely 0ABCDE, A0BCDE, AB0CDE, ABC0DE, and ABCD0E, among which the number corresponding to the feature category 0ABCDE is 6, the number corresponding to the feature category A0BCDE is 5, the number corresponding to the feature category AB0CDE is 4, the number corresponding to the feature category ABC0DE is 3, and the number corresponding to the feature category ABCD0E is 2.
- the number of feature categories T_M is very large, reaching tens of millions or hundreds of millions.
- the number of feature categories T_M is determined by the number of a certain feature category of a certain commodity in the data set.
- the number of feature categories shown in the above embodiment is only for illustrative purposes and is not specifically limited in this application.
- the first feature mapping dictionary is mainly implemented by the following steps:
- Step 1 Construct a feature-quantity dictionary ⁇ key, value ⁇ , where key is a feature category, value is the quantity of the feature category, and key needs to be arranged from large to small according to the value of value.
- four feature-quantity dictionaries can be constructed, namely, a color dictionary ⁇ 0ABCDE: 6, A0BCDE: 5, AB0CDE: 4, ABC0DE: 3, ABCD0E: 2 ⁇ , a price dictionary ⁇ 1ABCDE: 6, A1BCDE: 5, AB1CDE: 4, ABC1DE: 3, ABCD1E: 2 ⁇ , a shape dictionary ⁇ 2ABCDE: 6, A2BCDE: 5, AB2CDE: 4, ABC2DE: 3, ABCD2E: 2 ⁇ , and an origin dictionary ⁇ 3ABCDE: 6, A3BCDE: 5, AB3CDE: 4, ABC3DE: 3, ABCD3E: 2 ⁇ .
- Step 2 Construct the first feature mapping dictionary ⁇ key, value ⁇ according to the feature-quantity dictionary, where key is the feature and value is an integer.
- value is determined according to the number of feature categories in the feature-quantity dictionary, starting from 0, and numbered in ascending order until all features are encoded.
- the corresponding first feature mapping dictionaries are: color feature mapping dictionary ⁇ 0ABCDE: 0, A0BCDE: 1, AB0CDE: 2, ABC0DE: 3, ABCD0E: 4 ⁇ , price feature mapping dictionary ⁇ 1ABCDE: 0, A1BCDE: 1, AB1CDE: 2, ABC1DE: 3, ABCD1E: 4 ⁇ , shape feature mapping dictionary ⁇ 2ABCDE: 0, A2BCDE: 1, AB2CDE: 2, ABC2DE: 3, ABCD2E: 4 ⁇ , origin feature mapping dictionary ⁇ 3ABCDE: 0, A3BCDE: 1, AB3CDE: 2, ABC3DE: 3, ABCD3E: 4 ⁇ .
- numbers 0 to 4 are the initial index numbers of each feature category in each feature, which are used to mask the corresponding feature category.
- the embedded table to be compressed can be quickly determined when the embedded table is subsequently compressed, providing a basis for subsequently improving the compression efficiency of the embedded table.
- the first feature mapping dictionary color feature mapping dictionary ⁇ 0ABCDE:0, A0BCDE:1, AB0CDE:1, ABC0DE:0, ABCD0E:0 ⁇ , price index dictionary ⁇ 1ABCDE:0, A1BCDE:1, AB1CDE:1, ABC1DE:1, ABCD1E:1 ⁇ , shape index dictionary ⁇ 2ABCDE:0, A2BCDE:1, AB2CDE:0, ABC2DE:0, ABCD2E:1 ⁇ , origin index dictionary ⁇ 3ABCDE:0, A3BCDE:1, AB3CDE:1, ABC3DE:1, ABCD3E:0 ⁇ can be mapped to the first feature mapping dictionary color feature mapping dictionary ⁇ 0ABCDE:0, A0BCDE:1, AB0CDE:2, ABC0DE:3, ABCD0E:4 ⁇ , price feature mapping dictionary ⁇ 1ABCDE:0, A1BCDE:1, AB1CDE:2, ABC1DE:3, ABCD1E:4 ⁇ , shape feature mapping dictionary
- Fig. 3 is a schematic diagram of an embedding table lookup process in an embodiment.
- the embedding table Embedding Table
- the embedding table can be used to query the value corresponding to each group of feature identifiers, and then the corresponding vector output (embedding output #1; embedding output #2) is generated according to the search result, and then the neural network in the recommendation model determines the corresponding prediction result according to the vector output after the embedding table lookup and outputs it.
- the recommendation model when the recommendation model predicts new recommendation data, it is not necessary to map the vectors in the third row and thereafter of the embedding table during feature mapping, that is, the recommendation model does not need to save the matrix in the third row and thereafter of the embedding table matrix, thereby achieving the purpose of model compression.
- the features to be compressed and the non-compressed features in the embedded table to be compressed of the recommendation model are determined, and based on the similarity between the features to be compressed and the non-compressed features, a similarity index matrix is generated. Then, the index mapping relationship between each feature category is determined by obtaining the similarity between each feature category in the embedded table of the recommendation model. Then, based on the similarity index matrix, an index dictionary is generated; the first feature mapping dictionary is replaced according to the index dictionary to generate a second feature mapping dictionary, wherein the first feature mapping dictionary is generated based on the data set.
- the embedded table in the recommendation model is compressed according to the index mapping relationship between the above-mentioned feature categories, and finally the data to be recommended is obtained, and the features in the data to be recommended are replaced according to the second feature mapping dictionary, and the replaced features are input into the recommendation model to output the prediction result.
- the embedded table in the recommendation model can be compressed without affecting the model accuracy of the recommendation model, thereby improving the compression efficiency of the embedded table, greatly reducing the storage overhead of the model, and improving the reasoning speed of the model.
- the method further includes: updating the recommendation model based on the second feature mapping dictionary, and obtaining the current model accuracy of the recommendation model. Obtaining the initial model accuracy of the recommendation model, and determining the model accuracy change value of the recommendation model according to the initial model accuracy and the current model accuracy. Determining whether the model accuracy change value is not greater than a preset model accuracy drop threshold, and if so, saving the second feature mapping dictionary.
- the embedding table stored in the recommendation model will also change, and the model accuracy of the corresponding recommendation model will also change accordingly. Therefore, in this embodiment, it is also necessary to test the change value of the model accuracy of the recommendation model to determine the change value of the accuracy of the recommendation model. Specifically, the current model accuracy of the recommendation model can be verified again with the help of a predetermined test set, and the model accuracy change value can be determined by comparing the initial model accuracy and the current model accuracy of the recommendation model. Then obtain the preset model accuracy drop threshold t_v. If the model accuracy drop value is not greater than the preset model accuracy drop threshold t_v, it means that the current model accuracy change value is within the acceptable range of the model accuracy drop of the recommendation model, and the second feature mapping dictionary is available and can be directly saved and used.
- the compression ratio is changed and the second feature mapping dictionary is reacquired until the model accuracy change value of the recommended model is no greater than the preset model accuracy threshold.
- the compression ratio can be appropriately reduced, and then the original embedded table to be compressed is compressed again to obtain a new second feature mapping dictionary, and then the corresponding model accuracy change value of the recommended model is obtained to determine whether the new model accuracy change value is within the acceptable range of the model accuracy drop of the recommended model. If so, the new second feature mapping dictionary can be saved. If not, it is still necessary to continue to adjust the compression ratio until the model accuracy change value of the recommended model corresponding to the compression ratio is within the acceptable range of the model accuracy drop.
- the compression ratio of the embedded table to be compressed is adjusted in time to ensure that the compression efficiency of the model can be improved while ensuring that the model accuracy of the recommended model is not excessively affected by the compression of the embedded table.
- the method further includes: determining the type of the recommendation model, dividing the masked data set to obtain a training set, a validation set, and a test set.
- the recommendation model is trained based on the training set and the validation set, and after the training is completed, the initial model accuracy of the recommendation model is obtained based on the test set.
- Common recommendation models include wide&deep, DLRM, DeepFM, etc.
- the DLRM model as an example, before training the recommendation model, it is also necessary to divide the above masked data set to obtain a training set, a validation set, and a test set. For example, the division ratio can be set to 8:1:1. Then the recommendation model is trained with the training set, and the output results of the recommendation model are verified with the help of the validation set until the recommendation model converges, that is, the model accuracy is no longer improved, and finally the initial model accuracy of the recommendation model is verified on the test set.
- the recommendation model used is pre-trained, and then the initial model accuracy of the recommendation model is obtained, so that the subsequent recommendation model can promptly discover the decline in model accuracy of the recommendation model when it changes with the compression of the embedding table, thereby avoiding excessive decline in model accuracy of the recommendation model due to the compression of the embedding table.
- FIG4 is a flow chart of an information recommendation method based on embedded table compression in an optional embodiment. As shown in FIG4, after determining the recommendation algorithm and obtaining the corresponding data set, the number T_T of embedded tables to be compressed in the data set can be determined first, and then the data in the embedded tables to be compressed can be sorted, and a first feature mapping dictionary can be constructed. After that, the recommendation model is trained according to the first feature mapping dictionary until the model converges.
- the T_T embedded table matrices corresponding to the embedded tables to be compressed can be obtained through the recommendation model output, and then the category number threshold cat_num of the embedded table to be compressed can be set, and it is determined whether the number of rows Len(table) in each embedded table matrix to be compressed is greater than the above category number threshold cat_num. If so, the embedded table to be compressed is compressed, and the corresponding percentile P_num, that is, the compression ratio, is set. The demarcation point between the features to be compressed and the non-compressed features in the embedded table to be compressed is determined according to the percentile, and the features to be compressed are compressed, and the non-compressed features are retained.
- the rows represent the rows of the embedded table to be compressed
- the columns represent the similarity values between each row of the embedded table to be compressed and each row of the uncompressed matrix.
- set the preset model accuracy drop threshold determine whether the current model accuracy change value is greater than the preset model accuracy drop threshold, and then determine whether to increase or decrease the compression ratio.
- the current model accuracy change value is not greater than the preset model accuracy drop threshold, if so, save the similarity index matrix and compress the next embedded table until all embedded tables to be compressed are compressed. Otherwise, reset the percentile P_num and recompress the embedded table to be compressed until.
- the model accuracy change value of the recommendation model is not greater than the preset model accuracy drop threshold.
- the vectors corresponding to the most similar first N indexes can be ReLU activated and then averaged to obtain a new vector to be compressed.
- An index dictionary is generated based on the new vector to be compressed to further improve the model accuracy.
- Figure 5 is a comparison diagram of the compression effect of the recommended model after compression on a real data set in an exemplary embodiment.
- the storage space required for the original model before compression is 2160MB.
- the relevant quotient method and combination method can only control the compression ratio within 10.
- the compressed recommended model still requires a large storage space.
- the present application is able to increase the compression ratio to more than 100, and the storage overhead of the compressed recommended model is significantly reduced.
- steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
- the embodiment of the present application also provides an information recommendation device based on embedded table compression for implementing the above-mentioned information recommendation method based on embedded table compression.
- the implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more embodiments of the information recommendation device based on embedded table compression provided below can refer to the limitations of the information recommendation method based on embedded table compression above, and will not be repeated here.
- FIG6 is a schematic diagram of the structure of an information recommendation device based on embedded table compression in one embodiment, comprising: an acquisition module 61, a compression module 62, an indexing module 63 and a prediction module 64, wherein:
- An acquisition module 61 is used to acquire features to be compressed and non-compressed features in a to-be-compressed embedding table of a recommendation model according to a preset compression ratio;
- An indexing module 63 configured to replace a first feature mapping dictionary according to the index dictionary to generate a second feature mapping dictionary, wherein the first feature mapping dictionary is generated based on a data set;
- the prediction module 64 is used to obtain the data to be recommended, replace the features in the data to be recommended according to the second feature mapping dictionary, input the replaced features into the recommendation model, and output the prediction result.
- the features to be compressed and the uncompressed features in the embedded table to be compressed of the recommendation model are determined according to the preset compression ratio, and a similarity index matrix is generated based on the similarity between the features to be compressed and the uncompressed features.
- a similarity index matrix is generated based on the similarity between the features to be compressed and the uncompressed features.
- the embedding table in the recommendation model is compressed according to the index mapping relationship between the above-mentioned feature categories, and finally the data to be recommended is obtained, and the features in the data to be recommended are replaced according to the second feature mapping dictionary, and the replaced features are input into the recommendation model to output the prediction result.
- the embedding table in the recommendation model can be compressed without affecting the model accuracy of the recommendation model, thereby improving the compression efficiency of the embedding table, greatly reducing the storage overhead of the model, and improving the reasoning speed of the model.
- the compression module 62 is further configured to generate a similarity matrix based on the similarity between the feature to be compressed and the non-compressed feature;
- a similarity index matrix is generated according to the numerical order of the matrix elements.
- the compression module 62 is further used to obtain a first feature vector of the feature to be compressed and a second feature vector of the non-compressed feature;
- a vector distance between each of the first feature vectors and each of the second feature vectors is obtained, and a similarity between each of the compressed features and each of the non-compressed features is determined based on the vector distance to generate a similarity matrix.
- the indexing module 63 is further used to update the recommendation model based on the second feature mapping dictionary to obtain the current model accuracy of the recommendation model;
- model accuracy change value is not greater than a preset model accuracy drop threshold value, and if so, the second feature mapping dictionary is saved.
- the index module 63 is also used to change the compression ratio and re-acquire the second feature mapping dictionary if the model accuracy change value is greater than a preset model accuracy drop threshold, until the model accuracy change value of the recommended model is no greater than the preset model accuracy threshold.
- the device further comprises a preprocessing module 65, which is used to obtain a data set and to count attribute feature data of commodities in the data set;
- the attribute feature data in the data set is masked to generate a first feature mapping dictionary.
- the device also includes a training module 66, which is used to determine the type of the recommendation model and divide the masked data set into a training set, a validation set and a test set;
- the recommendation model is trained according to the training set and the validation set, and after the training is completed, the initial model accuracy of the recommendation model is obtained based on the test set.
- Each module in the above-mentioned information recommendation device based on embedded table compression can be implemented in whole or in part by software, hardware and a combination thereof.
- Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
- a computer device which may be a terminal, and its internal structure diagram may be shown in FIG7 .
- the computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus.
- the processor of the computer device is used to provide computing and control capabilities.
- the memory of the computer device includes a non-volatile storage medium and an internal memory.
- the non-volatile storage medium stores an operating system and a computer program.
- the internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium.
- the communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, mobile cellular network, NFC (near field communication) or other technologies.
- WIFI wireless fidelity
- NFC near field communication
- an information recommendation method based on embedded table compression is realized.
- the display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen
- the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
- FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
- the specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
- a computer device including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
- the data to be recommended is obtained, features in the data to be recommended are replaced according to the second feature mapping dictionary, the replaced features are input into the recommendation model, and a prediction result is output.
- a computer readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
- a similarity index matrix is generated
- the data to be recommended is obtained, features in the data to be recommended are replaced according to the second feature mapping dictionary, the replaced features are input into the recommendation model, and a prediction result is output.
- user information including but not limited to user device information, user personal information, etc.
- data including but not limited to data used for analysis, stored data, displayed data, etc.
- any reference to memory, database or other media used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory.
- Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magneto resistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc.
- Volatile memory can include random access memory (RAM) or external cache memory, etc.
- RAM can be in various forms, such as static Static Random Access Memory (SRAM) or dynamic random access memory (DRAM), etc.
- SRAM static Static Random Access Memory
- DRAM dynamic random access memory
- the database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database.
- Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto.
- the processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited thereto.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Business, Economics & Management (AREA)
- Health & Medical Sciences (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Finance (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Artificial Intelligence (AREA)
- Accounting & Taxation (AREA)
- General Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Marketing (AREA)
- Economics (AREA)
- Development Economics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Editing Of Facsimile Originals (AREA)
Abstract
一种基于嵌入表压缩的信息推荐方法、装置、设备和介质。方法包括:根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征,基于待压缩特征与非压缩特征之间的相似度,生成相似度索引矩阵。基于相似度索引矩阵,生成索引字典,根据索引字典对第一特征映射字典进行替换,生成第二特征映射字典。在获取待推荐数据后,根据第二特征映射字典替换待推荐数据中的特征,将替换后的特征输入至推荐模型,输出预测结果。
Description
相关申请
本申请要求2023年7月3日申请的,申请号为202310805640.9,名称为“基于嵌入表压缩的信息推荐方法、装置、设备和介质”的中国专利申请的优先权,在此将其全文引入作为参考。
本申请涉及机器学习领域,特别是涉及基于嵌入表压缩的信息推荐方法、装置、设备和介质。
推荐系统作为一种能够从海量信息中为用户寻找其感兴趣信息的技术手段,已成为了互联网中必不可少的重要工具。
随着各类网站用户规模的爆炸式增长以及供应商提供物品种类的快速增多,推荐系统的存储压力也日益增大,如何减小推荐系统的存储压力已成为目前亟需解决的问题。
面对如何减小推荐模型存储压力对模型进行压缩是目前常见的方式。相关的模型压缩方法,大体可分为低秩分解、量化、剪枝蒸馏等对模型嵌入层(Embedding)的压缩,轻量化模型结构的设计以及编码。在相关的对模型嵌入层进行压缩的方法中,其压缩过程中使用的函数往往受到限制,需要反复进行循环运算,进而导致了压缩后推荐模型的运行速度以及模型精度的下降。
针对相关技术中如何在保证推荐模型模型精度的前提下,提高模型的压缩效率,目前还没有提出有效的解决方案。
发明内容
根据本申请的各种实施例,提供一种基于嵌入表压缩的信息推荐方法、装置、计算机设备和存储介质。
第一方面,本申请提供了一种基于嵌入表压缩的信息推荐方法。所述方法包括:
根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;
基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;
基于所述相似度索引矩阵,生成索引字典;
根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;
获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
在其中一个实施例中,所述基于所述压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵,包括:
基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度矩阵;
确定所述相似度矩阵中每行的矩阵元数值排序;
根据所述矩阵元数值排序生成相似度索引矩阵。
在其中一个实施例中,所述基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度矩阵,包括:
获取各所述待压缩特征的第一特征向量,各所述非压缩特征的第二特征向量;
获取各所述第一特征向量与各所述第二特征向量之间的向量距离,基于所述向量距离确定各所述压缩特征与各所述非压缩特征之间的相似度,生成相似度矩阵。
在其中一个实施例中,所述生成第二特征映射字典之后,所述方法还包括:
基于所述第二特征映射字典更新推荐模型,获取所述推荐模型的当前模型精度;
获取推荐模型的初始模型精度,根据所述初始模型精度与所述当前模型精度确定推荐模型的模型精度变化值;
判断所述模型精度变化值是否不大于预设模型精度下降阈值,若是,则保存所述第二特征映射字典。
在其中一个实施例中,若所述模型精度变化值大于预设模型精度下降阈值,则更改所述压缩比例,重新获取第二特征映射字典,直至所述推荐模型的模型精度变化值不大于预设模型精度阈值。
在其中一个实施例中,所述第一特征映射字典基于数据集所生成包括:
获取数据集,统计所述数据集中商品的属性特征数据;
对所述数据集中的属性特征数据进行掩码,生成第一特征映射字典。
在其中一个实施例中,所述生成第一特征映射字典之后,所述方法还包括:
确定推荐模型的类型,对掩码后的所述数据集进行划分,得到训练集,验证集以及测试集;
根据所述训练集与所述验证集训练推荐模型,在训练完成后,基于所述测试集获取推荐模型的初始模型精度。
第二方面,本申请还提供了一种基于嵌入表压缩的信息推荐装置,所述装置包括:
获取模块,用于获取根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;
压缩模块,用于基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;基于所述相似度索引矩阵,生成索引字典;
索引模块,用于根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;
预测模块,用于获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
第三方面,本申请还提供了一种计算机设备。所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;
基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;
基于所述相似度索引矩阵,生成索引字典;
根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;
获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
第四方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:
根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;
基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;
基于所述相似度索引矩阵,生成索引字典;
根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;
获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
本申请的一个或多个实施例的细节在以下附图和描述中提出,以使本申请的其他特征、目的和优点更加简明易懂。
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅是本申请的一些实施例,对于本领域普通技术人员而言,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为一个实施例中基于嵌入表压缩的信息推荐方法的应用环境图。
图2为一个实施例中基于嵌入表压缩的信息推荐方法的流程示意图。
图3为相关技术中嵌入表查表过程的示意图。
图4为一个可选实施例中基于嵌入表压缩的信息推荐方法的流程示意图。
图5为一个示例性实施例中推荐模型压缩后在真实数据集上的压缩效果对比图。
图6为一个实施例中基于嵌入表压缩的信息推荐装置的结构示意图。
图7为一个实施例中计算机设备的内部结构图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
推荐模型包含很多表,每个表可包含多达千万大小16~300维的嵌入向量,其大小已达10TB级,约99%以上的内存用来存放嵌入表。此外嵌入表在自然语言处理(Natural Language Processing,简称NLP)和图表示学习等大模型里也占据重要位置,因此探索能够高效压缩同时不降低模型推荐精度的压缩方法十分有必要。
本申请实施例提供基于嵌入表压缩的信息推荐方法,可以应用于如图1所示的应用环
境中。其中,终端102通过网络与服务器104进行通信。数据存储系统可以存储服务器104需要处理的数据。数据存储系统可以集成在服务器104上,也可以放在云上或其他网络服务器上。具体的,服务器104在获取到终端102上传的数据集之后,可根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征,基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵。然后基于所述相似度索引矩阵,生成索引字典,根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成。最后,获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑等。该服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。
图2为一个实施例中一种基于嵌入表压缩的信息推荐方法的流程示意图,如图2所示,包括以下步骤:
S201,根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征。
其中,预设压缩比例为由专业人员预先确定好的百分点数据,其并非为固定数据,可根据推荐模型的精度进行进一步的调整。进一步的,预设压缩比例可用于确定对应待压缩嵌入表的待压缩特征与非压缩特征的分界位置,进而确定待压缩嵌入表中的待压缩特征与非压缩特征。
待压缩嵌入表为推荐模型嵌入层所存储的数据表格,具体的,可对商品的每个属性或用户的每个行为属性均建立对应的待压缩嵌入表。例如,针对商品的颜色、价格、形状、产地等属性均建立对应的待压缩嵌入表为颜色嵌入表、价格嵌入表、形状嵌入表、产地嵌入表。假设在颜色嵌入表中存在5行数据,则每行数据可表示一种颜色特征类别,颜色嵌入表的行数即为颜色特征类别的数量,而颜色嵌入表的列则表示为嵌入表的向量维度T_N,一般地,嵌入表的向量维度T_N可以为8,16,32,64等2的幂次方。
在一个可选的示例性实施例中,若当前预设压缩比例为40%,对于一个5行的待压缩嵌入表而言,表中前2行属于非压缩特征,后3行数据待压缩特征。
可选的,在本申请实施例中还需要获取待压缩嵌入表的类别数阈值,当待压缩嵌入表的类别数量不大于类别数阈值时,则该待压缩嵌入表并不需要进行压缩。示例性的,若颜色嵌入表中仅存在3种颜色特征类别,而该嵌入表的类别数阈值恰好为3,则此时的颜色嵌入表并不需要进行压缩。
S202,基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵。
在一个实施例中,所述基于所述压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵,包括:基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度矩阵,确定所述相似度矩阵中每行的矩阵元数值排序,根据所述矩阵元数值排序生成相似度索引矩阵。
其中,在一个实施例中,所述基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度矩阵,包括:获取各所述待压缩特征的第一特征向量,各所述非压缩特征的第二特征向量;获取各所述第一特征向量与各所述第二特征向量之间的向量距离,基于所述向量距离确定各所述压缩特征与各所述非压缩特征之间的相似度,生成相似度矩阵。
示例性的,假设当前推荐模型中颜色嵌入表有8个向量维度,其在各维度的值如表1所示。
表1
在该颜色嵌入表中,共有索引号为0至4的5个特征类别,且当前的压缩比例为40%,则可确定每个压缩嵌入表中的前两行表示非压缩特征(第一特征向量),后三行表示待压缩特征(第二特征向量),其中,索引号为对原有的数据集进行掩码后,用于表征对应特征类别的编号。对应的颜色相似度矩阵即为一个3×2的矩阵,矩阵的每行表示一个待压缩特征,矩阵的每列表示一个非压缩特征,每个矩阵元即为一个待压缩特征与一个非压缩特征之间的相似度。
根据表1,通过计算余弦距离获取各所述第一特征向量与各所述第二特征向量之间的向量距离。具体的,余弦距离的计算公式为:
其中,A表示非压缩特征对应的第一特征向量,B表示待压缩特征对应的第二特征向量,Ai表示第一特征向量在第i个向量维度上的值,Bi表示第二特征向量在第i个向量维度上的值,n表示待压缩嵌入表的总向量维度。
进一步的,上述向量距离即可表示两个向量之间的相似度,因此,可基于上述向量距离确定各压缩特征与各非压缩特征之间的相似度,生成相似度矩阵。对应的表2的第一部分即为根据相似度生成的颜色相似度矩阵。同理,针对推荐模型中的其余价格嵌入表、形状嵌入表以及产地嵌入表也可使用余弦距离计算公式其各压缩特征与各非压缩特征之间的相似度,生成对应的价格相似度矩阵、形状相似度矩阵以及产地相似度矩阵。具体的四段结果如表2所示。
表2
可选的,在其他实施例中,还可以根据欧式距离、曼哈顿距离等度量方式确定各压缩特征与各非压缩特征之间的相似度。
在本实施例中,通过确定各压缩特征与各非压缩特征之间的向量距离以确定其对应的相似度,以便于根据相似度确定各压缩特征与非压缩特征之间的关系,为后续根据各个特征之间的关系压缩嵌入表提供了数据基础。
进一步的,在得到相似度矩阵后,可对相似度矩阵中每行的矩阵元进行数值排序,根据矩阵元数值排序确定各待压缩特征的最相似非压缩特征。如表2所示,已根据余弦距离分别计算得到索引号为2的待压缩特征与索引号为0以及索引号为1的非压缩特征之间的相似度,得到索引号为2的待压缩特征与索引号为0的非压缩特征之间的相似度为0.8,与索引号为1的非压缩特征之间的相似度为0.9,对得到的两个相似度进行排序,并根据余弦距离的特性,余弦距离越大的两个向量之间的相似度越大,确定索引号为1的非压缩特征为索引号为2的待压缩特征的最相似非压缩特征。因此,在确定颜色相似度索引矩阵时,第一行可确定为(1,0),其中1表示与待压缩特征最相似的非压缩特征对应的索引号,0表示与待压缩特征第二相似的非压缩特征对应的索引号。同理,针对索引号为3和4的待压缩特征,根据其相似度矩阵可确定的颜色相似度索引矩阵如表3所示。同理,根据表2中的价格相似度矩阵、形状相似度矩阵以及产地相似度矩阵,对应得到的价格相似度索引矩阵、形状相似度索引矩阵以及产地相似度索引矩阵也如表3所示。在相似度索引矩阵中,矩阵每行表征待压缩特征,每列表示非压缩特征,矩阵元表示各待压缩特征与各非压缩特征是否相似,其中1表示相似,0表示不相似。
表3
在本实施例中,通过待压缩特征与非压缩特征之间的相似度确定每个特征对应的相似度索引矩阵,能够借助待压缩特征与非压缩特征之间的相似度快速确定两者之间的索引映射关系,为后续对嵌入表进行压缩提供了数据支持,进而实现了对待压缩嵌入表的快速压缩。
S203,基于所述相似度索引矩阵,生成索引字典。
具体的,可根据相似度索引矩阵中各待压缩特征与各非压缩特征是否相似确定对应各待压缩特征与各非压缩特征之间的索引关系,根据索引关系生成索引字典。具体的,在确定某一待压缩特征与某一非压缩特征相似时,可确定上述待压缩特征与上述非压缩特征可进行索引映射,在确定某一待压缩特征与某一非压缩特征不相似时,则确定上述待压缩特征与上述非压缩特征不存在索引映射关系。示例性的,根据表3中的颜色索引矩阵所示,可确定索引号2对应的待压缩特征与索引号0对应的非压缩特征相似,与索引号1对应的非压缩特征不相似,则可确定索引号2对应的待压缩特征与索引号0对应的非压缩特征存在索引映射关系,在压缩嵌入表中可通过上述索引映射关系确定将索引号2对应的待压缩特征的数据,无需记录该待压缩特征本身的数据。同理,可知索引号为3的待压缩特征与索引号为1的非压缩特征之间存在索引映射关系,索引号为4的待压缩特征与索引号为1的非压缩特征之间存在索引映射关系,对应的可得到颜色索引字典为:{0ABCDE:0,
A0BCDE:1,AB0CDE:1,ABC0DE:0,ABCD0E:0}。
同理,根据表3可确定价格索引字典为:{1ABCDE:0,A1BCDE:1,AB1CDE:1,ABC1DE:1,ABCD1E:1},形状索引字典为:{2ABCDE:0,A2BCDE:1,AB2CDE:0,ABC2DE:0,ABCD2E:1},产地字索引典为:{3ABCDE:0,A3BCDE:1,AB3CDE:1,ABC3DE:1,ABCD3E:0}。
即可得到索引字典为:颜色索引字典{0ABCDE:0,A0BCDE:1,AB0CDE:1,ABC0DE:0,ABCD0E:0},价格索引字典{1ABCDE:0,A1BCDE:1,AB1CDE:1,ABC1DE:1,ABCD1E:1},形状索引字典{2ABCDE:0,A2BCDE:1,AB2CDE:0,ABC2DE:0,ABCD2E:1},产地索引字典{3ABCDE:0,A3BCDE:1,AB3CDE:1,ABC3DE:1,ABCD3E:0}。
S204,根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成。
具体的,在一个实施例中,所述第一特征映射字典基于数据集所生成包括:获取数据集,统计所述数据集中商品的属性特征数据,对所述数据集中的属性特征数据进行掩码,生成第一特征映射字典。
本申请实施例中,在对推荐模型中的嵌入表进行压缩之前,还需要预先确定推荐算法以及对应的数据集,由于基于不同网络模型的推荐算法以及不同的大规模数据集所对应的推荐模型的嵌入表的数量和维度均不相同,因此在本实施例中,需要预先确定数据集以及对应的算法。
在上述颜色嵌入表、形状嵌入表、价格嵌入表以及产地嵌入表对应的一个示例性实施例中,获取到的数据集如表4所示,对应的采用的推荐模型为DLRM模型,标签表示模型训练过程中的对比目标(target),其中0表示不推荐,1表示推荐。
表4
统计表4中的商品的属性特征数据可知本示例性实施例中存在四种属性特征,分别为颜色、价格、形状以及产地,因此,该数据集中嵌入表的个数为4,分别为颜色嵌入表、
价格嵌入表、形状嵌入表以及产地嵌入表。
进一步的,在确定商品的属性特征数据之后,还需要确定每个嵌入表中包含的每个类别对应的数量T_M。根据表2所示,可知对于颜色嵌入表而言,其包含5个特征类别,分别为0ABCDE、A0BCDE、AB0CDE、ABC0DE、ABCD0E,其中,特征类别0ABCDE对应的数量为6,特征类别A0BCDE对应的数量为5,特征类别AB0CDE对应的数量为4,特征类别ABC0DE对应的数量为3,特征类别ABCD0E对应的数量为2。同理可知,对于价格嵌入表而言,其包含5个特征类别,分别为0ABCDE、A0BCDE、AB0CDE、ABC0DE、ABCD0E,其中,特征类别0ABCDE对应的数量为6,特征类别A0BCDE对应的数量为5,特征类别AB0CDE对应的数量为4,特征类别ABC0DE对应的数量为3,特征类别ABCD0E对应的数量为2。对于形状嵌入表而言,其包含5个特征类别,分别为0ABCDE、A0BCDE、AB0CDE、ABC0DE、ABCD0E,其中,特征类别0ABCDE对应的数量为6,特征类别A0BCDE对应的数量为5,特征类别AB0CDE对应的数量为4,特征类别ABC0DE对应的数量为3,特征类别ABCD0E对应的数量为2。对于产地嵌入表而言,其包含5个特征类别,分别为0ABCDE、A0BCDE、AB0CDE、ABC0DE、ABCD0E,其中,特征类别0ABCDE对应的数量为6,特征类别A0BCDE对应的数量为5,特征类别AB0CDE对应的数量为4,特征类别ABC0DE对应的数量为3,特征类别ABCD0E对应的数量为2。
需要说明的是,在实际的应用场景中特征类别的数量T_M非常庞大,可达到千万或者亿万级别,特征类别的数量T_M越大即其对存储的要求也越大。一般的,特征类别的数量T_M由数据集中某一商品的某个特征类别的数量所决定。上述实施例中所展示的特征类别的数量仅用于示例性说明,在本申请中并不进行具体的限定。
可以理解的是,考虑到实际应用场景中的数据隐私问题,一般的,用户的属性特征以及商品的数据特征均要要进行加密掩码处理,生成第一特征映射字典,以确保数据的安全性。在本实施例中,第一特征映射字典主要由如下步骤实现:
步骤一、构建特征-数量字典{key,value},在特征-数量字典中key为特征类别,value为该特征类别的数量,且key需要根据value的值从大到小进行排列。根据对上述数据集(表2)的统计结果可知,在本示例性实施例中,可构建四个特征-数量字典,分别为颜色字典{0ABCDE:6,A0BCDE:5,AB0CDE:4,ABC0DE:3,ABCD0E:2}、价格字典{1ABCDE:6,A1BCDE:5,AB1CDE:4,ABC1DE:3,ABCD1E:2}、形状字典{2ABCDE:6,A2BCDE:5,AB2CDE:4,ABC2DE:3,ABCD2E:2}以及产地字典{3ABCDE:6,A3BCDE:5,AB3CDE:4,ABC3DE:3,ABCD3E:2}。
步骤二、根据特征-数量字典构建第一特征映射字典{key,value},在第一特征映射字典key为特征,value为整数。在本步骤中,value根据特征-数量字典的特征类别的数量大小所确定,从0开始,按顺序递增进行编号,直至编码完所有特征,对应的建第一特征映射字典分别为:颜色特征映射字典{0ABCDE:0,A0BCDE:1,AB0CDE:2,ABC0DE:3,ABCD0E:4},价格特征映射字典{1ABCDE:0,A1BCDE:1,AB1CDE:2,ABC1DE:3,ABCD1E:4},形状特征映射字典{2ABCDE:0,A2BCDE:1,AB2CDE:2,ABC2DE:3,ABCD2E:4},产地特征映射字典{3ABCDE:0,A3BCDE:1,AB3CDE:2,ABC3DE:3,ABCD3E:4}。其中,编号0至4为每个特征中各个特征类别的初始的索引号,用于对对应的特征类别进行掩码。
进一步的,基于第一特征映射字典对数据集中的各个特征进行转换即可得到如表5所示的掩码数据集。
表5
在本实施例中,通过对数据集进行预处理,对数据集中的数据进行掩码,并构建对应的第一特征映射字典,以便于后续在对嵌入表进行压缩时,能够快速确定待压缩嵌入表,为后续提高嵌入表的压缩效率提供基础。
进一步的,即可根据索引字典颜色索引字典{0ABCDE:0,A0BCDE:1,AB0CDE:1,ABC0DE:0,ABCD0E:0},价格索引字典{1ABCDE:0,A1BCDE:1,AB1CDE:1,ABC1DE:1,ABCD1E:1},形状索引字典{2ABCDE:0,A2BCDE:1,AB2CDE:0,ABC2DE:0,ABCD2E:1},产地索引字典{3ABCDE:0,A3BCDE:1,AB3CDE:1,ABC3DE:1,ABCD3E:0}对第一特征映射字典颜色特征映射字典{0ABCDE:0,A0BCDE:1,AB0CDE:2,ABC0DE:3,ABCD0E:4},价格特征映射字典{1ABCDE:0,A1BCDE:1,AB1CDE:2,ABC1DE:3,ABCD1E:4},形状特征映射字典{2ABCDE:0,A2BCDE:1,AB2CDE:2,ABC2DE:3,ABCD2E:4},产地特征映射字典{3ABCDE:0,A3BCDE:1,AB3CDE:2,ABC3DE:3,ABCD3E:4}进行替换,替换后的结果为:颜色特征映射字典{0ABCDE:0,A0BCDE:1,AB0CDE:1,ABC0DE:0,ABCD0E:0},价格特征映射字典{1ABCDE:0,A1BCDE:1,AB1CDE:1,ABC1DE:1,ABCD1E:1},形状特征映射字典{2ABCDE:0,A2BCDE:1,AB2CDE:0,ABC2DE:0,ABCD2E:1},产地特征映射字典{3ABCDE:0,A3BCDE:1,AB3CDE:1,ABC3DE:1,ABCD3E:0}。
S205,获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
示例性的,图3为一个实施例中嵌入表查表过程的示意图。如图3所示,在获取到待推荐数据,确定该待推荐数据中存在两个特征(sparse feature#1;sparse feature#2),对应于两组标识(1245;4329),可借助嵌入表(Embedding Table)查询每组特征标识对应的值,然后根据查找结果生成对应的向量输出(embedding output#1;embedding output#2),再由推荐模型中的神经网络根据嵌入表查表后输出的向量确定对应的预测结果进行输出。
在本申请实施例中,当推荐模型对新的推荐数据进行预测时,在特征映射时,并不需要映射嵌入表第三行及之后的向量,即推荐模型中不需要保存嵌入表矩阵第三行及之后的矩阵,进而达到了模型压缩的目的。
上述基于嵌入表压缩的信息推荐方法中,根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征,基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵。进而实现了通过获取推荐模型嵌入表中各个特征类别之间的相似度确定各个特征类别之间的索引映射关系。然后基于所述相似度索引矩阵,生成索引字典;根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成。进而实现了根据上述各个特征类别之间的索引映射关系对推荐模型中的嵌入表进行压缩,最后获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。进而在对推荐模型进行压缩时,能够在不影响推荐模型的模型精度的前提下,将推荐模型中的嵌入表进行压缩,进而提高嵌入表的压缩效率,大幅降低模型的存储开销,提高模型的推理速度。
在一个实施例中,所述生成第二特征映射字典之后,所述方法还包括:基于所述第二特征映射字典更新推荐模型,获取所述推荐模型的当前模型精度。获取推荐模型的初始模型精度,根据所述初始模型精度与所述当前模型精度确定推荐模型的模型精度变化值。判断所述模型精度变化值是否不大于预设模型精度下降阈值,若是,则保存所述第二特征映射字典。
可以理解的是,在第一特征映射字典被替换之后,推荐模型中保存的嵌入表也将发生变化,相应的推荐模型的模型精度也随之产生的变化。因此,在本实施例中,还需要对推荐模型的模型精度的变化值进行测试,确定推荐模型的精度变化值。具体的,可借助预先确定的测试集再次验证推荐模型的当前模型精度,对比推荐模型的初始模型精度和当前模型精度确定模型精度变化值。然后获取预设的模型精度下降阈值t_v,若模型精度变化值不大于预设模型精度下降阈值t_v,则说明当前的模型精度变化值处于推荐模型的模型精度下降可接受范围,第二特征映射字典可用,直接保存使用即可。
在本实施例中,通过判断推荐模型的模型精度变化值是否处于推荐模型的模型精度下降可接受范围,确保了在压缩嵌入表的同时不过度影响推荐模型的模型精度,进而能够在压缩推荐模型中嵌入表的同时确保模型的模型精度。
在一个实施例中,若所述模型精度变化值大于预设模型精度下降阈值,则更改所述压缩比例,重新获取第二特征映射字典,直至所述推荐模型的模型精度变化值不大于预设模型精度阈值。
在本实施例中,在推荐模型当前的模型精度变化值超出推荐模型的模型精度下降可接受范围的情况下,则说明当前的压缩比例过大或过小,需要重新调整压缩比例,避免推荐模型的模型精度过度下降。示例性的,可适当减小压缩比例,然后重新对原有的待压缩嵌入表进行压缩,获取新的第二特征映射字典,然后再获取对应的推荐模型的模型精度变化值,判断新的模型精度变化值是否处于推荐模型的模型精度下降可接受范围,若是,则可保存该新的第二特征映射字典。若否,则还是需要继续调整压缩比例,直至该压缩比例对应的推荐模型的模型精度变化值处于模型精度下降可接受范围。
在本实施例中,在判断推荐模型的模型精度变化值超出推荐模型的模型精度下降可接受范围时,及时调整了待压缩嵌入表的压缩比例,以确保在能够提高模型的压缩效率的同时又能保证推荐模型模型精度不过度受到嵌入表压缩的影响。
在一个实施例中,所述生成第一特征映射字典之后,所述方法还包括:确定推荐模型的类型,对掩码后的所述数据集进行划分,得到训练集,验证集以及测试集。根据所述训练集与所述验证集训练推荐模型,在训练完成后,基于所述测试集获取推荐模型的初始模型精度。
常见的推荐模型有wide&deep、DLRM、DeepFM等,在本实施例中,以DLRM模型为例,在对推荐模型进行训练之前,还需要对上述掩码后的数据集进行划分,得到训练集,验证集以及测试集。示例性的可将划分比例设置为8:1:1。然后通过训练集对推荐模型进行训练,借助验证集验证推荐模型的输出结果,直至推荐模型收敛,即模型精度不在提高,最后在测试集上验证推荐模型的初始模型精度。
在本实施例中,在获取到数据集对应的第一特征映射字典之后,对所用的推荐模型进行了预训练,然后获取推荐模型的初始模型精度,以便于后续推荐模型在随着嵌入表的压缩发生变化时能够及时发现推荐模型的模型精下降情况,避免嵌入表的压缩导致推荐模型的模型精度过度下降。
图4为一个可选实施例中基于嵌入表压缩的信息推荐方法的流程示意图,如图4所示,在确定推荐算法以及获取到对应的数据集之后,可先确定数据集中待压缩嵌入表的数量T_T,然后对上述待压缩嵌入表中的数据进行排序,并构建第一特征映射字典。之后,再根据第一特征映射字典训练推荐模型直至模型收敛。在推荐模型训练完成之后,即可通过推荐模型输出得到待压缩嵌入表对应的T_T个嵌入表矩阵,然后可设定待压缩嵌入表的类别数阈值cat_num,确定每个待压缩嵌入表矩阵中的行数Len(table)是否大于上述类别数阈值cat_num,若是则对待压缩嵌入表进行压缩,设定对应的百分位数P_num,即压缩比例,根据百分位数确定待压缩嵌入表中待压缩特征与非压缩特征之间的分界点,压缩待压缩特征,保留非压缩特征。然后再确定计算待压缩特征与非压缩特征之间相似度的度量方式,根据预设度量方式计算待压缩嵌入表对应的相似度矩阵simi_mat,在相似度矩阵中,行表示待压缩嵌入表的行,列表示待压缩嵌入表的每行与非压缩矩阵每行的相似度值。接着求出相似度矩阵每行最大的前N个索引列表,以确定对应的相似度索引矩阵。然后再设定预设模型精度下降阈值,判断当前模型精度变化值是否大于预设模型精度下降阈值,进而确定增加压缩比例或者减少压缩比例,具体的,若当前模型精度变化值不大于预设模型精度下降阈值,若是,则保存相似度索引矩阵,进行下一个嵌入表的压缩,直至所有的待压缩嵌入表完成压缩,否则重新设定百分位数P_num,重新进行本待压缩嵌入表的压缩,直至
推荐模型的模型精度变化值不大于预设模型精度下降阈值。在完成所有待压缩嵌入表的压缩之后,对于T_T个相似度索引矩阵,取对应相似度索引矩阵中最相似的前N个索引对应的特征向量,生成对应的索引字典,使用索引字典替换第一特征映射字典得到对应的第二特征映射字典。可选的,在生成索引字典时,可对最相似的前N个索引对应的向量进行ReLU激活后取平均值进而得到新的待压缩向量,根据新的待压缩向量生成索引字典,以进一步提高模型精度,通过上述激活后的待压缩向量建立索引字典,并生成对应的第二特征映射字典能够使得推荐模型的模型精度有效提高,对应的压缩后推荐模型的模型精度能够超过未压缩模型的模型精度。
对应的,图5为一个示例性实施例中推荐模型压缩后在真实数据集上的压缩效果对比图,如图5所示,未压缩前的原始模型其所需的存储空间为2160MB,在相关商余法、组合法仅能将压缩比控制在10以内,压缩后的推荐模型仍需要较大的存储空间,而本申请,却够将压缩比提高至100以上,压缩后的推荐模型其存储开销明显降低。
应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的基于嵌入表压缩的信息推荐方法的基于嵌入表压缩的信息推荐装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个基于嵌入表压缩的信息推荐装置实施例中的具体限定可以参见上文中对于基于嵌入表压缩的信息推荐方法的限定,在此不再赘述。
图6为一个实施例中基于嵌入表压缩的信息推荐装置的结构示意图,包括:获取模块61、压缩模块62、索引模块63和预测模块64,其中:
获取模块61,用于获取根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;
压缩模块62,用于基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;基于所述相似度索引矩阵,生成索引字典;
索引模块63,用于根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;
预测模块64,用于获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
上述基于嵌入表压缩的信息推荐装置中,根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征,基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵。进而实现了通过获取推荐模型嵌入表中各个特征类别之间的相似度确定各个特征类别之间的索引映射关系。然后基于所述相似度索引矩阵,生成索引字典;根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所
述第一特征映射字典基于数据集所生成。进而实现了根据上述各个特征类别之间的索引映射关系对推荐模型中的嵌入表进行压缩,最后获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。进而在对推荐模型进行压缩时,能够在不影响推荐模型的模型精度的前提下,将推荐模型中的嵌入表进行压缩,进而提高嵌入表的压缩效率,大幅降低模型的存储开销,提高模型的推理速度。
进一步的,压缩模块62还用于基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度矩阵;
确定所述相似度矩阵中每行的矩阵元数值排序;
根据所述矩阵元数值排序生成相似度索引矩阵。
进一步的,压缩模块62还用于获取所述待压缩特征的第一特征向量,所述非压缩特征的第二特征向量;
获取各所述第一特征向量与各所述第二特征向量之间的向量距离,基于所述向量距离确定各所述压缩特征与各所述非压缩特征之间的相似度,生成相似度矩阵。
进一步的,索引模块63还用于基于所述第二特征映射字典更新推荐模型,获取所述推荐模型的当前模型精度;
获取推荐模型的初始模型精度,根据所述初始模型精度与所述当前模型精度确定推荐模型的模型精度变化值;
判断所述模型精度变化值是否不大于预设模型精度下降阈值,若是,则保存所述第二特征映射字典。
进一步的,索引模块63还用于若所述模型精度变化值大于预设模型精度下降阈值,则更改所述压缩比例,重新获取第二特征映射字典,直至所述推荐模型的模型精度变化值不大于预设模型精度阈值。
进一步的,所述装置还包括预处理模块65,用于获取数据集,统计所述数据集中商品的属性特征数据;
对所述数据集中的属性特征数据进行掩码,生成第一特征映射字典。
进一步的,所述装置还包括训练模块66,用于确定推荐模型的类型,对掩码后的所述数据集进行划分,得到训练集,验证集以及测试集;
根据所述训练集与所述验证集训练推荐模型,在训练完成后,基于所述测试集获取推荐模型的初始模型精度。
上述基于嵌入表压缩的信息推荐装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图7所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该
计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种基于嵌入表压缩的信息推荐方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。
本领域技术人员可以理解,图7中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现以下步骤:
根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;
基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;
基于所述相似度索引矩阵,生成索引字典;
根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;
获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;
基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;
基于所述相似度索引矩阵,生成索引字典;
根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;
获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magneto resistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态
随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。
Claims (10)
- 一种基于嵌入表压缩的信息推荐方法,其特征在于,所述方法包括:根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;基于所述相似度索引矩阵,生成索引字典;根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
- 根据权利要求1所述的方法,其中,所述基于所述压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵,包括:基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度矩阵;确定所述相似度矩阵中每行的矩阵元数值排序;根据所述矩阵元数值排序生成相似度索引矩阵。
- 根据权利要求2所述的方法,其中,所述基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度矩阵,包括:获取各所述待压缩特征的第一特征向量,各所述非压缩特征的第二特征向量;获取各所述第一特征向量与各所述第二特征向量之间的向量距离,基于所述向量距离确定各所述压缩特征与各所述非压缩特征之间的相似度,生成相似度矩阵。
- 根据权利要求1所述的方法,其中,所述生成第二特征映射字典之后,所述方法还包括:基于所述第二特征映射字典更新推荐模型,获取所述推荐模型的当前模型精度;获取推荐模型的初始模型精度,根据所述初始模型精度与所述当前模型精度确定推荐模型的模型精度变化值;判断所述模型精度变化值是否不大于预设模型精度下降阈值,若是,则保存所述第二特征映射字典。
- 根据权利要求4所述的方法,其中,若所述模型精度变化值大于预设模型精度下降阈值,则更改所述压缩比例,重新获取第二特征映射字典,直至所述推荐模型的模型精度变化值不大于预设模型精度阈值。
- 根据权利要求1所述的方法,其中,所述第一特征映射字典基于数据集所生成包括:获取数据集,统计所述数据集中商品的属性特征数据;对所述数据集中的属性特征数据进行掩码,生成第一特征映射字典。
- 根据权利要求6所述的方法,其中,所述生成第一特征映射字典之后,所述方法还包括:确定推荐模型的类型,对掩码后的所述数据集进行划分,得到训练集,验证集以及测试集;根据所述训练集与所述验证集训练推荐模型,在训练完成后,基于所述测试集获取推荐模型的初始模型精度。
- 一种基于嵌入表压缩的信息推荐装置,其特征在于,所述装置包括:获取模块,用于获取根据预设压缩比例,确定推荐模型的待压缩嵌入表中的待压缩特征与非压缩特征;压缩模块,用于基于所述待压缩特征与所述非压缩特征之间的相似度,生成相似度索引矩阵;基于所述相似度索引矩阵,生成索引字典;索引模块,用于根据所述索引字典对第一特征映射字典进行替换,生成第二特征映射字典,其中,所述第一特征映射字典基于数据集所生成;预测模块,用于获取待推荐数据,根据所述第二特征映射字典替换所述待推荐数据中的特征,将替换后的特征输入至所述推荐模型,输出预测结果。
- 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至权利要求7中任一项所述的方法的步骤。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至权利要求7中任一项所述的方法的步骤。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US18/595,474 US12423273B2 (en) | 2023-07-03 | 2024-03-05 | Information recommendation method, apparatus, device, and medium based on embedding table compression |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310805640.9A CN116522003B (zh) | 2023-07-03 | 2023-07-03 | 基于嵌入表压缩的信息推荐方法、装置、设备和介质 |
| CN202310805640.9 | 2023-07-03 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US18/595,474 Continuation US12423273B2 (en) | 2023-07-03 | 2024-03-05 | Information recommendation method, apparatus, device, and medium based on embedding table compression |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025007461A1 true WO2025007461A1 (zh) | 2025-01-09 |
Family
ID=87408579
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2023/128561 Ceased WO2025007461A1 (zh) | 2023-07-03 | 2023-10-31 | 基于嵌入表压缩的信息推荐方法、装置、设备和介质 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US12423273B2 (zh) |
| CN (1) | CN116522003B (zh) |
| WO (1) | WO2025007461A1 (zh) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116522003B (zh) | 2023-07-03 | 2023-09-12 | 之江实验室 | 基于嵌入表压缩的信息推荐方法、装置、设备和介质 |
| CN117074628B (zh) * | 2023-10-17 | 2024-01-09 | 山东鑫建检测技术有限公司 | 一种多传感器空气质量检测设备故障定位方法 |
| CN119226296B (zh) * | 2024-11-29 | 2025-05-13 | 之江实验室 | 一种天体数据索引构建方法、装置、存储介质及电子设备 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109447813A (zh) * | 2018-09-05 | 2019-03-08 | 平安科技(深圳)有限公司 | 产品推荐方法、装置、计算机设备和存储介质 |
| WO2021051515A1 (zh) * | 2019-09-16 | 2021-03-25 | 平安科技(深圳)有限公司 | 基于向量迁移的推荐方法、装置、计算机设备及非易失性可读存储介质 |
| US20220114644A1 (en) * | 2021-10-05 | 2022-04-14 | Gopi Krishna Jha | Recommendation system with sparse feature encoding |
| CN115760201A (zh) * | 2023-01-09 | 2023-03-07 | 启客(北京)科技有限公司 | 智能销售线索推荐理由生成方法及系统 |
| CN116522003A (zh) * | 2023-07-03 | 2023-08-01 | 之江实验室 | 基于嵌入表压缩的信息推荐方法、装置、设备和介质 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8386740B2 (en) * | 2010-03-29 | 2013-02-26 | International Business Machines Corporation | Modeling memory compression |
| US10432217B2 (en) * | 2016-06-28 | 2019-10-01 | International Business Machines Corporation | Page filtering via compression dictionary filtering |
| US10572153B2 (en) * | 2016-07-26 | 2020-02-25 | Western Digital Technologies, Inc. | Efficient data management through compressed data interfaces |
| US11609695B2 (en) * | 2020-09-02 | 2023-03-21 | EMC IP Holding Company LLC | Statistical and neural network approach for data characterization to reduce storage space requirements |
| CN114049172B (zh) * | 2021-11-08 | 2025-10-10 | 土巴兔集团股份有限公司 | 物品推荐排序方法、装置、计算机设备及存储介质 |
-
2023
- 2023-07-03 CN CN202310805640.9A patent/CN116522003B/zh active Active
- 2023-10-31 WO PCT/CN2023/128561 patent/WO2025007461A1/zh not_active Ceased
-
2024
- 2024-03-05 US US18/595,474 patent/US12423273B2/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109447813A (zh) * | 2018-09-05 | 2019-03-08 | 平安科技(深圳)有限公司 | 产品推荐方法、装置、计算机设备和存储介质 |
| WO2021051515A1 (zh) * | 2019-09-16 | 2021-03-25 | 平安科技(深圳)有限公司 | 基于向量迁移的推荐方法、装置、计算机设备及非易失性可读存储介质 |
| US20220114644A1 (en) * | 2021-10-05 | 2022-04-14 | Gopi Krishna Jha | Recommendation system with sparse feature encoding |
| CN115760201A (zh) * | 2023-01-09 | 2023-03-07 | 启客(北京)科技有限公司 | 智能销售线索推荐理由生成方法及系统 |
| CN116522003A (zh) * | 2023-07-03 | 2023-08-01 | 之江实验室 | 基于嵌入表压缩的信息推荐方法、装置、设备和介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| US20250013615A1 (en) | 2025-01-09 |
| CN116522003B (zh) | 2023-09-12 |
| US12423273B2 (en) | 2025-09-23 |
| CN116522003A (zh) | 2023-08-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN116522003B (zh) | 基于嵌入表压缩的信息推荐方法、装置、设备和介质 | |
| CN114510525A (zh) | 数据格式转换方法、装置、计算机设备和存储介质 | |
| CN120470150B (zh) | 一种数字孪生模型构件数据的存储方法、设备及介质 | |
| CN111339163A (zh) | 获取用户流失状态的方法、装置、计算机设备和存储介质 | |
| CN116303657A (zh) | 群体画像生成方法、装置、计算机设备和存储介质 | |
| CN116127195A (zh) | 套餐推荐方法、装置、计算机设备、存储介质和程序产品 | |
| CN119377245A (zh) | 日志查询方法、装置、计算机设备和存储介质 | |
| CN118657151A (zh) | 语义特征提取模型训练方法、装置、设备和存储介质 | |
| CN115730596A (zh) | 对象推荐方法、装置和计算机设备 | |
| CN117390011A (zh) | 报表数据处理方法、装置、计算机设备和存储介质 | |
| CN116910115A (zh) | 客群查询方法、装置、计算机设备和存储介质 | |
| CN115481257A (zh) | 文本数据的处理方法、装置、计算机设备、存储介质 | |
| CN110413647B (zh) | 一种高维向量不等长序列相似度快速计算系统 | |
| CN116049350B (zh) | 数据检索方法、装置、计算机设备和存储介质 | |
| CN116910337B (zh) | 实体对象的圈选方法、查询方法、装置、服务器及介质 | |
| CN117312892A (zh) | 用户聚类方法、装置、计算机设备和存储介质 | |
| CN117667999A (zh) | 数据推送方法、装置、计算机设备及计算机可读存储介质 | |
| CN115880023A (zh) | 尺码推荐方法、装置、计算机设备和存储介质 | |
| CN116861326A (zh) | 报表分类方法、装置、计算机设备、存储介质和程序产品 | |
| CN120218292A (zh) | 关联信息的预测方法、装置、计算机设备和存储介质 | |
| CN115456731A (zh) | 电力产品推荐方法、装置、计算机设备、存储介质 | |
| CN116610703A (zh) | 数据查询方法、装置、计算机设备和存储介质 | |
| CN116910604A (zh) | 用户分类方法、装置、计算机设备、存储介质和程序产品 | |
| CN117093874A (zh) | 文本生成方法、装置、计算机设备、介质和程序产品 | |
| CN117112724A (zh) | 搜索推送方法、装置、设备、存储介质和计算机程序产品 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23944182 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |