# Grounding in social media: An approach to building a
chit-chat dialogue model

Ritvik Choudhary
Waseda University
<EMAIL_ADDRESS>
&Daisuke Kawahara
Waseda University
<EMAIL_ADDRESS>

###### Abstract

Building open-domain dialogue systems capable of rich human-like
conversational ability is one of the fundamental challenges in language
generation. However, even with recent advancements in the field, existing
open-domain generative models fail to capture and utilize external knowledge,
leading to repetitive or generic responses to unseen utterances. Current work
on knowledge-grounded dialogue generation primarily focuses on persona
incorporation or searching a fact-based structured knowledge source such as
Wikipedia. Our method takes a broader and simpler approach, which aims to
improve the raw conversation ability of the system by mimicking the human
response behavior through casual interactions found on social media. Utilizing
a joint retriever-generator setup, the model queries a large set of filtered
comment data from Reddit to act as additional context for the seq2seq
generator. Automatic and human evaluations on open-domain dialogue datasets
demonstrate the effectiveness of our approach.

##  1 Introduction

Humans have long wanted to talk with the machine and have them comprehend and
generate natural language. The task of chit-chat dialogue response generation
can be described as one of the major goals in natural language processing. As
such, there has been considerable interest in the sub-field of open-domain
dialogue models.

