User: What is the tallest mountain?
Agent: Everest
User: Where is it located? # Agent hears: "Where is Everest located?"
Agent: Nepal

I want to be able to generate a sequence that has been generated using the user's current query as well as the past conversation.

More specifically, I am using Google's T5 for closed-book question answering, but, instead of trivial questions, we use the user's frequently asked queries.

I want to be able to encode their past questions and the agent's past answers, then use them to generate the agent's next answer. How can I do that?

  • $\begingroup$ Hello. I edited your post. Please, make sure I didn't change its meaning. In particular, I added this part "we use the user's frequently asked queries.", because what you had originally written wasn't clear (at least to me). $\endgroup$
    – nbro
    Commented Sep 20, 2021 at 13:00

1 Answer 1


What you want to look for is called anaphora resolution. You basically keep a record of the past conversation and try and find an antecedent for any occurrences of it, he/she, her/his, etc. You probably want to have a pre-processing step where you substitute the antecedent before passing the input sentence on to the agent.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .