# TR-GPT-CF: A Topic Refinement Method Using GPT and Coherence Filtering
## 2 Materials and Methods
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Aspect** & \multicolumn{1}{c}{LDA} & \multicolumn{1}{c}{**NMF**} & \multicolumn{1}{c}{**BERTopic**} & \multicolumn{1}{c}{**G-BAT**} \\ \hline Type of & \multirow{2}{*}{Probabilistic} & \multirow{2}{*}{Matrix Decomposition} & Neural & Neural \\ Model & & & (Embedding * Clustering) & & (VAE * Adversarial) \\ \hline Input & \multirow{2}{*}{Bag of Words} & \multirow{2}{*}{TF-IDF Matrix} & Contextual & Pre-trained & Embeddings \\  & & & & Embeddings & Embeddings \\ \hline \multirow{3}{*}{Output} & - & Topic as word distribution & - & Topics as ranked words based on embeddings & - & Topics as latent Gaussian distributions \\  & - & Document topic proportions & - & Document topic matrices & - & Document embeddings \\ \hline \multirow{3}{*}{\
\begin{tabular}{c} Topic \\ Representation \\ \end{tabular} } & \multirow{3}{*}{Topic-word} & \multirow{3}{*}{Topic-word} & Cluster centers and their & \multirow{3}{*}{Latent space clusters} \\  & & & & representative words & \\ \hline \multirow{3}{*}{Strength} & - & Easy to implement & - & Easy to implement & - & Captures semantic relationship \\  & - & Interpretable & - & Fast and scalable & - & Dynamic topic reduction \\ \hline \multirow{3}{*}{Weakness} & - & Loss word order & - & Loss contextual relationship & - & Computationally expensive \\  & - & Struggles with short or & - & Requires TF-IDF preprocessing & - & Depends on embedding \\  & - & & & quality & - \\ \hline \multirow{3}{*}{
\begin{tabular}{c} Best Use \\ Cases \\ \end{tabular} } & - & Long documents & - & Moderate size datasets & - & Semantic topic modeling & - & Complex pattern in data \\  & - & Traditional NLP pipelines & - & - & Dynamic topic reduction & - & Short texts with sparse \\ \hline \multirow{3}{*}{Application} & - & News categorization & - & Social media analysis & - & Domain specific document \\  & - & Large-scale document & - & Product review & - & Short-text classification \\  & - & analysis & - & Survey analysis & - & Customer feedback analysis \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Summary of topic modeling techniques. not only enhances the versatility of our framework but also enables customization of our studies to meet specific requirements and accommodate different datasets. We then use the extracted topics from such topic modeling techniques as an input in our proposed topic refinement method, TR-GPT-CF, which consist of two main functions: misaligned word detection, which semantically detects words that deviate significantly from the centroid of the topic, and misaligned word replacement, which leverages WordNet [51; 52] and GPT-3.5 (model _gpt-3.5-turbo-1106_) from OpenAI API [53] to provide contextually appropriate replacements. The integration of these components guarantees that the refined topics exhibit enhanced coherence while preserving their interpretability for practical applications. To quickly understand the method, please see the pseudo-algorithm outlined in Algorithm 2. ```
Input: A set of topics \(T=[t_{1},t_{2},\ldots,t_{k}]\), Embedding model \(\mathbf{M}\), Corpus \(\mathbf{C}\), Large Language Model \(\mathbf{L}\), WordNet \(\mathbf{W}\), Z-score threshold \(\boldsymbol{\theta}_{t}\), Inverse document frequency threshold \(\boldsymbol{\theta}_{t}\) Output: Refine topics \(\mathbf{T}^{*}=\{\|t_{1},t_{2},\ldots,t_{k}\|\).