Two common ways that data-driven conversational ai produce turns as response are ir and generation [1]}.
In ir, the system fetches information from some fitting corpus or online, given a dialogue context.
Incorporating ranking and retrieval capabilities provides additional possibilities.
If C is the training set of conversations, given a context c, the objective is to retrieve an appropriate turn r as the response.
Similarity is used as the scoring metric and the highest scoring turn in C gets selected from a potential set.
This can be achieved with different ir methods
and choosing the response with the highest cosine similarity with c [1]}.
This is given in Equation REF .
In an encoder-encoder architecture, for example, one could train the first encoder to encode the query while the second encoder encodes the candidate response and the score is the dot product between the two vectors from both encoders.
In the generation method, a language model or an encoder-decoder is used for response generation, given a dialogue context.
As shown in Equation REF , each token of the response (\(r_t\) ) of the encoder-decoder model is generated by conditioning on the encoding of the query (\(q\) ) and all the previous responses (\(r_{t-1}...r_1\) ), where \(w\)  is a word in the vocabulary \(V\) .
Given the benefit of these two methods, it may be easy to see the advantage of using the hybrid of the two for conversational ai.
\(response (\textit {c,C}) = \arg \max _{r \epsilon C } \frac{c.r}{|c||r|}\) 
\(r_t = \arg \max _{w \epsilon V } P(w|q,r_{t-1}...r_1)\) 
