# Rating and aspect-based opinion graph embeddings for explainable
recommendations

Iván Cantador  Universidad Autónoma de MadridMadridSpain ,  Andrés Carvallo
Pontificia Universidad Católica de ChileSantiagoChile and  Fernando Diez
Universidad Autónoma de MadridMadridSpain

###### Abstract.

The success of neural network embeddings has entailed a renewed interest in
using knowledge graphs for a wide variety of machine learning and information
retrieval tasks. In particular, recent recommendation methods based on graph
embeddings have shown state-of-the-art performance. In general, these methods
encode latent rating patterns and content features. Differently from previous
work, in this paper, we propose to exploit embeddings extracted from graphs
that combine information from ratings and aspect-based opinions expressed in
textual reviews. We then adapt and evaluate state-of-the-art graph embedding
techniques over graphs generated from Amazon and Yelp reviews on six domains,
outperforming baseline recommenders. Additionally, our method has the
advantage of providing explanations that involve the coverage of aspect-based
opinions given by users about recommended items.

recommender systems, knowledge graphs, graph embeddings

††ccs: Information systems Recommender systems††ccs: Computing methodologies
Semantic networks††ccs: Computing methodologies Neural networks

##  1\. Introduction

In recent years, knowledge graphs (KG) have been widely used in recommendation
(He et al., 2015; Wang et al., 2018a). A KG is a graph data structure
containing information about semantic entities (or concepts) expressed as
nodes, and semantic relations between entities expressed as edges, and the
relation can be represented as ¡subject, property, object¿ triples whose
elements may belong to structured knowledge bases or ontologies. Subject and
object entities (nodes) can refer to users, items, item metadata, and content
features, among others. Compared to recommendation approaches that treat
relations between users and items independently, exploiting a KG graph allows
capturing deeper relations valuable to generate better recommendations (Wang
et al., 2019a). Another benefit of a KG-based recommender is its capacity to
deal with cold-start situations for new users or unrated items by providing
side information (Hu et al., 2018; Huang et al., 2018). Moreover, it allows
generating human-interpretable recommendations, making the system more
reliable and transparent for the end-user (Wang et al., 2019b; He et al.,
2015; Xian et al., 2019).

The broad majority of graph-based recommendation methods makes use of
information underlying rating relations and connections between items with
similar attributes (Wang et al., 2019b). In general, these methods encode
latent rating patterns and content features using graph-embeddings, since the
information stored in KG triples can be too computationally expensive to
manipulate. Knowledge-graph-embeddings (Cai et al., 2018) consist of learned
lower dimension, continuous vectors for entities and relations that preserve
the original structure of the KG.

In this context, a source of information that has been barely explored for KG
is the textual content of user reviews. In the research literature, it has
been shown that both ratings and reviews can give support and trust to users
in decision making tasks (Lackermair et al., 2013). In particular, approaches
have been proposed to automatically extract personal opinions about item
aspects (i.e., features, components, and functionalities) from reviews (Poria
et al., 2016). Aspect-based opinions have been used to enrich sentiment
analysis models (de Kok et al., 2018), document classification (Ostendorff et
al., 2020), and recommender systems (He et al., 2015). Concerning the
exploitation of aspect-based opinions by recommender systems, Musto et al.
(Musto et al., 2019) made use of aspects to justify recommendations using
sentiment analysis and text summarization, whereas Wu and Ester (Wu and Ester,
2015) proposed a probabilistic approach that combines aspect-based opinion
mining and collaborative filtering. Aspect-based opinions have also been
included as additional features for latent factor (Qiu et al., 2016) and
neural network (Chin et al., 2018; Guan et al., 2019) models. To the best of
our knowledge, the approach by He et al. (He et al., 2015) is the only one
that takes advantage of a KG with information from aspect-based opinions
extracted from reviews. Differently, our method combines rating and aspect-
based opinion interactions in a KG embedding framework to obtain a richer
representation of users, items, and aspects in the same latent space for
making recommendations.

Therefore, the main contributions from our work are as follows:

  1. (1)

Presenting a graph model that represents and relates users, items, and aspects
in the same latent space for its exploitation by recommender systems.

  2. (2)

Using the graph model to adapt recommendation methods based on neural network
graph embeddings, showing empirical performance improvements over state-of-
the-art baselines.

  3. (3)

Proposing a method that uses the graph model to provide explanations of
generated recommendations at the aspect opinion level.

##  2\. Related work

Graph-based recommendations. We can distinguish between three main types of
approaches that use graphs for recommendation purposes: path-based, embedding-
based and unified. In path-based methods take advantage of users and items
connectivity score functions to generate recommendations. For instance, Luo et
al. (Luo et al., 2014) proposed Hete-CF, which makes use of path similarity
combined with common paths between two entities in a social network to make
recommendations. Concerning embedding-based methods, the KG is used to obtain
latent representations of users and items, with which finding closest users
and items. Examples of this are the work by Wang et al. (Wang et al., 2018b)
for news recommendation and Huang et al. (Huang et al., 2018), which
incorporates sequential information through a recurrent neural network.
Another recent work based on embeddings is KGAT (Wang et al., 2019a), which
models high order relations in a KG. Finally, unified methods exploit
information from embedding- and path-based forms together. Wang et al. (Wang
et al., 2018a) proposed RippleNet, which introduces the concept of preference
propagation to refine user and item representations obtained with embedding-
based methods. In our work, we advocate for embedding-based graph
recommendations, since they allow better addressing the cold start problem and
efficiently representing entities and relations, preserving the graph
structure (Wang et al., 2019a; Wang et al., 2018a). Moreover, we chose the
embedding-based approach since the state-of-the-art KGAT method (Wang et al.,
2019a) achieved better performance results than other embedding-based, path-
based and unified approaches. This led us to empirically compare our method
with KGAT in the experimental section.

Aspect-based recommendations. Many aspect-based recommenders exist in the
research literature, but few consider the incorporation of opinions about item
aspects into a KG. Aspect-based opinions have been used to justify
recommendations, including sentiment analysis and text summarization from
reviews (Musto et al., 2019). The combination of aspect-based opinion mining
and collaborative filtering in a probabilistic framework was proposed in (Wu
and Ester, 2015). Moreover, using aspects as features of latent factor (Qiu et
al., 2016) and neural network (Chin et al., 2018; Guan et al., 2019) models
have also been investigated. Regarding the incorporation of aspect-based
opinion information into a KG, TriRank (He et al., 2015) makes use of a
tripartite graph representing relationships between users, items, and aspects
to generate recommendations. Differently to TriRank, our method combines
ratings and aspect-based opinions in a KG to learn richer vector
representations for both users and items, with which generating personalized
recommendations. Furthermore, there have been approaches to automatize text
content analysis in the field of medicine(Carvallo et al., 2020), along with
stress tests(Aspillaga et al., 2020; Araujo et al., 2021) to evaluate the
models performance under different situations.