Nevertheless, the existing dialogue response generation models still suffer
from some very fundamental problems: lack of interesting (“Ok”, “I see", etc.)
or uninformative responses (“I don’t know") (Li et al., 2016a, Shao et al.,
2017, Ghazvininejad et al., 2017). The primary cause for this is that, unlike
humans, the models do not have access to knowledge, experience about out-of-
domain topics or human conversational habits and hence can only produce
limited unengaging generic responses.

Recent work has proposed considering additional context information such as
multi-turn conversational history Zhang et al. (2018), persona Li et al.
(2016b) or a fact-based knowledge base Dinan et al. (2019). Among these, our
work approaches this problem from a more general standpoint of improving the
raw conversational ability of generative models. We attempt this by taking
inspiration from how humans learn to converse, i.e., through mimicking social
interactions. Applying this in the context of dialogue models, we use a human-
readable external knowledge base consisting solely of unstructured social
media interactions (hereinafter referred to as SMIkb), which tends to include
a more diverse language structure and hence improve generated responses.

For our approach, we jointly train a generator-retriever model where the
retriever searches through pre-indexed SMIkb and feeds the related information
together with the input utterance to the generative seq2seq model, allowing
for additional context at the time of generation.

In particular, we utilize the Dense Passage Retriever proposed by Karpukhin et
al. (2020) on top of BART Lewis et al. (2020a) as our generational model
trained on a mix of open-domain dialogue datasets, together with a collection
of Reddit submissions and comments as our main source of social interactions.
Experiments showed that our approach outperformed the existing vanilla seq2seq
baseline (BART) across all of the automatic and human evaluation metrics. By
making use of interactions grounded in social media, the generated responses
were not only more engaging but were also shown to be much more relevant and
natural, thus establishing the effectiveness of our approach.

##  2 Related Work

Figure 1: Our proposed dialogue response generation approach grounded in SMIkb
through a jointly trained retriever-seq2seq generator setup. Utterance $u$ is
encoded and matched against titles (in red) where the respective comments
($k$, in blue) are retrieved from the SMIkb. These act as an additional
context for the generator to generate the final dialogue response $r$.

#### Dialogue Systems

In recent years, major breakthroughs beginning with the Transformer Vaswani et
al. (2017) and BERT Devlin et al. (2019) have quickly shifted the landscape of
modern NLP research. These were shortly followed by auto-regressive seq2seq
models (T5 Raffel et al. (2020), BART) that significantly improved performance
on generation-based tasks such as dialogue systems. We adopt the widely
accessible BART as our strong baseline.

#### Knowledge-based Conversational Models

Incorporating additional context or external information into existing models
has been a field of much interest lately. Persona-chat Zhang et al. (2018) or
Empathetic Dialogues Rashkin et al. (2019) take into account persona or
empathetic information. Furthermore, advancements making use of knowledge
bases in the area of open-domain dialogue systems have become increasingly
common Ghazvininejad et al. (2017); Dinan et al. (2019). The closest work to
ours, in terms of including a retrieval step for dialogue generation, is
Weston et al. (2018), which proposed an approach involving pre-training the
retriever and generating only over the candidates retrieved in advance from
the training set. More recently Roller et al. (2021) also tested retrieval-
based dialogue generation. However, similar to Weston et al. (2018), they
utilized a retrieval model that was kept fixed during training. Our work
meanwhile follows a different direction that does not require pre-training of
the retriever but fine-tunes it along with the generator to retrieve over a
much larger knowledge base of interactions at generation time.

We would also like to mention Shuster et al. (2021), which investigates
factual hallucination in dialogue retrieval-generation models with a fact-
based knowledge base such as Wikipedia. Our work takes a more generalized
approach, focusing solely on improving the raw conversational ability of
dialogue models. Instead of factual accuracy, we propose a simple approach for
generating an engaging conversation grounded in unstructured social media
interactions.

##  3 Proposed Approach

In this section, we discuss our approach to introducing social media
interactions as an external knowledge base (SMIkb) to ground in for more
natural and human-like response generation. We begin with formulating the task
of dialogue generation and then proceed to explain our joint retriever-
generator model as the proposed setup for utilizing the aforementioned
unstructured data source. Note that in this work, we primarily focus on
response generation for single-turn dialogues or dialogues. We decided that
other settings such as a multi-turn case were best addressed in future work.

###  3.1 Task Formulation

Our task of response generation grounded in external knowledge can be
formulated as training a model to predict a response
$\mathbf{r}=(r_{1},r_{2},...,r_{m})$ of $m$ words when given an input
utterance $\mathbf{u}$ and a set of documents $\mathcal{D}$ that might contain
relevant knowledge. We define our goal as to allow the model to learn the
parameters such that when given an input utterance $\mathbf{u}$ and a
knowledge base $\mathcal{D}$, the model can generate a response $\mathbf{r}$
following the probability
$p(r_{i}|\mathbf{u},\mathbf{r}_{<i},\mathcal{D};\theta)$, where $\theta$
refers to the parameters of the model.

###  3.2 Model

Inspired by recent advances in retrieval assisted QA Guu et al. (2020); Lewis
et al. (2020b), we adopt a simple joint retriever-generator setup to the task
of dialogue generation. Concretely, we utilize BART, a seq2seq model pre-
trained on a denoising objective, as our generative model along with the pre-
trained neural Dense Passage Retriever (DPR) Karpukhin et al. (2020) as the
retriever of choice. DPR is a highly efficient neural retriever pre-trained
for retrieving the top-$\bm{k}$ similar documents to an input query $\bm{u}$.
It executes this by encoding both the query and the entire knowledge base
through independent BERT-based encoders (as $\bm{t}$). Furthermore, we follow
Karpukhin et al. (2020) to build an offline searchable dense vector index of
these embeddings for our SMIkb using the FAISS Johnson et al. (2017) library
for faster lookup. An overview of our architecture is shown in Figure 1.
Application of our model to dialogue response generation can be formulated as
a two-step process: (1) the retriever searching top-$k$ documents from the
pre-indexed interaction knowledge base, relevant to the input utterance, and
(2) the generator predicting the response to the previous utterance along with
the retrieved context.

Following the notion set in Section 3.1, the probability of generating the
response $\mathbf{r}$ given the utterance $\mathbf{u}$ and each of the top-$k$
documents ${d}_{j}$ from the knowledge base $\mathcal{D}$ can be defined as

$\leavevmode\resizebox{469.75499pt}{}{$p(\mathbf{r}|\mathbf{u};\theta,\lambda)=\sum_{j}^{k}p_{\lambda}(d_{j}|\mathbf{u};\lambda)\prod_{i}p_{\theta}(r_{i}|\mathbf{u},\mathbf{r}_{<i},d_{j};\theta)$},$
(1)

where $\theta$ and $\lambda$ are parameters for the generator and retriever,
respectively. They are both fine-tuned jointly in an end-to-end fashion, with
the retriever providing additional context that is concatenated together with
the input at the time of generation. As there is no “correct” document source
in the knowledge base, we consider it to be a latent variable. Therefore,
during decoding we marginalize these probabilities over all the retrieved
documents to return the most probable (best) response using beam search.

Dataset | Total (turns) | Train | Valid | Test
---|---|---|---|---
DailyDialog | 76,743 | 53,721 | 11,511 | 11,511
DailyDialog++ | 39,913 | 27,939 | 5,987 | 5,987
Cornell Movie-Dialogs | 221,088 | 154,762 | 33,163 | 33,163
Reddit (pseudo extracted) | 200,000 | 140,000 | 30,000 | 30,000

Table 1: Overview of datasets in use.

##  4 Experiments

We evaluate our model together with various external knowledge datasets on a
mixture of open-domain dialogue datasets. The results are then compared with
two BART-based baselines.

Model Setup | Training | Knowledge Base |  |  |  | BLEU-4 | Dist-1 | Dist-2 |  |  |
---|---|---|---|---|---|---|---|---|---|---|---
| Data | (Retrieval) |  |  |  |  |  |  |  |  |
Baseline 1 | ODD | None |  |  |  | 1.31 | 0.20 | 0.96 |  |  |
Baseline 2 | ODD + SMIkb | None |  |  |  | 1.05 | 0.12 | 0.47 |  |  |
|  |  | $k=3$ | $k=5$ | $k=7$
|  |  | BLEU-4 | Dist-1 | Dist-2 | BLEU-4 | Dist-1 | Dist-2 | BLEU-4 | Dist-1 | Dist-2
Ours (SMIkb) | ODD | SMIkb | 9.78 | 2.80 | 16.90 | 10.51 | 5.50 | 26.63 | 10.48 | 5.51 | 26.62
Ours (Wiki) | ODD | Wiki | 6.93 | 2.57 | 14.91 | 7.14 | 4.94 | 23.38 | 7.11 | 5.02 | 23.79
Ours (Mix) | ODD | SMIkb + Wiki | 6.03 | 2.45 | 14.08 | 6.20 | 4.71 | 22.25 | 6.21 | 4.71 | 22.23

Table 2: Automatic evaluation of generated responses across various values of
$k$ for top-$k$ document retrieval. The baselines do not have a retrieval step
and therefore do not have an effect due to changing $k$. bold refers to the
best scores across all $k$ among the generated responses. ODD is the
collection of Open-Domain Datasets from Section 4.2.

Model Setup | Human Eval.
---|---
| Relevance | Engagement | Knowledge
Gold (Test-Data) | 3.50 | 3.33 | 3.47
Baseline 1 | 2.82 | 2.35 | 3.00
Baseline 2 | 3.03 | 3.02 | 2.89
Ours (SMIkb) | 3.84 | 3.75 | 3.60
Ours (Wiki) | 3.40 | 3.75 | 3.76
Ours (Mix) | 3.62 | 3.80 | 3.71

Table 3: Human evaluation of responses for the best $k=5$.

Input Utterance |  SMIkb |  Wiki |  Mix |  Baseline
---|---|---|---|---
Here comes the birthday cake. |  Wow, what a lovely cake. I’ll have a piece. |  Wow, what a beautiful cake. It must have tasted as good as I expected. |  Really? Wow. Happy birthday to you! You look so healthy. |  Thank you.
I’d better go. I gotta get up early. Go over to my parents’. |  What are you going to do for breakfast? |  You mean you don’t wanna go with me? |  Why don’t you stay at my place? I’ll cook dinner. |  I don’t think so.
Something’s burning? |  Oh my goodness, it’s on fire! |  Oh my goodness, it ’ s burning! |  Oh, my bread! It’s burning! |  No, it’s not.
Would you mind if we just called it an early night? |  Even I couldn’t. I have work tomorrow. |  I’d love to. But I’ve got to work tomorrow. |  What are you talking about? We just ate? |  I don’t think so.
Isn’t it wonderful walking here? |  What do you mean? Was it bad? |  Not at all. The air is fresh, the walk is easy and the sunshine is kind. |  Yes, you can see the whole city from here. |  Yes, it’s very beautiful.

Table 4: A comparison of responses generated from various sources.

SMIkb
---
| title
---
| text
---
| LPT: If you borrow something like a tool or a generator
---
from someone, return it in BETTER shape than you got it.
| My dad always said that returning something in the
---
same condition you received it is the absolute bare minimum.
| SoftBank Nears $40 Billion Deal to Sell Arm Holdings to Nvidia
---
| Nvidia is priced decentlyfor what they offer.
---
| Apple to Give Employees Paid Time Off to Vote in U.S. Election
---
| This exactly. A large majority of disenfranchised
---
communities work jobs that don’t observe federal holidays.
| Apple may be working on a foldable iPhone
---
| I can confirm that Apple would be stupid to not be working on one.
---
Whether they ever release one is up for debate,
but they’re definitely working on one.

Table 5: Snapshot of SMIkb.

Input Utterance |  SMIkb |  Wiki |  Mix |  Baseline
---|---|---|---|---
Who was the conductor? |  Oh speaking of the conductor, he was indeed a genius. A descendent of Chinese. |  I don’t remember the name. |  Oh, speaking of the conductor, he did an excellent job. |  I know.
Oh god you scared me! |  Ahahah! We need a fitness instructor. |  I’m sorry. |  Sorry. I was trying to scare you. |  Is something wrong?

Table 6: Selected examples where the proposed model struggles or fails at
generating a relevant response.

###  4.1 SMIkb

Aiming to improve the raw communication ability of dialogue systems by
mimicking human response behavior, we built our external knowledge base of
unstructured social media interactions (SMIkb). It comprises of entries from
top thread titles and their top 100 comments from Reddit, an American social
news aggregation and discussion site, throughout 2020 (January-November). A
total of 1.6 million entries were first scraped through the open-sourced
Pushshift API Baumgartner et al. (2020) of which a random selection of 600,000
(due to memory limitations) makes up our SMIkb. A snapshot of the same is
shared in Table 5.

Furthermore, to verify the effectiveness of using a conversational knowledge
base like Reddit, we compared ours to a pure Wikipedia knowledge base (ref.
“Wiki”) of the same size (random sample of 600k entries) containing the wiki
page title and the leading 100 words. Additionally, we also tested a 1:1
combination of the above two bases (ref. “Mix”).

###  4.2 Datasets

We fine-tune our models on a variety of open-domain and scraped dialogue
datasets.

#### Open-domain datasets

We use a combination of DailyDialog Li et al. (2017) and DailyDialog++ Sai et
al. (2020) as high-quality daily life-based dialogue sets. We also consider
the Cornell Movie-Dialogs Corpus Danescu-Niculescu-Mizil and Lee (2011), which
is a corpus of scripts of movie dialogues.

#### Reddit

Furthermore we extract another 200,000 comment pairs from Reddit, distinct
from the SMIkb, to act as a pseudo dialogue dataset to supplement our
knowledge base.

An overview of the datasets is listed in Table 1.

###  4.3 Experimental Setup

#### Implementation Details

Our joint retriever-generator model consists of a pre-trained Dense Passage
Retriever and BART-large (24 layers, 406M), which are later fine-tuned
together on SMIkb and dialogue datasets. The model is trained mostly with the
default parameters, batch size of 1, and an initial learning rate of $3\times
10^{-5}$. We further experiment with various values of $k$ for our top-$k$
document retrieval, while beam search with size of $5$ is used as our response
decoding strategy.

#### Baseline

We consider two strong baselines based on a vanilla BART-large with no
retriever to investigate the effectiveness of our approach. The first is fine-
tuned solely on the datasets mentioned in Section 4.2 (ref. “Baseline 1”) with
no SMIkb. Next to confirm the effectiveness of our providing external data
through our retriever-generator setup, we merge the entire SMIkb interactions
into our training data, and simply fine-tune the vanilla model on this new
extended set. (ref. “Baseline 2”). Note that although we choose BART as our
generator and baseline for its size and relative ease in training, our
proposed SMIkb based modeling setup could possibly also be extended to larger
models.

###  4.4 Evaluation

To measure the impact of social media interactions, the generated responses
were evaluated through both automatic and human evaluations. The results are
compiled in Tables 2 and 3.

#### Automatic

We perform a series of automatic evaluations on the generated responses.
Starting with the BLEU Papineni et al. (2002) score for relevancy, we also
calculate Distinct-N Li et al. (2016a) for the amount of diversity introduced.

#### Human

It has been widely reported that automatic metrics do not sufficiently
evaluate the actual quality of the generated outputs Liu et al. (2016). Thus,
we additionally performed human evaluation of the responses with the highest
BLEU ($k=5$) through Amazon Mechanical Turk, on the following three metrics:
Relevance, whether the response is relevant to the utterance; Engagement,
whether the response makes the conversation engaging; and Knowledge, whether
the response seems knowledgeable or sensible. The evaluators were asked to
score 100 responses selected at random from the test set, on a scale of 1-5.
Each response was scored by 7 different evaluators, and their average was
calculated. We selected our evaluators to be English speakers from the United
States with an approval rate of over 90%.

###  4.5 Discussion

First, with automatic evaluation, we observe that our method of introducing
social interactions through a retriever at generation time maintains task
performance and allows for a more diverse set of responses, as shown with an
increase in all of the measured metrics over both the baselines. Moreover, our
Reddit-based SMIkb model outperformed other combinations, confirming an
increase in response quality. Furthermore, experiments comparing the effect of
top-$k$ on generation quality showed $k=5$ as the sweet spot with the highest
BLEU, which was then evaluated further.

Similar to the automatic evaluation, all of the proposed combinations showed
improvements over the baseline in human evaluation. In line with our initial
hypothesis, the SMIkb model recorded the highest score in terms of
conversational relevance. Meanwhile, the mix of SMIkb and Wikipedia seems to
find the appropriate balance between conversational ability and
“knowledgeability” with the metrics even exceeding the gold score. We
hypothesize that this is not just due to high generation quality but also the
nature of our task, which might make our model responses more relevant to a
worker when assessed in a single-turn context. Overall, the results verified
our proposed approach of learning directly from social media interactions
leading to large improvements over the baseline in all metrics of interest.
Furthermore, significance tests of bootstrap re-sampling showed that the above
evaluation score differences between baselines and our models were
statistically significant ($p<0.01$). Examples of the various generated
responses across all the models are shared in Table 4.

In addition, we looked at cases where our model struggles or fails at
generating a natural response, a select few of which are compiled in Table 6.
In some of these particular cases, the baseline generations, although generic,
turn out to be more relevant. We believe some of these long responses with
unrelated information to be an artifact of our generation model being overly
dependent on the knowledge base. While social media may simulate human-like
conversations in a large variety of situations, it is still far from being a
perfect stand-in for real-life dialogue. Therefore, our future work in this
direction should look at not only the quality and scope of the knowledge base,
but also consider selecting when to ground and make use of the said knowledge
during response generation.

##  5 Conclusion

We aimed to improve the raw conversational ability of dialogue systems by
grounding the responses in much more human-like social media interactions. Our
approach involved a neural retriever-seq2seq generator model fine-tuned
jointly, where relevant knowledge was retrieved at the time of generation to
assist a more engaging and natural dialogue response. Our experiments showed
significant improvements with both automatic and human evaluation metrics
ranking the SMIkb-grounded replies to be much more diverse, engaging, and
relevant.

## Acknowledgements

This work was supported by a joint research grant from LINE Corporation.

## References

  * Baumgartner et al. (2020) Jason Baumgartner, Savvas Zannettou, Brian Keegan, Megan Squire, and Jeremy Blackburn. 2020.  The pushshift reddit dataset.  In _Proceedings of the Fourteenth International AAAI Conference on Web and Social Media, ICWSM 2020, Held Virtually, Original Venue: Atlanta, Georgia, USA, June 8-11, 2020_ , pages 830–839. AAAI Press.
  * Danescu-Niculescu-Mizil and Lee (2011) Cristian Danescu-Niculescu-Mizil and Lillian Lee. 2011.  Chameleons in imagined conversations: A new approach to understanding coordination of linguistic style in dialogs.  In _Proceedings of the 2nd Workshop on Cognitive Modeling and Computational Linguistics_ , pages 76–87, Portland, Oregon, USA. Association for Computational Linguistics.
  * Devlin et al. (2019) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019.  BERT: Pre-training of deep bidirectional transformers for language understanding.  In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_ , pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics.
  * Dinan et al. (2019) Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. 2019.  Wizard of wikipedia: Knowledge-powered conversational agents.  In _International Conference on Learning Representations_.
  * Ghazvininejad et al. (2017) Marjan Ghazvininejad, Chris Brockett, Ming-Wei Chang, Bill Dolan, Jianfeng Gao, Wen-tau Yih, and Michel Galley. 2017.  A knowledge-grounded neural conversation model.  _arXiv preprint arXiv:1702.01932_.
  * Guu et al. (2020) Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. 2020.  Realm: Retrieval-augmented language model pre-training.
  * Johnson et al. (2017) Jeff Johnson, Matthijs Douze, and Hervé Jégou. 2017.  Billion-scale similarity search with gpus.  _arXiv preprint arXiv:1702.08734_.
  * Karpukhin et al. (2020) Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020.  Dense passage retrieval for open-domain question answering.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 6769–6781, Online. Association for Computational Linguistics.
  * Lewis et al. (2020a) Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020a.  BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 7871–7880, Online. Association for Computational Linguistics.
  * Lewis et al. (2020b) Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. 2020b.  Retrieval-augmented generation for knowledge-intensive nlp tasks.  In _Advances in Neural Information Processing Systems_ , volume 33, pages 9459–9474. Curran Associates, Inc.
  * Li et al. (2016a) Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. 2016a.  A diversity-promoting objective function for neural conversation models.  In _Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_ , pages 110–119, San Diego, California. Association for Computational Linguistics.
  * Li et al. (2016b) Jiwei Li, Michel Galley, Chris Brockett, Georgios Spithourakis, Jianfeng Gao, and Bill Dolan. 2016b.  A persona-based neural conversation model.  In _Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 994–1003, Berlin, Germany. Association for Computational Linguistics.
  * Li et al. (2017) Yanran Li, Hui Su, Xiaoyu Shen, Wenjie Li, Ziqiang Cao, and Shuzi Niu. 2017.  DailyDialog: A manually labelled multi-turn dialogue dataset.  In _Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers)_ , pages 986–995, Taipei, Taiwan. Asian Federation of Natural Language Processing.
  * Liu et al. (2016) Chia-Wei Liu, Ryan Lowe, Iulian Serban, Mike Noseworthy, Laurent Charlin, and Joelle Pineau. 2016.  How NOT to evaluate your dialogue system: An empirical study of unsupervised evaluation metrics for dialogue response generation.  In _Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing_ , pages 2122–2132, Austin, Texas. Association for Computational Linguistics.
  * Papineni et al. (2002) Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002.  Bleu: a method for automatic evaluation of machine translation.  In _Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics_ , pages 311–318, Philadelphia, Pennsylvania, USA. Association for Computational Linguistics.
  * Raffel et al. (2020) Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020.  Exploring the limits of transfer learning with a unified text-to-text transformer.
  * Rashkin et al. (2019) Hannah Rashkin, Eric Michael Smith, Margaret Li, and Y-Lan Boureau. 2019.  Towards empathetic open-domain conversation models: A new benchmark and dataset.  In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_ , pages 5370–5381, Florence, Italy. Association for Computational Linguistics.
  * Roller et al. (2021) Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Eric Michael Smith, Y-Lan Boureau, and Jason Weston. 2021.  Recipes for building an open-domain chatbot.  In _Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume_ , pages 300–325, Online. Association for Computational Linguistics.
  * Sai et al. (2020) Ananya B. Sai, Akash Kumar Mohankumar, Siddhartha Arora, and Mitesh M. Khapra. 2020\.  Improving dialog evaluation with a multi-reference adversarial dataset and large scale pretraining.  _Transactions of the Association for Computational Linguistics_ , 8:810–827.
  * Shao et al. (2017) Yuanlong Shao, Stephan Gouws, Denny Britz, Anna Goldie, Brian Strope, and Ray Kurzweil. 2017.  Generating high-quality and informative conversation responses with sequence-to-sequence models.  In _Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing_ , pages 2210–2219, Copenhagen, Denmark. Association for Computational Linguistics.
  * Shuster et al. (2021) Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. 2021.  Retrieval augmentation reduces hallucination in conversation.
  * Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017.  Attention is all you need.
  * Weston et al. (2018) Jason Weston, Emily Dinan, and Alexander Miller. 2018.  Retrieve and refine: Improved sequence generation models for dialogue.  In _Proceedings of the 2018 EMNLP Workshop SCAI: The 2nd International Workshop on Search-Oriented Conversational AI_ , pages 87–92, Brussels, Belgium. Association for Computational Linguistics.
  * Zhang et al. (2018) Saizheng Zhang, Emily Dinan, Jack Urbanek, Arthur Szlam, Douwe Kiela, and Jason Weston. 2018.  Personalizing dialogue agents: I have a dog, do you have pets too? In _Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 2204–2213, Melbourne, Australia. Association for Computational Linguistics.


