## 3 Methodology
### Topic Module  
The topic module is mainly divided into two parts: the encoder and the decoder. We assume that each utterance is mapped to a latent variable, which encodes the topic discussed in the multi-speaker dialogue. The decoder reconstructs the input embedding and outputs a topic-aware sentence representation. To make better use of the topic information, we also classify the latent vector during the encoding process to obtain topic category labels, which facilitates the operation of subsequent modules. Since the VAE has both an encoder and a decoder, it can be used as a topic feature extractor and generator at the same time, so we use it to simulate the topic modeling process of neural networks.  
For the input sentence \(u_{i}\), the original input of the encoder is \(BERT_{base}(u)=[[cls],x_{1},\)\(x_{2},\cdots,x_{n},[sep]]\), abbreviated \(X\), which outputs a latent vector \(z\). \(z\) describes the distribution of the conversation topics and obeys the Gaussian distribution, \(z\sim\mathcal{N}(0,1)\). First, a multi-layer perceptron (MLP) is introduced to compute the mean \(\mu(x)\) and variance \(\sigma^{2}(x)\) of the input \(X\). \(x\mid z\sim\mathcal{N}\big{(}\mu(x),\sigma^{2}(x)\big{)}\), where \(\mathcal{N}\big{(}\mu(x),\sigma^{2}(x)\big{)}\) is multidimensional Gaussian distributions, and the components of \(z\) are independent Gaussian distributed random variables.  
\[\mu=FC_{\mu}(x),\sigma^{2}=\text{diag}(FC_{\sigma}(x)) \tag{3}\]  
where \(FC\) denotes the fully connected layer, and the diag converts the column matrix into a diagonal matrix. Then we can calculate the latent variables \(z=\mu+\sigma\cdot\epsilon\), where \(\epsilon\) is a noise variable sampled from \(\mathcal{N}(0,1)\). We add a classification layer after the latent variables to classify the latent variables and get the topic categories \(c\). Let \(p(c\mid z)\) denote the classifier on the latent variable \(z\) and fit it using a softmax layer. According to this, we get the topic category distribution \(q(c)=softmax(z)\)  
The decoder reconstructs the sentence embedding according to the latent variable \(z\) and topic categories \(c\). First, we select a category from the distribution of the topic categories \(q(c)\), then select a random latent variable z from the distribution \(q(z\mid c)\). \(q(x\mid z)\) reconstructs the input embedding through the generator, and we set the selection scheme as \(q(x\mid z,c)=q(x\mid z)\). It should be noted that the generator here is not generating dialogue responses, but extracting latent topics from the current utterance and training the model to reconstruct the sentence representation. We denote the reconstructed topic-aware sentence representation as \(x_{i}^{t}\).  
Based on the syntax-enhanced representations \(x_{i}^{s}\) obtained from the syntax module, and the topic-aware representation \(x_{i}^{t}\) in this module, we design a fusion mechanism that merges the information obtained from these two modules.  
\[g=\text{sigmoid}\Big{(}W^{Fs}x_{i}^{S}+W^{Ft}x_{i}^{t}+b^{F}\Big{)} \tag{4}\]\[x_{i}^{f}=g\odot x_{i}^{s}+(1-g)\odot x_{i}^{t} \tag{5}\]  
where \(W^{Fs}\in\mathbb{R}^{d\times d}\), \(W^{Ft}\in\mathbb{R}^{d\times d}\), and \(b^{F}\in\mathbb{R}^{d}\) are all learnable hyperparameters. \(\odot\) represents matrix multiplication. We use sigmoid to calculate the weights of the syntax-enhanced representation and the topic-aware representation, and the finally calculated \(x_{i}^{f}\in\mathbb{R}^{d}\) is the sentence representation that incorporates both syntactic and topic encoding.