Graph-based recommendation explanations. The majority of works on graph-based
recommenders aim to produce path-based interpretations of generated
recommendations, although it has been stated that they require domain
knowledge (Ma et al., 2019). Fu et al. (Fu et al., 2020) made use of paths
from users to items, mitigating unfairness problems related to undesired
recommendations from inactive users. Furthermore, Xian et al. (Xian et al.,
2019) proposed a reinforcement learning approach for recommendation, where
explanations are delivered by a policy-guided path reasoning on a KG. Wang et
al. (Wang et al., 2019b) suggested recommendation explanations by showing
items shared features and mining association rules. Lastly, Huan et al. (Huang
et al., 2019) proposed a method to provide path-based explanation through
user-rating interactions incorporating dynamic user preferences. Our
recommendation method brings entities and relationships in the same latent
space, and presents embedding-based explanations, which have been proven to be
effective (Ma et al., 2019).

##  3\. Proposed approach

Figure 1. Example of ratings and aspect-based opinions graph. Users may like,
dislike or doesNotCare about item aspects, or may assign highRating or
lowRating values to items. An aspect belongsTo an item. Circle, triangle and
square nodes represent users, aspects and items, respectively. Dotted lines
correspond to rating relations, while solid lines are aspect-based opinion
relations.

###  3.1. Knowledge graph representation

Our KG representation model is depicted in Figure 1. Let $G=(N,R,E)$ be a
graph where N are nodes representing users, items and item aspects; R is the
set of possible relations between such entities: like and dislike for user-
aspect relations, belongsTo for aspect-item relations, and highRating and
lowRating for user-to-item relations; and E represents the graph edges, whose
elements are semantic triple $<s,r,d>$ –source, relation, and destination–,
where $s,d\in N$ and $r\in R$. More specifically, to represent ratings given
by users to items as triples $<s,r,d>$, we use two types of relations:
highRating and lowRating. If a rating is lower or equal to 3, then it is
transformed into a lowRating relation; otherwise, it is represented as
highRating relation. An aspect-based opinion, by contrast, is represented as
two triples $<s,r,d>$: one that relates the user and the aspect, and other
that related the aspect and the item. The former relation can be a likes,
doesNotCare or dislikes relation depending on the polarity (positive, neutral
or negative) of the opinion given to the aspect. This polarity is computed
through the opinoin mining technique proposed by Hernandez-Rubio et al.
(Hernández-Rubio et al., 2019). If the extracted polarity is $0$, it means the
user doesnotCare about the aspect for that particular item; if the polarity is
greater than $0$, the user likes the item’s aspect, and finally, if the
polarity is lower than $0$, the dislikes the item’s aspect. The latter
relation is always belongsTo, stating that the aspect is associated to the
item. An illustrative KG example is shown in Figure 1. user1 likes aspect1,
which belongs to item1, despite the fact that the item receives a low rating
from the user. user2 dislikes the above aspect of item1, but assigns a high
rating to the item. Finally, user3 does not care about aspect2 of item1, and
does not rate the item.

###  3.2. Knowledge graph embedding recommendations