11institutetext: M. V. Lomonosov Moscow State University, Russia
11email<EMAIL_ADDRESS>22institutetext: Moscow Research Center, Huawei
Technologies, Russia 33institutetext: National Research University Higher
School of Economics, Russia 44institutetext: Artificial Intelligence Research
Institute, Russia
44email<EMAIL_ADDRESS>55institutetext: Moscow Institute of Physics and
Technology, Russia
55email<EMAIL_ADDRESS><EMAIL_ADDRESS>
# Variational Autoencoders for Precoding Matrices with High Spectral
Efficiency

Evgeny Bobrov
Alexander Markov 11 2 2 0000-0002-2584-6649  55 Sviatoslav Panchenko 55 Dmitry
Vetrov 33 4 4

###### Abstract

Neural networks are used for channel decoding, channel detection, channel
evaluation, and resource management in multi-input and multi-output (MIMO)
wireless communication systems. In this paper, we consider the problem of
finding precoding matrices with high spectral efficiency (SE) using
variational autoencoder (VAE). We propose a computationally efficient
algorithm for sampling precoding matrices with minimal loss of quality
compared to the optimal precoding. In addition to VAE, we use the conditional
variational autoencoder (CVAE) to build a unified generative model. Both of
these methods are able to reconstruct the distribution of precoding matrices
of high SE by sampling latent variables. This distribution obtained using VAE
and CVAE methods is described in the literature for the first time.

