Patent ID: 11954449
Assignee: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Field: Computer technology (Electrical engineering)
Classification: CPC G  Y | IPC G

Claim 5:
6. An electronic device, comprising:
at least one processor; and
a memory, communicatively coupled to the at least one processor;
wherein the memory is configured to store instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is configured to:
obtain a current conversation and historical conversations of the current conversation;
select a plurality of reference historical conversations from the historical conversations and adding the plurality of reference historical conversations to a temporary conversation set; and
generate reply information of the current conversation based on the current conversation and the temporary conversation set;
wherein the current conversation is represented by rt, the historical conversations are represented by r1, . . . , rt-1, t represents a current time point, and the at least one processor is configured to:
select conversations rt-w, . . . , rt-1 from the historical conversations based on a first preset number w, and to add the conversations rt-w, . . . , rt-1 to the temporary conversation set; and
select a plurality of conversations from the conversations r1, . . . , rt-w-1 based on a selection strategy model, and to add the plurality of conversations selected from the conversations r1, . . . , rt-w-1 to the temporary conversation set, wherein a maximum number n of conversations in the temporary conversation set is greater than w;
wherein the at least one processor is configured to:
input the current conversation and the temporary conversation set into a generation model to generate the reply information;
wherein a training process of the at least one processor comprises:
obtaining a plurality of sample data, the sample data comprising a sample conversation and sample history conversations;
adding random disturbance distribution to the selection strategy model;
inputting each sample data into the selection strategy model and the generation model respectively to obtain a prediction probability of the sample conversation outputted by the selection strategy model and reply information of the sample conversation outputted by the generation model;
performing coefficient adjustment on the generation model based on the reply information of the sample conversation and a loss function of the generation model; and
performing coefficient adjustment on the selection strategy model based on the loss function, the prediction probability of the sample conversation and a target function of the selection strategy model.