We used PyTorch BigGraph (PBG), a graph embedding learning framework released
by Facebook AI (Lerer et al., 2019), to generate user, item, and aspect
embeddings from the proposed KG. Then, we used the learned embeddings to make
personalized recommendations. To explain the PBG representation learning
process we define $E$ as a set of edges represented as triplets $<s,r,d>$ that
connect source (s) and destination (d) nodes using a relation (r). For each
triplet, PBG model have parameters $(\theta_{s},\theta_{r},\theta_{d})$
representing source node ($s$), relation ($r$) and destination node ($d$), and
a function $f$ whose purpose is to maximize the cases where the triple $e$
belongs to $E$ and seek to minimize the other cases. To achieve this, $f$
obtain a latent representation learned for $s$, $d$ and $r$:
$f(\theta_{s},\theta_{r},\theta_{d})=sim(g_{s}(\theta_{s},\theta_{r}),g_{s}(\theta_{d},\theta_{r})$.
Where the transformation function $g$ encodes the relation between node and
relation $r$ vectors, and the similarity function ($sim$) calculates a
similarity between both transformed vectors. PBG combines similarity ($sim$)
and transformation ($g$) functions to learn embeddings for source node,
destination node, and relations, by minimizing the following loss function:
$L=\sum_{e\in E}\sum_{e^{\prime}\in
S^{\prime}_{e}}max(f(e)-f(e^{\prime})+\lambda,0)$. Where $S^{\prime}_{e}$ is a
set of edges obtained using negative sampling, which samples half of them from
corrupting one node from training edges and the other half from triples
randomly created, and $\lambda$ is a margin hyperparameter. The combination of
the similarity and the scoring function depends on the type of relations being
modeled. In our case, we use complEX (Trouillon et al., 2016) which uses dot
product as similarity function, and $Re(<s,\bar{d}>)$ as transformation
function, since we empirically obtained that it was the best combination in
terms of recommendation performance compared to transE (Bordes et al., 2013),
transR (Lin et al., 2015), RESCAL (Nickel et al., 2011), Distmult (Yang et
al., 2014), among others. Finally, to make the recommendation, as user and
item embeddings are in the same latent space, we look for the item embeddings
closest to the user embedding using cosine similarity.

##  4\. Datasets

To evaluate the proposed method, we used the Amazon Reviews
datasets111https://jmcauley.ucsd.edu/data/amazon/ (AMZ) with reviews and
ratings for Movies & TV (MVT), Videogames (VGM), and Cellphones (CPH). For
this dataset, we considered only users with more than $10$ ratings. We also
considered other domains –Restaurants (RST), Hotels (HTL), and Beauty&Spa
(BTY)– using the Yelp Challenge dataset222https://www.yelp.com/dataset (YLP),
which, as well as the Amazon dataset, contains both rating and reviews. Then,
concerning the aspect opinions dataset333http://ir.ii.uam.es/aspects/, this
information complements the rating information since it includes users’
polarity with aspects of items given ratings depending on the content of the
reviews’ text. Statistics from datasets are shown in Table 1, it can be seen
that the number of ratings varies from 25 thousand to more than one million
and a half interactions. It can be seen that Yelp datasets for HTL and BTY
domains have fewer interactions compared to others. For aspect-based
relations, the number of interactions varies from 13 thousand interactions to
more than 2 million interactions for the MVT domain. It can be seen that, in
general, users are more active for rating interactions more than aspect
opinions, except for the MVT domain.

Table 1. Datasets statistics Dataset | Domain | Users | Items | Ratings | Aspect | Rating
---|---|---|---|---|---|---
|  |  |  |  | opinions | sparsity
AMZ | MVT | 40,058 | 131,638 | 1,349,351 | 2,132,927 | $2.4\cdot 10^{-4}$
VGM | 6,686 | 25,795 | 575,136 | 209,755 | $8.3\cdot 10^{-4}$
CPH | 7,237 | 47,183 | 464,684 | 85,930 | $3.4\cdot 10^{-4}$
YLP | RST | 36,471 | 4,503 | 791,865 | 547,892 | $9.6\cdot 10^{-4}$
HTL | 4,148 | 284 | 25,170 | 16,935 | $4.2\cdot 10^{-3}$
BTY | 4,270 | 764 | 27,885 | 13,217 | $1.7\cdot 10^{-3}$
Table 2. Examples of recommendation explanations for the MTV and RST domains, where top 30 similar users have positive or negative opinions about aspects of the recommended items. Recommended item | Similar 30 users’ aspect opinions | Score | Sample review
---|---|---|---
Avengers |  characters (15 , 5 )
acting (10 , 3 )
picture (2 , 10 ) | 4.3 |  I enjoy all of the Marvel movies. It’s not as good as the later 3 that follows, Ultron, infinity wars and Endgame but it’s still cool to see a lot of the Marvel characters come together for the first time. The graphics are great for the year and the acting is very good as well.
Get&Go Burrito |  service (18 , 4 )
price (10 , 14 )
atmosphere (17 , 13 ) | 3.5 |  Know 2 things - this place isn’t cheap and you shouldn’t eat for a couple of days before you go! Know that we’ve gotten that out of the way, let me tell you - t his place is great! The service was fabulous.

##  5\. Experiments

###  5.1. Evaluated methods

We report experimental results from the following methods:

  * •

Non-personalized recommendation methods: we consider random rating (RDM) and
most popular item (POP) recommendation methods.

  * •

Matrix Factorization optimized with alternate least squares (MF): as a
traditional baseline, we chose matrix factorization optimized with alternate
least-squares (Koren et al., 2009) using 200 latent factors, which yield the
best results among other traditional baselines.

  * •

Graph-based recommendation baseline (KGAT):  as a graph-based recommendation
state-of-the-art baseline, we consider Wang et al.’s KG Attention Network
recommendation framework (KGAT) (Wang et al., 2019a) .

  * •

Graph embeddings from ratings (GER): this is a version of our proposed model
that considers only rating-based relations between users and items.

  * •

Graph embeddings from aspect-based opinions (GEA): this is a version of our
proposed model that considers only likes, dislikes, and doesNotCare relations
between users and item aspects, and belongsTo relation between item aspects
and items.

  * •

Graph embeddings from ratings and aspect-based opinions (GERA): this is our
proposed model that considers both aspect and rating-based relations.

Content-based filtering, user-based collaborative filtering (Schafer et al.,
2007), item-based collaborative filtering (Schafer et al., 2007), matrix
factorization using alternated least-squares (Koren et al., 2009), and matrix
factorization using Bayesian personalized ranking (Rendle et al., 2012) were
also evaluated, performing worse. We do not report their results due to lack
of space.

###  5.2. Experimental setup

We tested a range of parameters, obtaining best performance results for
embeddings of dimension 400 and learning rate 0.01. In the evaluation, we used
the OrdRec methodology (Koren and Sill, 2013), where a method is evaluated on
the test ratings at the user level. We employ a 5-fold cross-validation
strategy, and compute the F1@k (10,20,30) metric. Other metrics such as
nDCG@k(10,20,30), recall@k(10,20,30), and precision@k(10,20,30) were also
calculated, but they are not reported herein due to lack of space; moreover,
they did not give additional insights to the analysis we present next.

###  5.3. Achieved results

The results in Tables 3 and 4 indicate that in most of the domains our method
(GERA) outperforms the baselines in terms of F1@k (10,20, 30). For a top-N
recommendation task, GERA outperforms state-of-the-art traditional and graph-
based recommendation methods. However, for the CPH domain, in terms of F1@10,
MF achieves the highest value (0.915), whereas, for F1@20 and F1@30, the best-
performing method was the aspect-based opinion graph (GEA) version of our
proposal, with values of 0.935 and 0.939, respectively. The worse results of
GERA in the CPH domain can be explained because, as shown in Table 1 this
domain does not have enough aspect opinions to improve the results by
combining them with ratings in a KG.

Table 3. Evaluation results on Amazon dataset. Values in bold are the best
ones for each domain and metric. * indicates statistical significance best
result by multiple t-test using Bomferroni correction.

Dataset | Domain | Model | F1@10 | F1@20 | F1@30
---|---|---|---|---|---
|  | RDM | .801 | .812 | .813
| POP | .033 | .031 | .031
| MF | .905 | .914 | .917
MVT | KGAT | .924 | .938 | .942
| GER | .921 | .936 | .940
| GEA | .915 | .932 | .936
|  | GERA | .927* | .941* | .945*
|  | RDM | .800 | .807 | .806
|  | POP | .045 | .045 | .045
|  | MF | .909 | .914 | .915
AMZ | VGM | KGAT | .791 | .903 | .920
|  | GER | .791 | .901 | .920
|  | GEA | .781 | .898 | .918
|  | GERA | .934* | .943* | .945*
|  | RDM | .819 | .819 | .823
|  | POP | .043 | .043 | .043
|  | MF | .915* | .916 | .917
| CPH | KGAT | .888 | .929 | .933
|  | GER | .890 | .930 | .934
|  | GEA | .898 | .935* | .939*
|  | GERA | .880 | .928 | .933

Table 4. Evaluation results on Yelp dataset. Values in bold are the best ones
for each domain and metric. * indicates statistical significance best result
by multiple t-test using Bomferroni correction.

Dataset | Domain | Model | F1@10 | F1@20 | F1@30
---|---|---|---|---|---
|  | RDM | .647 | .646 | .650
| POP | .107 | .107 | .107
| MF | .827 | .829 | .830
| RST | KGAT | .913 | .932 | .938
|  | GER | .914 | .931 | .936
|  | GEA | .927 | .940 | .944
|  | GERA | .933* | .944* | .947*
|  | RDM | .592 | .589 | .571
|  | POP | .468 | .468 | .468
|  | MF | .816 | .816 | .816
YLP | HTL | KGAT | .986 | .986 | .986
|  | GER | .983 | .983 | .983
|  | GEA | .985 | .985 | .985
|  | GERA | .987* | .987* | .987*
|  | RDM | .650 | .634 | .622
|  | POP | .263 | .263 | .263
|  | MF | .846 | .848 | .850
| BTY | KGAT | .984 | .984 | .984
|  | GER | .983 | .984 | .984
|  | GEA | .983 | .983 | .983
|  | GERA | .987* | .988* | .988*

##  6\. Recommendation Explanations

In this section, we present a simple technique to generate explanations about
recommendations provided by our method. To obtain interpretable
recommendations at aspect level, we first recommend 30 (a chosen cut-off)
items whose embeddings are closer to the user’s embedding. From them, we
search for the 30 most similar users, and obtain the opinions these users gave
to the aspects of the recommended items. In Table 2, we show examples of
generated aspect-level explainable recommendations. In Table 5, we report
Coverage –percentage of items with aspect opinion-based explanations–,
lk/other –the proportion of likes over dislikes and doesNotCare) relations–,
#aspects –the average number of unique aspects–, and asp/item –the average
number of aspects per item.