###### Keywords:

MIMO Precoding Optimization DL VAE SE SINR.

##  1 Introduction

Massive multiple-input multiple-output (MIMO) is one of the core technologies
of the fifth-generation (5G) wireless systems as it promises significant
improvements in spectral efficiency (SE) [27], compared to the traditional,
small-scale MIMO. Massive MIMO scales up the number of antennas in a
conventional system by orders of magnitude [23]. In multi-user (MU) massive
MIMO, the infrastructure base stations (BSs) are equipped with hundreds of
antenna elements that simultaneously serve tens of user equipments (UEs) in
the same frequency band.

A key advantage of the massive number of antennas is that the SE quality is
significantly improved by employing simple linear signal processing techniques
[5], [14], [1], [2]. In multiple-input multiple-output (MIMO) systems with a
large number of antennas, precoding is an important part of downlink signal
processing, since this procedure can focus the transmission signal energy on
smaller areas and allows for greater spectral efficiency with less transmitted
power [18], [3], [6].

Various linear precodings allow to direct the maximum amount of energy to the
user as Maximum Ratio Transmission (MRT) or completely get rid of the inter-
user interference as Zero-Forcing (ZF) [20]. There are also different non-
linear precoding techniques such as Dirty Paper Coding (DPC), Vector
Perturbation (VP), and L-BFGS SE Optimization, which achieve better SE quality
than linear methods but have higher implementation complexity [24]. The
authors of L-BFGS SE Optimization reduce the task of finding precoding
matrices with high spectral efficiency to an unconstrained optimization
problem using a special differential projection method and solve it by the
Quasi-Newton iterative procedure to achieve gains in capacity [34]. We take
this work as a basis and accelerate the solution of the iterative procedure
using machine learning methods.

The application of machine learning in the field of wireless communication has
been widely studied [32], [29], [8], [33] and deep neural network technology
has recently become a promising tool in the field of wireless physical layer
technology [30]. In [31], deep reinforcement learning is applied to a new
decentralized resource allocation mechanism for communication between
vehicles. In [4], deep learning tools are used to automatically configure
1-bit precoders in complex MU precoding algorithms. The [26] offers a deep
energy autoencoder for incoherent MU-MIMO systems with multiple carriers,
achieving higher reliability and flexibility. [10] has developed a new
collaborative hybrid processing platform based on deep learning for end-to-end
optimization. A beam selection method based on a deep neural network is
proposed by [22]. In [12], the choice of a delayed repeater based on deep
learning for secure cognitive relay networks with buffer management is
investigated.

