US 12,293,300 B2
Method and apparatus for training semantic retrieval network, electronic device and storage medium
Yingqi Qu, Beijing (CN); Yuchen Ding, Beijing (CN); Jing Liu, Beijing (CN); Hua Wu, Beijing (CN); and Haifeng Wang, Beijing (CN)
Assigned to BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD., Beijing (CN); and CO., LTD., Beijing (CN)
Filed by BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD., Beijing (CN)
Filed on Sep. 7, 2022, as Appl. No. 17/930,221.
Claims priority of application No. 202111168520.X (CN), filed on Sep. 30, 2021.
Prior Publication US 2023/0004819 A1, Jan. 5, 2023
Int. Cl. G06N 5/01 (2023.01); G06F 16/2457 (2019.01); G06F 40/30 (2020.01)
CPC G06N 5/01 (2023.01) [G06F 16/24578 (2019.01); G06F 40/30 (2020.01)] 12 Claims
OG exemplary drawing
 
1. A method for training a semantic retrieval network, wherein the semantic retrieval network comprises a semantic retrieval model and a ranking model, and the method comprises:
obtaining a training sample comprising a search term and n candidate documents corresponding to the search term, where n is an integer greater than 1;
inputting the training sample into the ranking model, to obtain n first correlation degrees output by the ranking model, wherein each first correlation degree represents a correlation between a candidate document and the search term;
inputting the training sample into the semantic retrieval model, to obtain n second correlation degrees output by the semantic retrieval model, wherein each second correlation degree represents a correlation between a candidate document and the search term;
training the semantic retrieval model and the ranking model jointly based on the n first correlation degrees and the n second correlation degrees; and
finding information related to an input search term by using the semantic retrieval network;
wherein the n candidate documents comprise a positive example candidate document and n−1 negative example candidate documents, and training the semantic retrieval model and the ranking model jointly based on the n first correlation degrees and the n second correlation degrees, comprises:
calculating a first loss value of the ranking model based on the first correlation degree between the search term and the positive example candidate document, and the first correlation degree between the search term and each negative example candidate document; the first loss value is used to represent a difference between the first correlation degree and a real sample value;
calculating a second loss value of the semantic retrieval model based on the n first correlation degrees and the n second correlation degrees; the second loss value is used to represent a difference between the n second correlation degree and the n first correlation degree;
calculating a joint loss value based on the first loss value and the second loss value; and
training the semantic retrieval model and the ranking model jointly according to the joint loss value.