Table 5. Statistics of the recommendation explanation technique for each domain. Results in bold are the best ones for each metric. Dataset | Domain | Coverage | lk/other | #aspects | asp/item
---|---|---|---|---|---
AMZ | MVT | 47.90% | .663 | 10.30 | .716
VGM |  90.23% | .584 | 18.52 | .684
CPH | 70.38% | .592 | 12.27 | .581
YLP | RST | 11.11% | .508 | 6.22 | 1.87
HTL | 21.64% | .796 | 22.34 | 3.44
BTY | 20.02% | .653 | 17.55 | 2.88

The results in Table 5 indicate that the proposed method has better coverage
in the VGM domain with 90.34% coverage; this shows that of the 30 recommended
items, the proportion mentioned above may have interpretation at the aspect
level. Regarding the balance of likes with respect to other interactions, the
proposed method in the HTL domain has the highest ratio (0.796). This means
that, in general, the aspects of hotels are valued higher than in other
domains. The method explanations in that domain cover a greater variety of
aspects, with an average of 22.34 unique aspects per recommendation. More
evidence of this is given by the high number of aspects per item (3.44).
However, despite the diversity in explanations, the method in the HTL domain
has the third worst coverage, followed by RST and BTY. Comparing the results
on the two datasets, it can be seen that in terms of coverage, in general, AMZ
surpasses YLP.

##  7\. Conclusions

In this paper, we have empirically shown that latent representations of users
and items extracted from a KG by means of rating-based embeddings can be
exploited to effectively outperform the performance of graph-based and
traditional recommendation approaches. Moreover, we have seen that richer
embeddings integrating ratings and aspect-based opinions in a KG allows
surpassing a state-of-the-art neural network recommendation model.

Another advantage of the proposed method is the interpretabilty of its
recommendations, since users, items, and aspects are modeled in a common
latent space. Differently to previous approaches that generate explanations at
rating level or according to graph paths that require domain knowledge, our
approach provides aspect-level explanations extracted from item reviews.

Our work thus shows that to improve state-the-art graph-based recommendations,
it is not always necessary to change the recommendation algorithm, but
preferably seek new ways of incorporating existing information like ratings
and aspect-based opinions into the used KG.