Among the machine learning methods [29], [30], variational autoencoder (VAE)
is a generative model that is widely applied in unsupervised and supervised
learning [32]. VAE is used in many areas, including image processing ,[25],
text data processing [17], and recommendation systems [15]. A method using VAE
for blind channel equalization has also been proposed in [9], and this study
demonstrates the benefits of VAE for solving the precoding (beamforming)
problem in the wireless MIMO system. A method using VAE in the field of data
transmission is proposed in [16].

This work studies the potential of variational autoencoder (VAE) and
conditional variational autoencoder (CVAE) in wireless MIMO systems as deep
learning precoding methods. Both VAE and CVAE methods can be used to learn the
distribution of precoding matrices with high spectral efficiency. Models of
VAE and CVAE are based on the encoder-decoder structure and also utilize
latent variables sampled from the standard normal distribution in order to
assist decoding and sampling. The framework of variational optimization is
constructed. Based on the theory of Bayesian inference, the parameters of the
VAE model are obtained through the maximization of Variational Lower Bound
(VLB). The proposed VAE/CVAE approach is compared with the complex and highly
efficient optimization of L-BFGS [34] [7]. In the case of a single antenna,
which is a special case of MIMO, high values of average SE similar to that of
L-BFGS can be achieved using precoding matrices sampled from VAE/CVAE with
less execution time than the iterative optimization L-BFGS method. We measure
the quality of the models using Signal-to-Interference-and-Noise-Ratio (SINR)
[28] and spectral efficiency (SE) [27].

The remainder of this paper is organized as follows. In Section 2 we describe
the variational autoencoder model. In Section 3 we describe the system model
of the studied Massive MIMO network. In Section 4 we set up the problem that
is being solved. In Section 5 we investigate the distribution of precoding
matrices corresponding to the same spectral efficiency values. Here we also
consider the problem of finding a good precoding matrix using a particular
deep learning model — so-called conditional variational autoencoder. Section 6
contains numerical results and Section 7 contains the conclusion.

##  2 Variational Autoencoder

Given a set of independent and identically distributed samples from true data
distribution $W_{i}\sim p_{d}(W)$, $i=1,\dots,N$, variational autoencoder
(VAE) is used to build a probabilistic model $p_{\theta}(W)$ of the true data
distribution $p_{d}(W)$.

VAE is a generative model that uses latent variables for the distribution
reconstruction and sampling. Using VAE, it is possible to sample new objects
from the model distribution $p_{\theta}(W)$ in two steps:

  1. 1.

Sample $Z\sim p(Z)$.

  2. 2.

Sample $W\sim p_{\theta}(W|Z)$.

Here $Z$ is a latent variable from a fixed prior distribution $p(Z)$. The
parameters of the distribution $p_{\theta}(W|Z)$ are obtained using a neural
network with weights $\theta$ and $Z$ as an input, namely
$p_{\theta}(W|Z)=\mathcal{N}(W|\mu_{\theta}(Z),\sigma^{2}_{\theta}(Z)I)$. In
this case the output of the network is a pair of mean $\mu_{\theta}(Z)$ and
dispersion $\sigma^{2}_{\theta}(Z)$ of the reconstructed distribution. This
network is called a generator, or a decoder.

To fit the model to data we maximize marginal log-likelihood $\log
p_{\theta}(W)$ of the train set. However, $\log p_{\theta}(W)$ cannot be
optimized straightforwardly, because there is an integral in high-dimensional
space inside the logarithm which cannot be computed analytically or
numerically estimated with enough accuracy in a reasonable amount of time
[13]. So, in order to perform optimization, we instead maximize the
variational lower bound (VLB) on log-likelihood:

$\log p_{\theta}(W)\geqslant\mathbb{E}_{Z\sim q_{\phi}(Z|W)}\log
p_{\theta}(W|Z)-KL(q_{\phi}(Z|W)||p(Z))=L(W;\phi,\theta)\to\max\limits_{\phi,\theta}.$
(1)

Here $KL(q||p)$ denotes the Kullback-Leibler divergence which qualifies the
distance of two distributions $q$ and $p$ [13]. For two normal distributions,
KL-divergence has a closed-form expression. Also $q_{\phi}(Z|W)$ is called a
proposal, recognition or variational distribution. It is usually defined as a
Gaussian with parameters from a neural network with weights $\phi$ which takes
$W$ as an input:
$q_{\phi}(Z|W)=\mathcal{N}(Z|\mu_{\phi}(W),\sigma^{2}_{\phi}(W)I)$. Again, in
this case, the output of the network is a pair of mean $\mu_{\phi}(W)$ and
dispersion $\sigma^{2}_{\phi}(W)$ of the proposal distribution. This network
is called a proposal network, or an encoder.

It is also possible to make variational autoencoder dependent on some
additional input $H$. Prior distribution over $Z$ is now conditioned on $H$,
i.e. $p_{\psi}(Z|H)=\mathcal{N}(Z|\mu_{\psi}(H),\sigma^{2}_{\psi}(H)I)$, where
once again mean $\mu_{\psi}(H)$ and distribution $\sigma^{2}_{\psi}(H)$ are
the output of the neural network with parameters $\psi$, which takes $H$ as an
input. This network is called a prior network and this modification of VAE is
called conditional variational autoencoder (CVAE). Note that CVAE uses three
neural networks while VAE uses only two.

The sampling process of CVAE is as follows:

  1. 1.

Sample $Z\sim p_{\psi}(Z|H)$.

  2. 2.

Sample $W\sim p_{\theta}(W|Z,H)$.

Here $Z$ is a latent variable from the prior distribution $p_{\psi}(Z|H)$, but
this distribution is no longer fixed and now depends on the condition $H$ and
parameters $\psi$. Proposal and generative networks also have $H$ as an input
in CVAE.

As before, to fit the model to the data we maximize marginal conditional log-
likelihood $\log p_{\psi,\theta}(W|H)$ of the train set:

$\log p_{{\psi},\theta}(W|{H})\geqslant\mathbb{E}_{Z\sim
q_{\phi}(Z|W,{H})}\log
p_{\theta}(W|Z,{H})-KL(q_{\phi}(Z|W,{H})||p_{\psi}(Z|{H}))=\\\
=L(W;\phi,{\psi},\theta)\to\max\limits_{\phi,{\psi},\theta}.$ (2)

##  3 Optimization Function

Figure 1: Multi-User precoding allows to transmit different information to
different users simultaneously. Using the matrix $W$ we can configure the
amplitude and phase of the beams presented on the picture. The problem is to
approximate the precoding matrix $W$ using machine learning as fast as
possible, given the SE target function (4) assuming that the data set $W$ is
constructed in advance.

Consider a MIMO setting with a single antenna for each user, where the total
number of users is $q$, and $k=1\dots q$ is a user index. The setting is
characterized by the channel matrix $H$; $h_{k}\in\mathbb{C}^{n}$ is $k$-th
row of $H\in\mathbb{C}^{q\times n}$, and $n$ is the number of base station
antennas. Given a channel matrix $H$ we need to find precoding matrix $W$;
$w^{k}\in\mathbb{C}^{n}$ is $k$-th column of $W\in\mathbb{C}^{n\times q}$.

The quality of transmission is determined by $\mathrm{SINR}_{k}(W)$ — signal-
to-interference-and-noise ratio (SINR), the ratio of useful signal to
interference signal plus noise:

$\mathrm{SINR}_{k}(W)=\frac{|h_{k}\cdot w^{k}|^{2}}{\sum_{l\neq k}|h_{k}\cdot
w^{l}|^{2}+\sigma^{2}},$ (3)