## References

  * (1)
  * Araujo et al. (2021) Vladimir Araujo, Andrés Carvallo, Carlos Aspillaga, Camilo Thorne, and Denis Parra. 2021\.  Stress Test Evaluation of Biomedical Word Embeddings. In _Proceedings of the 20th Workshop on Biomedical Language Processing_. 119–125.
  * Aspillaga et al. (2020) Carlos Aspillaga, Andrés Carvallo, and Vladimir Araujo. 2020.  Stress Test Evaluation of Transformer-based Models in Natural Language Understanding Tasks.  _arXiv preprint arXiv:2002.06261_ (2020).
  * Bordes et al. (2013) Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. 2013\.  Translating embeddings for modeling multi-relational data. In _Neural Information Processing Systems (NIPS)_. 1–9.
  * Cai et al. (2018) Hongyun Cai, Vincent W Zheng, and Kevin Chen-Chuan Chang. 2018\.  A comprehensive survey of graph embedding: Problems, techniques, and applications.  _IEEE Transactions on Knowledge and Data Engineering_ 30, 9 (2018), 1616–1637.
  * Carvallo et al. (2020) Andres Carvallo, Denis Parra, Hans Lobel, and Alvaro Soto. 2020\.  Automatic document screening of medical literature using word and text embeddings in an active learning setting.  _Scientometrics_ 125, 3 (2020), 3047–3084.
  * Chin et al. (2018) Jin Yao Chin, Kaiqi Zhao, Shafiq Joty, and Gao Cong. 2018\.  ANR: Aspect-based neural recommender. In _Proceedings of the 27th ACM International Conference on Information and Knowledge Management_. 147–156.
  * de Kok et al. (2018) Sophie de Kok, Linda Punt, Rosita van den Puttelaar, Karoliina Ranta, Kim Schouten, and Flavius Frasincar. 2018.  aggregated aspect-based sentiment analysis with ontology features.  _Progress in Artificial Intelligence_ 7, 4 (2018), 295–306.
  * Fu et al. (2020) Zuohui Fu, Yikun Xian, Ruoyuan Gao, Jieyu Zhao, Qiaoying Huang, Yingqiang Ge, Shuyuan Xu, Shijie Geng, Chirag Shah, Yongfeng Zhang, et al. 2020\.  Fairness-aware explainable recommendation over knowledge graphs. In _Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval_. 69–78.
  * Guan et al. (2019) Xinyu Guan, Zhiyong Cheng, Xiangnan He, Yongfeng Zhang, Zhibo Zhu, Qinke Peng, and Tat-Seng Chua. 2019.  Attentive aspect modeling for review-aware recommendation.  _ACM Transactions on Information Systems (TOIS)_ 37, 3 (2019), 1–27.
  * He et al. (2015) Xiangnan He, Tao Chen, Min-Yen Kan, and Xiao Chen. 2015\.  Trirank: Review-aware explainable recommendation by modeling aspects. In _Proceedings of the 24th ACM International on Conference on Information and Knowledge Management_. 1661–1670.
  * Hernández-Rubio et al. (2019) María Hernández-Rubio, Iván Cantador, and Alejandro Bellogín. 2019.  A comparative analysis of recommender systems based on item aspect opinions extracted from user reviews.  _User Modeling and User-Adapted Interaction_ 29, 2 (2019), 381–441.
  * Hu et al. (2018) Binbin Hu, Chuan Shi, Wayne Xin Zhao, and Philip S Yu. 2018\.  Leveraging meta-path based context for top-n recommendation with a neural co-attention model. In _Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining_. 1531–1540.
  * Huang et al. (2018) Jin Huang, Wayne Xin Zhao, Hongjian Dou, Ji-Rong Wen, and Edward Y Chang. 2018.  Improving sequential recommendation with knowledge-enhanced memory networks. In _The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval_. 505–514.
  * Huang et al. (2019) Xiaowen Huang, Quan Fang, Shengsheng Qian, Jitao Sang, Yan Li, and Changsheng Xu. 2019\.  Explainable interaction-driven user modeling over knowledge graph for sequential recommendation. In _Proceedings of the 27th ACM International Conference on Multimedia_. 548–556.
  * Koren et al. (2009) Yehuda Koren, Robert Bell, and Chris Volinsky. 2009\.  Matrix factorization techniques for recommender systems.  _Computer_ 42, 8 (2009), 30–37.
  * Koren and Sill (2013) Yehuda Koren and Joseph Sill. 2013.  Collaborative filtering on ordinal user feedback. In _Twenty-third international joint conference on artificial intelligence_.
  * Lackermair et al. (2013) Georg Lackermair, Daniel Kailer, and Kenan Kanmaz. 2013\.  Importance of online product reviews from a consumer’s perspective.  _Advances in economics and business_ 1, 1 (2013), 1–5.
  * Lerer et al. (2019) Adam Lerer, Ledell Wu, Jiajun Shen, Timothee Lacroix, Luca Wehrstedt, Abhijit Bose, and Alex Peysakhovich. 2019.  Pytorch-biggraph: A large-scale graph embedding system.  _arXiv preprint arXiv:1903.12287_ (2019).
  * Lin et al. (2015) Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. 2015.  Learning entity and relation embeddings for knowledge graph completion. In _Proceedings of the AAAI Conference on Artificial Intelligence_ , Vol. 29.
  * Luo et al. (2014) Chen Luo, Wei Pang, Zhe Wang, and Chenghua Lin. 2014\.  Hete-cf: Social-based collaborative filtering recommendation using heterogeneous relations. In _2014 IEEE International Conference on Data Mining_. IEEE, 917–922.
  * Ma et al. (2019) Weizhi Ma, Min Zhang, Yue Cao, Woojeong Jin, Chenyang Wang, Yiqun Liu, Shaoping Ma, and Xiang Ren. 2019\.  Jointly learning explainable rules for recommendation with knowledge graph. In _The World Wide Web Conference_. 1210–1221.
  * Musto et al. (2019) Cataldo Musto, Gaetano Rossiello, Marco de Gemmis, Pasquale Lops, and Giovanni Semeraro. 2019\.  Combining text summarization and aspect-based sentiment analysis of users’ reviews to justify recommendations. In _Proceedings of the 13th ACM Conference on Recommender systems_. 383–387.
  * Nickel et al. (2011) Maximilian Nickel, Volker Tresp, and Hans-Peter Kriegel. 2011\.  A three-way model for collective learning on multi-relational data. In _Icml_.
  * Ostendorff et al. (2020) Malte Ostendorff, Terry Ruas, Till Blume, Bela Gipp, and Georg Rehm. 2020.  Aspect-based Document Similarity for Research Papers.  _arXiv preprint arXiv:2010.06395_ (2020).
  * Poria et al. (2016) Soujanya Poria, Erik Cambria, and Alexander Gelbukh. 2016\.  Aspect extraction for opinion mining with a deep convolutional neural network.  _Knowledge-Based Systems_ 108 (2016), 42–49.
  * Qiu et al. (2016) Lin Qiu, Sheng Gao, Wenlong Cheng, and Jun Guo. 2016\.  Aspect-based latent factor model by integrating ratings and reviews for recommender system.  _Knowledge-Based Systems_ 110 (2016), 233–243.
  * Rendle et al. (2012) Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-Thieme. 2012.  BPR: Bayesian personalized ranking from implicit feedback.  _arXiv preprint arXiv:1205.2618_ (2012).
  * Schafer et al. (2007) J Ben Schafer, Dan Frankowski, Jon Herlocker, and Shilad Sen. 2007.  Collaborative filtering recommender systems.  In _The adaptive web_. Springer, 291–324.
  * Trouillon et al. (2016) Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier, and Guillaume Bouchard. 2016.  Complex embeddings for simple link prediction. In _International Conference on Machine Learning_. PMLR, 2071–2080.
  * Wang et al. (2018a) Hongwei Wang, Fuzheng Zhang, Jialin Wang, Miao Zhao, Wenjie Li, Xing Xie, and Minyi Guo. 2018a.  Ripplenet: Propagating user preferences on the knowledge graph for recommender systems. In _Proceedings of the 27th ACM International Conference on Information and Knowledge Management_. 417–426.
  * Wang et al. (2018b) Hongwei Wang, Fuzheng Zhang, Xing Xie, and Minyi Guo. 2018b.  DKN: Deep knowledge-aware network for news recommendation. In _Proceedings of the 2018 world wide web conference_. 1835–1844.
  * Wang et al. (2019a) Xiang Wang, Xiangnan He, Yixin Cao, Meng Liu, and Tat-Seng Chua. 2019a.  Kgat: Knowledge graph attention network for recommendation. In _Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining_. 950–958.
  * Wang et al. (2019b) Xiang Wang, Dingxian Wang, Canran Xu, Xiangnan He, Yixin Cao, and Tat-Seng Chua. 2019b.  Explainable reasoning over knowledge graphs for recommendation. In _Proceedings of the AAAI Conference on Artificial Intelligence_ , Vol. 33. 5329–5336.
  * Wu and Ester (2015) Yao Wu and Martin Ester. 2015.  Flame: A probabilistic model combining aspect based opinion mining and collaborative filtering. In _Proceedings of the Eighth ACM International Conference on Web Search and Data Mining_. 199–208.
  * Xian et al. (2019) Yikun Xian, Zuohui Fu, S Muthukrishnan, Gerard De Melo, and Yongfeng Zhang. 2019.  Reinforcement knowledge graph reasoning for explainable recommendation. In _Proceedings of the 42nd international ACM SIGIR conference on research and development in information retrieval_. 285–294.
  * Yang et al. (2014) Bishan Yang, Wen-tau Yih, Xiaodong He, Jianfeng Gao, and Li Deng. 2014.  Embedding entities and relations for learning and inference in knowledge bases.  _arXiv preprint arXiv:1412.6575_ (2014).


# ArithsGen: Arithmetic Circuit Generator for Hardware Accelerators

Jan Klhufek  Faculty of Information Technology
Brno University of Technology
Brno, Czech Republic
<EMAIL_ADDRESS>Vojtech Mrazek  Faculty of Information Technology
Brno University of Technology
Brno, Czech Republic
<EMAIL_ADDRESS>
###### Abstract

Generators of arithmetic circuits can automatically deliver various
implementations of arithmetic circuits that show different tradeoffs between
the key circuit parameters (delay, area, power consumption). However, existing
(freely-)available generators are limited if more complex circuits with a
hierarchical structure and additional architecture optimization are requested.
Furthermore, they support only a few output formats. In order to overcome the
above-mentioned limitations, we developed a new generator of arithmetic
circuits called ArithsGen. ArithsGen can generate specific architectures of
signed and unsigned adders and multipliers using basic building elements such
as wires and gates. Compared to existing generators, the user can, for
example, specify the type of adders used in multipliers. The tool supports
various outputs formats (Verilog, BLIF, C/C++, or integer netlists). ArithsGen
was evaluated in the synthesis and optimization of generic customizable
accurate and approximate adders and multipliers. Furthermore, we used the
circuits generated by ArithsGen as seeds for a tool developed to automatically
create approximate implementations of arithmetic circuits. We show that
different initial circuits (generated by ArithsGen) significantly impact the
properties of these approximate implementations. The tool is available online
at https://github.com/ehw-fit/ariths-gen.

##  I Introduction

Modern hardware accelerators of neural networks, machine learning
applications, or image processing typically employ an array of processing
elements (PEs). A processing element is a simple unit performing a basic
arithmetic operation such as addition or multiplication. Since there are many
PEs in the accelerator, selecting the proper implementation of the arithmetic
operation concerning area, delay, or power consumption is beneficial.

The standard automated synthesis tools select the implementation of the
operation automatically. However, users can re-design its implementation,
usually at the RTL description (i.e., VHDL or Verilog). These languages are
relatively cumbersome for this task, and it is not straightforward to propose
generic and configurable architectures. Therefore, some automatic generators
of arithmetic circuits were proposed. These tools receive the type of circuit
(e.g., Wallace-tree multiplier), parameters (e.g., type of internal adder),
and desired bit-width. The output is a synthesizable RTL description of the
circuit.

Some of the existing generators [1, 2, 3] suffer from two major problems: i)
they are abandoned and they use unsupported technologies, or ii) they are not
publicly available because the corresponding papers show only the main idea.
Currently, there are only a few freely available tools capable of generating
specific types of arithmetic circuits.

Arithmetic Module Generator [4] represents an on-demand service for generating
the circuits in Verilog/VHDL (HDL). Internally, it uses Arithmetic Circuit
Graph (ACG) for a formal description, verification, and conversion of a
circuit into a hierarchical HDL representation. This tool allows generating
many types of circuits (adders, multipliers, multiply-and-accumulate circuits
(MACs), multi-operand adders, etc.). Moreover, the user can specify
implementation of internal adders, the representation of numbers (signed or
unsigned), and the input word length. The tool shows the following issues: i)
since the tool is web-based and on-demand, it is unfeasible to generate
multiple circuits. ii) the tool is closed-source; therefore, the user cannot
extend the supported circuit types. iii) only the final HDL description is
available (no access to the internal ACG representation).

The tool called VHDLMultGenerator [5] uses a graphical user interface to allow
the user to specify the desired architecture of multiplier. This application
has closed source code. The output is limited to multipliers and VHDL
representation. This tool represents a closed-source approach that cannot be
extended.

Recently, GenMul tool was released [6]. This tool allows to generate fully
configurable signed and unsigned multipliers. The source codes are publicly
available. It is possible to generate the multipliers in Verilog format only.
The main advantage is a level of configurability of the multiplier. The user
specifies the accumulator of partial products and the final stage adder.
However, the scheme for generating the multipliers is hard-coded and it is
very complicated to extend the tool to support different types of multipliers
and other circuits.

Based on the shortcomings mentioned above, we decided to implement a new
generator. The generator is general, easily extensible, and supports basic
optimizations. The resulting circuits are applicable not only in standard
synthesis but also in some optimization or verification tools. These tools
(like ABC [7]) do not support HDL languages or only support their minimal
subset. Therefore, besides standard Verilog/VHDL, we decided to use common
Berkeley Logic Interchange Format (BLIF) and specialized integer netlist for
Cartesian Genetic Programming [8]. Since some tools cannot work with a
hierarchical structure, the proposed generator enables to flatten (ungroup)
the hierarchy. The generator can generate arbitrary combinational circuit,
currently we support adders, multipliers, MACs, and approximate multipliers.

##  II ArithsGen generator specification

Although HDL languages support generic constructions, converting the circuit
to different formats supported in some tools (i.e., BLIF, integer netlist) is
complicated. Despite the support for structural description in HDLs,
arithmetic circuits contain regularities difficult to describe in standard
notation. This is particularly evident in the case of a large number of
parameters (e.g., various bit widths, selection of internal components or
inner tree construction, etc.). Inheritance, argument branching, simpler
condition handling, or exceptions supported in modern languages can help to
create generic description. We decided to implement a new, simple meta-
language for structural description of combinational circuits. This language
is implemented as a Python package because Python is class-oriented, supports
inheritance, and has some useful constructions which make the circuit
description clear. Using the basic building elements such as wires and logic
gates, our proposed tool called ArithsGen can generate selected architectures
of signed and unsigned adders or multipliers. These circuits are fully
configurable. For example, the user can choose partial adders in multipliers.

Figure 1: An example of use-cases of the proposed generator of arithmetic
circuits.

Figure 1 shows the overall scheme of ArithsGen functionality. The ArithsGen
module (i.e., Python object that uses the proposed framework) has configurable
parameters (bit-width, type, additional parameters). The generator will
particularly be helpful for the design of HW accelerators (blue boxes). The
output Verilog code of the arithmetic circuit is the input for the synthesis
and implementation process. Based on the synthesis results, some optimization
algorithms can modify the configuration of ArithsGen to generate even better
arithmetic circuits for the accelerator. Another use-case (green) of the
proposed tool is benchmarking of formal verification tools. The BLIF code
produced by ArithsGen can be used as a benchmark for different verification
techniques [9]. For fast function verification of the generated circuit,
ArithsGen enables to generate the output file in C/C++. After compiling this
output, the simulation is several orders of magnitude faster than the RTL
level. The last envisioned use-case is the approximation of digital arithmetic
circuits [10]. Some automated approximation methods use BLIF files [11] or
integer netlist known in Cartesian Genetic Programming (CGP) [12]. The flat
accurate circuit generated by ArithsGen can serve as a seed for these methods.
Alternatively ArithsGen even enables to generate some manually designed
approximate circuits natively. The users thus can create approximate circuits
showing various tradeoffs between the error and other parameters (yellow
boxes). The proposed generator ArithsGen is available as an open-source
application including detailed tutorial at https://github.com/ehw-fit/ariths-
gen.

##  III Proposed methodology