where $\sigma^{2}$ is the noise power of the system.

The criterion for estimating the quality of precoding is spectral efficiency
(SE) $f(W)$ [27]. We should account for a constraint on the signal power
emitted from $i$-th antenna $\sum_{k}|w^{k}_{i}|^{2}$. The optimization
problem for finding precoding $W\in\mathbb{C}^{n{\times}q}$:

$\displaystyle
f(W)=\sum_{k}\log_{2}\big{(}1+\mathrm{SINR}_{k}(W)\big{)}\rightarrow\max_{W}$
(4) $\displaystyle\max_{1\leq i\leq n}\sum_{l}|w^{l}_{i}|^{2}\leq p$

An approximate solution of (4) can be obtained using L-BFGS method [7].

One can notice that if $W$ is the solution matrix for the above optimization
problem then for any diagonal matrix $Q$ which elements lie on the unit circle
in the complex plane, the matrix $W\cdot Q$ produces the same spectral
efficiency and satisfies per-antenna power constraints. To study the
distribution of precoding matrices with high SE we decided to use a
variational autoencoder.

##  4 Problem Setup and Research Questions

To sum up, in this task our goal is to train a variational autoencoder neural
network, conditioned on channel matrix $H$, that generates precoding matrices
for MIMO problems with channel matrix $H$. Our research questions are as
follows:

  * •

Can we produce new high-SE precoding matrices for $H$ by training variational
autoencoder on a set of precoding matrices $W_{j}$, corresponding to a fixed
channel matrix $H$?

  * •

Can we produce high-SE precoding matrices using variational autoencoder in the
case of arbitrary channel matrix $H$, i. e. by conditioning VAE on $H$?

Figure 2: The neural network model of VAE. Training. Encoder (proposal
network) takes matrix $W$ as input and produces vector $\mu_{\phi}(W)$ of
shape $d_{model}$ and a single number $\sigma_{\phi}^{2}(W)$. A latent code
$Z$ is sampled from $\mathcal{N}(Z|\mu_{\phi}(W),\sigma_{\phi}^{2}(W)I)$ using
reparametrization $Z=\mu_{\phi}(W)+\varepsilon\cdot\sigma_{\phi}(W)$, where
$\varepsilon$ is standard gaussian noise. Decoder (generative network) takes
previously sampled latent code $Z$ and produces vector $\mu_{\theta}(Z)$ of
shape $d_{data}$ and a single number $\sigma_{\theta}^{2}(Z)$ which are the
parameters of a normal distribution
$\mathcal{N}(W|\mu_{\theta}(Z),\sigma^{2}_{\theta}(Z)I)$. Finally, VAE VLB (1)
is computed and optimizer step is made. Sampling. Using VAE model we sample
latent code $Z$ from standard complex gaussian noise $\mathcal{N}(Z|0,I)$. We
then use this code to obtain decoder output $p_{\theta}(Z|W)$ and treat it as
a sampled precoding matrix $W$. Remember that VAE model can be trained and
produce samples of $W$ only for one specific channel matrix $H$. To produce
precoding matrix $W$ for the arbitrary channel $H$ a CVAE model should be used
(see Fig. 3). Figure 3: The neural network model of CVAE. Training. Encoder
(proposal network) takes matrices $W$ and $H$ as input and produces vector
$\mu_{\phi}(W,H)$ of shape $d_{model}$ and a single number
$\sigma_{\phi}^{2}(W,H)$. Prior network takes matrix $H$ as input and produces
vector $\mu_{\psi}(W,H)$ of shape $d_{model}$ and a single number
$\sigma_{\psi}^{2}(W,H)$. A latent code $Z$ is sampled from
$\mathcal{N}(Z|\mu_{\phi}(W,H),\sigma_{\phi}^{2}(W,H)I)$, using
reparametrization. Decoder (generative network) takes previously sampled
latent code $Z$, matrix $H$ and produces vector $\mu_{\theta}(Z,H)$ of shape
$d_{data}$ and a single number $\sigma_{\theta}^{2}(Z,H)$ which are the
parameters of a normal distribution
$\mathcal{N}(W|\mu_{\theta}(Z,H),\sigma^{2}_{\theta}(Z,H)I)$. Finally, CVAE
VLB (2) is computed and optimizer step is made. Also skip connections solve
the degradation problem in neural network training [11]. Sampling. Given
matrix $H$ we sample latent code $Z$ from prior distribution $p_{\psi}(Z|H)$
parametrized with prior network. We then use this code to obtain decoder
output $p_{\theta}(W|Z,H)$ and treat it as a sampled precoding $W$ for channel
$H$.

##  5 Approach

In this section, we describe the training procedure for (conditional)
variational autoencoder.

We begin with the unconditional one. Variational autoencoder consists of two
networks: encoder $q_{\phi}(Z|W)$ and decoder $p_{\theta}(W|Z)$. During
training, for each matrix $W$:

  1. 1.

Encoder takes matrix $W$ as input and produces vector $\mu_{\phi}(W)$ of shape
$d_{model}$ and a single number $\sigma_{\phi}^{2}(W)$.

  2. 2.

A latent code $Z$ is sampled from
$\mathcal{N}(Z|\mu_{\phi}(W),\sigma_{\phi}^{2}(W)I)$ using reparametrization
$Z=\mu_{\phi}(W)+\varepsilon\cdot\sigma_{\phi}(W)$, where $\varepsilon$ is
standard gaussian noise.

  3. 3.

Decoder takes previously sampled latent code $Z$ and produces vector
$\mu_{\theta}(Z)$ of shape $d_{data}$ and a single number
$\sigma_{\theta}^{2}(Z)$ which are the parameters of a normal distribution
$\mathcal{N}(W|\mu_{\theta}(Z),\sigma^{2}_{\theta}(Z)I)$.

  4. 4.

Compute VLB (1) and make optimizer step.

We fix $d_{model}$ — the dimension of latent space — to be equal to $64$ and
prior distribution $p(Z)$ to be standard gaussian distribution in
$d_{model}$-dimensional space. We also represent complex matrix $W$ of shape
$16\times 4$ as a real vector of shape $d_{data}=16\times 4\times 2=128$ of
real and imaginary parts of $W$.

To generate possible matrices $W$ after training, we simply sample $Z$ from
prior distribution $p(Z)$ and then pass it through the decoder network
$p_{\theta}(W|Z)$, treating $\mu_{\theta}(Z)$ as a sampled matrix $W$.

Having trained unconditional autoencoder, it is almost straightforward to
obtain a conditional one. In addition to encoder and decoder networks
$p_{\theta}(W|Z,H)$ and $q_{\phi}(Z|W,H)$, CVAE also contains a prior network
$p_{\psi}(Z|H)$. As previously, $d_{data}$ is equal to $128=16\times 4\times
2$ and $d_{model}=64$. To make a training step, we do the following:

  1. 1.

Encoder (proposal network) takes matrices $W$ and $H$ (represented as two
real-valued vectors of shape $128$ each) as input and produces vector
$\mu_{\phi}(W,H)$ of shape $d_{model}$ and a single number
$\sigma_{\phi}^{2}(W,H)$.

  2. 2.

Prior network takes matrix $H$ as input and produces vector $\mu_{\psi}(H)$ of
shape $d_{model}$ and a single number $\sigma_{\psi}^{2}(H)$.

  3. 3.

A latent code $Z$ is sampled from
$\mathcal{N}(Z|\mu_{\phi}(W,H),\sigma_{\phi}^{2}(W,H)I)$ using repara-
metrization.

  4. 4.

Decoder (generative network) takes previously sampled latent code $Z$, matrix
$H$ (represented as real-valued vector of shape $128$) and produces vector
$\mu_{\theta}(Z,H)$ of shape $d_{data}$ and a single number
$\sigma_{\theta}^{2}(Z,H)$ which are the parameters of a normal distribution
$\mathcal{N}(W|\mu_{\theta}(Z,H),\sigma^{2}_{\theta}(Z,H)I)$.

  5. 5.

Computing VLB for CVAE (2) and making optimizer step.

Usage of CVAE for sampling matrices $W$, however, is slightly more difficult.
Given matrix $H$ we sample latent code $Z$ from prior distribution
$p_{\psi}(Z|H)$ parametrized with prior network. We then use this code to
obtain decoder output $\mu_{\theta}(W|Z,H)$ and treat it as a sampled
precoding matrix $W$ for channel $H$. The neural network model of CVAE is
presented in Fig. 3.

##  6 Experimental Results

In this section, we present the results of training VAE and CVAE to produce
precoding matrices with high spectral efficiency for a given channel matrix
$H$. First of all, we report the results of training VAE to fit a distribution
of precoding matrices $W$ for a fixed channel $H$. We consider two approaches:
VAE and a CVAE with the fixed matrix $H$ as a condition.

To obtain target precoding matrices $W$ for a given $H$, we optimize spectral
efficiency using the L-BFGS optimization approach [7], starting from randomly
initialized matrix $W$, until convergence. The L-BFGS method is implemented
with the PyTorch [21] framework.

Figure 4: Distribution of spectral efficiency for precoding matrices $W_{i}$
obtained with random initialization of L-BFGS method for a fixed channel
matrix $H$. Orange corresponds to samples with high efficiency (14 SE and
more), blue and green — samples with average efficiency (from 7 to 14 SE), red
— samples with low efficiency (less than 7 SE). Training. Samples with SE
above threshold $t=14.5$ (dashed line) were selected for training VAE/CVAE
neural networks. Using such training data and following the experiment shown
in Sec. 6.1 and Fig. 5, it is possible to generate highly efficient precoding
matrices $W$. Figure 5: Spectral efficiency precoding quality produced by the
algorithms.

###  6.1 Generating high SE precoding matrices $W_{i}$ for the fixed $H$

For a given channel matrix $H\in\mathbb{C}^{q{\times}n}$, we find the
precoding $W\in\mathbb{C}^{n\times q}$ using L-BFGS approach [7] with a random
initialization. This method returns precoding matrices with high spectral
efficiency using the iterative optimization approach and measures the SE
quality using the formula of SE (4). We repeat this from different starting
points to get different matrices $W_{j}$ for a fixed $H$, filtering out
precoding matrices with SE lower than a certain threshold $t$ in the process
(see Fig. 4), obtaining a set $\\{W_{j}\\}_{j=1}^{N}$ of size $N$.

We measured the quality of generated precoding matrices
$W\in\mathbb{C}^{n\times q}$ simply by evaluating spectral efficiency (4)
$f(W)$ with a given channel $H\in\mathbb{C}^{q{\times}n}$. For a given channel
matrix $H$ and a set of $N=5000$ precoding matrices $W_{i}$, the average SE
value for $W_{i}$ and $H$ is $14.85$ (Fig. 5 L-BFGS Precoding). We fix matrix
dimensions to be equal to $q=4,n=16$, and the value of filtering threshold
$t=14.5$.

We managed to obtain the mean SE value of $8.87$ with VAE and $11.31$ with
CVAE for a fixed $H$ matrix for sampled precoding matrices $W_{i}$ (Fig. 5
Sampled Precoding). This method samples from the distribution of precoding
matrices with high SE (4) using the deep learning approach of VAE/CVAE. We
also measured mean SE in reconstructed objects (precodings $W_{i}$ passed
through encoder and decoder) and obtained $9.53$ and $12.61$ for VAE and CVAE-
fixed-$H$ respectively (Fig. 5 Reconstructed Precoding).

###  6.2 Generating matrices $W_{i,j}$ using $H_{i}$ as condition for CVAE

To study how MIMO solutions change with respect to $H$, we perturb $H$ with
random matrices $\Delta_{i}$, obtaining $K$ different channel matrices
$H_{i}=H+\Delta_{i}$, where each $\Delta_{i}$ satisfies
$||\Delta_{i}||_{F}^{2}=\delta$ and repeat the exact same process of
generating a set of $N$ precoding matrices for each $H_{i}$. Overall, we have
a set of pairs $\\{H_{i},W_{i,j}\\}_{i,j=1}^{K+1,N}$ of channel matrices and
corresponding precodings with high spectral efficiency, where
$H\in\mathbb{C}^{q{\times}n}$ and $W\in\mathbb{C}^{n\times q}$. We fix hyper-
parameters to be equal to $K=15,q=4,n=16,N=500,\delta=5$. For this task,
channel matrices $H$ are generated from the complex standard normal
distribution.

We train CVAE on a set $\\{H_{i},W_{i,j}\\}$ with $H_{i}=H+\Delta_{i}$ and
$H_{0}=H$ for convenience. However, we do not manage to get high-quality
samples from such a model, having mean SE for reconstructed objects equal to
$6.49$ and $6.45$ if we use one of $H_{i}$ as a condition and we observe the
same fall in spectral efficiency for a perturbation of $H$ which differ from
one of $\Delta_{i}$.

###  6.3 Computational Complexity

The proposed VAE/CVAE solution works much faster than the L-BFGS reference
method. We estimate the inference of the proposed two-layers neural network as
one iteration of the L-BFGS procedure. Which includes two matrix-vector
operations inside the layers and one matrix-vector multiplication of SE (4).
The complexity of the L-BFGS iteration is estimated as three SE (5)
estimations [27]. Since in practice the number of iterations reaches up to a
hundred [34], the inference of the proposed neural network is faster up to a
hundred times. Both VAE and CVAE methods require a training procedure in the
background, but we mainly focus on the inference time in a real system. The
learning time of the CVAE method is higher than that of the VAE method [19].
If we denote the complexity of the VAE/CVAE inference as $y$, the relative
complexity of the L-BFGS method will be $My$, where $M$ is the number of
L-BFGS iterations.

##  7 Conclusion

In this paper, we propose a deep learning algorithm based on the theory of
variational autoencoders. This algorithm is designed to generate precoding
matrices with high spectral efficiency for massive MIMO systems. With its
help, we successfully sampled precoding matrices using both versions of the
autoencoder: VAE and CVAE. The first one must be trained separately for
different channel matrices $H$, and the second one can be conditioned on the
matrix of the channel $H$ and thus can be used for different $H$ as a unified
model. In the case of a fixed channel matrix $H$, both approaches were able to
generate precoding matrices with high spectral efficiency, but CVAE surpasses
VAE in terms of quality and versatility. However, both approaches can be used
to study the distribution of precoding matrices with high spectral efficiency.

## Acknowledgements

The authors are grateful to Mr. D. Kropotov and Prof. O. Senko for
discussions.