The proposed library ArithsGen employs Python’s object orientation to model
the modularity of arithmetic circuits and to describe their internal
structures. We can divide the library into two parts: 1) core components such
as gates, wires, and buses, and 2) arithmetic circuits. The structure of each
component, starting with wires, buses, and logic gates, is described using its
own class. Instances of classes representing the lower building components are
used to describe more complex circuits. The appropriate wires of the circuit’s
subcomponents are then interconnected using their input-output interfaces.
Having all this combined allows for the definition of numerous circuits that
use previously defined circuits as their building components. Therefore, we
can generate not only the basic arithmetic components but also complex
circuits (i.e., MAC, DCT, etc.). On top of that, ArithsGen also focuses on
exporting the circuit from its meta-language representation into various other
output representations for further work such as C/C++, Verilog, BLIF, and the
integer netlist for CGP.

Figure 2: Class diagram of the proposed ArithsGen library. The closed arrow
describes that the class inherits (implements) the referenced class. The open
arrow shows that the class uses the referenced ones.

###  III-A Wires and buses

Single-bit wires and multi-bit buses are used to interconnect circuits through
their I/O interfaces. Buses are defined by their bit width and the wires they
contain. In addition to the general wire, there are also definitions of
classes for constant wires, i.e., the wires that are connected either to a
voltage source or to the ground. The red components on the left in Figure 2
depict the logic of the described classes.

###  III-B Logic gates

Logic gates are the most basic logically separate functional units from which
more complex circuits are created. Depending on the type of input wires
(general/constant wire) and their combination, the structure of the gate can
be simplified or omitted for the generation to achieve internal optimization
of the circuit design. Advanced design optimization will then be carried out
by the synthesis tool applied on the output of ArithsGen. In Figure 2, the
green components on the right show the overview of ArithsGen logic gates
classes and their linkage to previously defined wire components.

###  III-C Arithmetic circuits

The basic definition of arithmetic circuits is found in the abstract classes,
located on the highest level of the class hierarchy. Thanks to the use of
inheritance, this allows for a uniform way of defining different types of
arithmetic circuits independent of their bit width (one-bit, multi-bit), type
(adder, multiplier), architecture (e.g., RCA, Dadda), number representation
system (signed, unsigned) and much more. To get a better idea about the
proposed concept, the blue components in the middle of Figure 2 show the
distinct subclasses of arithmetic circuits.

####  III-C1 One bit circuits

One bit circuits represent components that use wires as inputs and whose
internal structures are built from the appropriate gates objects and their
interconnection. This type includes, for example, a half or a full adder.

####  III-C2 Complex circuits

The complex circuits are built from basic one-bit components and recursively
from other complex circuits. We defined a set of six variable signed and
unsigned adders (RCA, CSkA, and CLA), while each is represented as a class
that inherits the ArithmeticCircuit definition. The definitions of individual
adder architectures consist of sequential addition and interconnection of
single-bit subcomponents. The users can define their own arithmetic circuit
just by the structural description. For more details please follow the
tutorial in the repository.

Multiplier architectures work with more complex logic than adders due to their
need to generate an array of partial products and their subsequent
accumulation. Therefore, the multiplier superclass contains methods that are
used to generate and reduce partial products. Besides the sequential addition
and interconnection of single-bit subcomponents used to define them, some
multipliers such as Dadda and Wallace also allow the parametric selection of
an unsigned multi-bit adder used to sum the reduced bits of partial products.
The user can specify an arbitrary adder (even some new ones) by specifying the
unsigned_adder_class_name parameter in the constructor.

The currently implemented approximate multiplier architectures are broken-
array multiplier (BAM) and truncated multiplier (TM). Their design corresponds
to an array multiplier with some ommited partial product cells to introduce an
error.

To demonstrate different types of arithmetic circuits, we also implemented an
Array divider based on a series of iterative subtractions. In Figure 3 we show
the capability of the framework to construct complex components from
previously defined building blocks. The code represents a widely-used
multiply-and-accumulate circuit that performs $(a\cdot b)+r$ operation.
Similarly, more complex arithmetic circuits such as logarithmic or floating-
point multipliers could be added. The interconnection, flattening, and export
from the inner meta-language representation to the desired output formats are
natively supported by the ArithsGen framework.

Figure 3: An example code of an unsigned multiply-and-accumulate circuit that
consists of $n$-bit array multiplier and $2n$-bit RCA. The red sections
signify the parametric choice of adder and multiplier circuits that can be
selected by means of an optimization algorithm. An advanced level of
configurability could be introduced through the class instantiation. It is
also possible configure ArithsGen to use specialized PDK components (e.g.,
full-adders, MUXes).

###  III-D Output formats

The design generated using ArithsGen can be exported from its inner
representation into one of the following formats: Verilog, BLIF, C/C++ and
integer netlist for CGP. The export is performed by a way of recursively
extracting information about all the various subcomponents hierarchically
composing the exporting circuit. Since some tools do not support hierarchical
structure, ArithsGen implements flattening — the subcomponents are recursively
extracted to the level of the basic operations (gates). The framework must
guarantee that the names of wires are unique in each instance of the
component. For the flat format, we also support the integer netlist used by
tools for circuit optimization and approximation based on CGP. The code is
generated in the following steps: i) creating the input buses, ii)
instantiating the selected arithmetic circuit, and iii) calling the proper
function (e.g., get_verilog_code_{flat|hier}) to get the desired
representation. Note that all of the output representations except for integer
netlist support both the flattened and hierarchical export variants. The
flattened netlist is used to represent interconnections between the simplest
components – gates along with all their connectivity information preserved.

Figure 4: Results of approximation of arithmetic circuit (a) The final PDP of
approximate 8-bit multipliers constructed from different seeds for a given
maximal worst-case error. The filled area shows a 0.95 confidence interval;
(b,c) Parameters of resulting circuit approximated using CGP with different
seeds compared to manually designed Broken-array (BAM) and Truncated (TM)
multipliers (both implemented in ArithsGen), and EvoApproxLib [13].

##  IV Experiments

###  IV-A Validation and verification

In the first experiment, we verified the validity of the generated arithmetic
circuits. We used simulation tools to ensure correct functionality of smaller
circuits and ABC verification for bigger circuits. We also observed that
32-bit circuits are generated in less than 0.5 seconds for all output formats
(e.g., up to 12,094 lines of code for flat 32-bit multiplier).

###  IV-B Scenario I: Hardware accelerator design

The first experimental scenario focuses on the design of hardware
accelerators. We evaluated the constructed arithmetic circuits in ASIC design
(Synopsys Design Compiler and FreePDK45 library, optimized for delay with high
effort). We investigated that flat adders have 25-31% better power consumption
than hierarchical adders. This was caused by the fact that the synthesis tool
can better optimize the flat structure. Please note that the synthesis tool
supports flattening natively. However, there were no significant power
differences for very large multipliers after flattening.