## References

  * [1] Abdallah, A., Mansour, M.M., Chehab, A., Jalloul, L.M.: MMSE detection for 1-bit quantized massive MIMO with imperfect channel estimation. In: 2018 IEEE 19th International Workshop on Signal Processing Advances in Wireless Communications (SPAWC). pp. 1–5. IEEE (2018)
  * [2] Albreem, M.A., Juntti, M., Shahabuddin, S.: Massive MIMO detection techniques: A survey. IEEE Communications Surveys & Tutorials 21(4), 3109–3132 (2019)
  * [3] Andrews, J.G., Buzzi, S., Choi, W., Hanly, S.V., Lozano, A., Soong, A.C., Zhang, J.C.: What will 5G be? IEEE Journal on selected areas in communications 32(6), 1065–1082 (2014)
  * [4] Balatsoukas-Stimming, A., Castañeda, O., Jacobsson, S., Durisi, G., Studer, C.: Neural-network optimized 1-bit precoding for massive MU-MIMO. In: 2019 IEEE 20th International Workshop on Signal Processing Advances in Wireless Communications (SPAWC). pp. 1–5. IEEE (2019)
  * [5] Björnson, E., Larsson, E.G., Marzetta, T.L.: Massive MIMO: Ten myths and one critical question. IEEE Communications Magazine 54(2), 114–123 (2016)
  * [6] Bobrov, E., Kropotov, D., Lu, H., Zaev, D.: Massive mimo adaptive modulation and coding using online deep learning algorithm. IEEE Communications Letters 26(4), 818–822 (2022). https://doi.org/10.1109/LCOMM.2021.3132947
  * [7] Bobrov, E., Kropotov, D., Troshin, S., Zaev, D.: Study on Precoding Optimization Algorithms in Massive MIMO System with Multi-Antenna Users (2021)
  * [8] Bobrov, E., Troshin, S., Chirkova, N., Lobacheva, E., Panchenko, S., Vetrov, D., Kropotov, D.: Machine learning methods for spectral efficiency prediction in massive mimo systems (2021)
  * [9] Caciularu, A., Burshtein, D.: Blind channel equalization using variational autoencoders. In: 2018 IEEE International Conference on Communications Workshops (ICC Workshops). pp. 1–6. IEEE (2018)
  * [10] Dong, P., Zhang, H., Li, G.Y.: Framework on deep learning-based joint hybrid processing for mmWave massive MIMO systems. IEEE Access 8, 106023–106035 (2020)
  * [11] He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recognition. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 770–778 (2016)
  * [12] Huang, C., Chen, G., Gong, Y., Xu, P.: Deep reinforcement learning based relay selection in delay-constrained secure buffer-aided CRNs. In: GLOBECOM 2020-2020 IEEE Global Communications Conference. pp. 1–6. IEEE (2020)
  * [13] Kingma, D.P., Welling, M.: Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114 (2013)
  * [14] Larsson, E.G., Edfors, O., Tufvesson, F., Marzetta, T.L.: Massive MIMO for next generation wireless systems. IEEE communications magazine 52(2), 186–195 (2014)
  * [15] Liang, D., Krishnan, R.G., Hoffman, M.D., Jebara, T.: Variational autoencoders for collaborative filtering. In: Proceedings of the 2018 world wide web conference. pp. 689–698 (2018)
  * [16] Lopez-Martin, M., Carro, B., Sanchez-Esguevillas, A.: Variational data generative model for intrusion detection. Knowledge and Information Systems 60(1), 569–590 (2019)
  * [17] Miao, Y., Yu, L., Blunsom, P.: Neural variational inference for text processing. In: International conference on machine learning. pp. 1727–1736. PMLR (2016)
  * [18] Ngo, H.Q., Larsson, E.G., Marzetta, T.L.: Energy and spectral efficiency of very large multiuser MIMO systems. IEEE Transactions on Communications 61(4), 1436–1449 (2013)
  * [19] Pagnoni, A., Liu, K., Li, S.: Conditional variational autoencoder for neural machine translation. arXiv preprint arXiv:1812.04405 (2018)
  * [20] Parfait, T., Kuang, Y., Jerry, K.: Performance analysis and comparison of ZF and MRT based downlink massive mimo systems. In: 2014 sixth international conference on ubiquitous and future networks (ICUFN). pp. 383–388. IEEE (2014)
  * [21] Paszke, A., Gross, S., Chintala, S., Chanan, G., Yang, E., DeVito, Z., Lin, Z., Desmaison, A., Antiga, L., Lerer, A.: Automatic differentiation in pytorch (2017)
  * [22] Rezaie, S., Manchón, C.N., De Carvalho, E.: Location-and orientation-aided millimeter wave beam selection using deep learning. In: ICC 2020-2020 IEEE International Conference on Communications (ICC). pp. 1–6. IEEE (2020)
  * [23] Rusek, F., Persson, D., Lau, B.K., Larsson, E.G., Marzetta, T.L., Edfors, O., Tufvesson, F.: Scaling up MIMO: Opportunities and challenges with very large arrays. IEEE signal processing magazine 30(1), 40–60 (2012)
  * [24] Tran, L.N., Juntti, M., Bengtsson, M., Ottersten, B.: Beamformer designs for MISO broadcast channels with zero-forcing dirty paper coding. IEEE transactions on wireless communications 12(3), 1173–1185 (2013)
  * [25] Turhan, C.G., Bilge, H.S.: Variational autoencoded compositional pattern generative adversarial network for handwritten super resolution image generation. In: 2018 3rd International Conference on Computer Science and Engineering (UBMK). pp. 564–568. IEEE (2018)
  * [26] Van Luong, T., Ko, Y., Vien, N.A., Matthaiou, M., Ngo, H.Q.: Deep energy autoencoder for noncoherent multicarrier MU-SIMO systems. IEEE Transactions on Wireless Communications 19(6), 3952–3962 (2020)
  * [27] Verdú, S.: Spectral efficiency in the wideband regime. IEEE Transactions on Information Theory 48(6), 1319–1343 (2002)
  * [28] Wang, B., Chang, Y., Yang, D.: On the SINR in massive MIMO networks with MMSE receivers. IEEE Communications Letters 18(11), 1979–1982 (2014)
  * [29] Xia, W., Zheng, G., Zhu, Y., Zhang, J., Wang, J., Petropulu, A.P.: A deep learning framework for optimization of MISO downlink beamforming. IEEE Transactions on Communications 68(3), 1866–1880 (2019)
  * [30] Ye, H., Li, G.Y., Juang, B.H.: Power of deep learning for channel estimation and signal detection in OFDM systems. IEEE Wireless Communications Letters 7(1), 114–117 (2017)
  * [31] Ye, H., Li, G.Y., Juang, B.H.F.: Deep reinforcement learning based resource allocation for V2V communications. IEEE Transactions on Vehicular Technology 68(4), 3163–3173 (2019)
  * [32] Zhao, T., Li, F.: Variational-autoencoder signal detection for MIMO-OFDM-IM. Digital Signal Processing 118, 103230 (2021)
  * [33] Zhao, T., Li, F., Tian, P.: A deep-learning method for device activity detection in mMTC under imperfect CSI based on variational-autoencoder. IEEE Transactions on Vehicular Technology 69(7), 7981–7986 (2020)
  * [34] Zhu, C., Byrd, R.H., Lu, P., Nocedal, J.: Algorithm 778: L-BFGS-B: Fortran subroutines for large-scale bound-constrained optimization. ACM Transactions on mathematical software (TOMS) 23(4), 550–560 (1997)