To demonstrate the impact of ArithsGen setting on properties of the selected
multiplier, we evaluated 16-bit multipliers in detail for some of the
synthesis parameters (Table I). Note that implementation parameters
influencing the final layout were not considered. We observed that Dadda
multipliers achieved 10% area savings in contrast with the array multiplier.
However, the latency is the same or even worse (by 4%) for the signed variant.
Dadda multipliers improve the power consumption by 14-23%. The Wallace-tree
multipliers have the worst array and delay, but they have shown excellent
power consumption. For the partial product and final stage adder, it is better
to use RCA or CSkA than CLA adders.

TABLE I: Parameters of synthesized 16-bit multipliers

Multiplier Type |  Area [$\mu m^{2}$] |  Delay [ns] |  Power [mW]
---|---|---|---
Unsign. | Sign. | Unsign. | Sign. | Unsign. | Sign.
Array | 5258 | 5311 | 5.63 | 5.43 | 3.87 | 3.82
Dadda (CLA) | 4951 | 4856 | 5.65 | 5.45 | 3.10 | 3.28
Dadda (CSkA) | 4902 | 4816 | 5.86 | 5.39 | 2.98 | 3.17
Dadda (RCA) | 4902 | 4815 | 5.87 | 5.40 | 2.98 | 3.17
Wallace tree (CLA) | 5643 | 5692 | 5.78 | 6.04 | 3.05 | 3.20
Wallace tree (CSkA) | 5531 | 5539 | 5.81 | 5.87 | 2.93 | 3.07
Wallace tree (RCA) | 5532 | 5537 | 5.81 | 5.87 | 2.93 | 3.07

###  IV-C Scenario II: Approximation of arithmetic circuits

In the second experiment we approximated accurate 8-bit circuits to achieve a
good worst-case arithmetic error (WCE)111Defined as $\max_{\forall x\in
B^{n}}|f(x)-f^{\prime}(x)|$, when $f$ is accurate and $f^{\prime}$ is
approximate function, and $B^{n}$ is a set of all possible input vectors. and
area trade-off. We decided to use Cartesian genetic programming approximation.
This algorithm starts with an accurate circuit (the so-called parent) and
iteratively modifies it. The key idea is that the algorithm accepts the random
modification as a new parent in the next step if and only if the area is
better or equal to the current parent, and the WCE is below the given
threshold. For more details about this algorithm, please follow [14, 12].
Since the CGP algorithm is non-deterministic, we run ten independent runs for
each configuration and limited each run to 2 hours. Please note this
experiment would not have been possible without the proposed generator of
seeds in a specific integer flat format.

Figure 4a shows the final power-delay product (PDP) for various seeds and WCE
thresholds. We can see that Wallace-tree (CLA) is almost always the worst
seed, but for larger WCEs the results are competitive to the others. On the
other hand, Dadda (RCA) is the best seed to reach small WCEs, but less
competitive for increased WCE. Note that the approximation method is always
the same, only its seed is modified in our experiments.

We also compared the resulting circuits with the very last version of the
state-of-the-art library of approximate components EvoApproxLib [13]. This
library was constructed by CGP with one accurate circuit as a seed. We also
implemented a generic description Broken-Array and Truncated multiplier,
widely used configurable manually designed multipliers [15], in ArithsGen.
Different configurations were also compared to the resulting circuits. Figures
4bc show that the different seeds allow for improving PDP vs. Mean-arithmetic
error trade-off significantly. Although the library was constructed for power
as the main design objective, the proposed results slightly improve power vs.
WCE trade-off too.

##  V Conclusion

In this work, we introduce a new generator of arithmetic circuits. In contrast
to existing solutions, the proposed tool supports multiple output formats
(even the flattened one), is easy-to-extend, and is open-source. ArithsGen
also allows the construction of complex circuits such as MAC. In addition to
the standard application in hardware accelerators, this tool enables the users
to benchmark verification algorithms or improve libraries of approximate
circuits.

Acknowledgement This work was supported by the Czech science foundation
project GA22-02067S.

## References

  * [1] R. Zimmermann, “Vhdl library of arithmetic units,” in _FDL’98_ , 1998.
  * [2] Y. Watanabe, N. Homma _et al._ , “Arithmetic module generator with algorithm optimization capability,” _ISCAS’08_ , 2008.
  * [3] Y. Sugawara, R. Ueno _et al._ , “System for automatic generation of parallel multipliers over galois fields,” in _ISMVL’15_ , 2015.
  * [4] About arithmetic module generator (amg). RIEC, Tohoku University. [Online]. Available: https://www.ecsis.riec.tohoku.ac.jp/topics/amg/
  * [5] J. Kulisz and J. Mikucki, “An ip-core generator for circuits performing arithmetic multiplication,” _IFAC Proc. Volumes_ , vol. 46, no. 28, 2013\.
  * [6] A. Mahzoon, D. Große, and R. Drechsler, “GenMul: Generating architecturally complex multipliers to challenge formal verification tools,” in _Recent Findings in Boolean Techniques_. Springer, 2021, pp. 177–191.
  * [7] R. Brayton and A. Mishchenko, “Abc: An academic industrial-strength verification tool,” in _Computer Aided Verification_ , 2010, pp. 24–40.
  * [8] J. F. Miller, _Cartesian Genetic Programming_. Springer-Verlag, 2011.
  * [9] A. Mahzoon, D. Große _et al._ , “Towards formal verification of optimized and industrial multipliers,” in _DATE’20_ , 2020, pp. 544–549.
  * [10] S. Mittal, “A survey of techniques for approximate computing,” _ACM Comput. Surv._ , vol. 48, no. 4, pp. 62:1–62:33, Mar. 2016.
  * [11] S. Hashemi, H. Tann, and S. Reda, “Blasys: approximate logic synthesis using boolean matrix factorization,” in _DAC’18_. IEEE, 2018.
  * [12] M. Češka, J. Matyaš _et al._ , “Approximating complex arithmetic circuits with formal error guarantees: 32-bit multipliers accomplished,” in _ICCAD’17_ , 2017, pp. 416–423.
  * [13] V. Mrazek, R. Hrbacek _et al._ , “Evoapprox8b: Library of approximate adders and multipliers for circuit design and benchmarking of approximation methods,” in _DATE’17_.
  * [14] V. Mrazek, S. S. Sarwar _et al._ , “Design of power-efficient approximate multipliers for approximate artificial neural networks,” in _ICCAD ’16_.
  * [15] H. Jiang, C. Liu, L. Liu, F. Lombardi, and J. Han, “A review, classification, and comparative evaluation of approximate arithmetic circuits,” _J. Emerg. Technol. Comput. Syst._ , vol. 13, no. 4, Aug. 2017.