12 Logarithm Approximate Floating
12 Logarithm Approximate Floating
Lingyun Yao1 Martin Trapp2 Karthekeyan Periasamy1 Jelin Leslin1 Gaurav Singh1 Martin Andraud1
1
Electrical Engineering Dept., Aalto University, Espoo, Finland
2
Computer Science Dept., Aalto University, Espoo, Finland
Accepted for the 6th Workshop on Tractable Probabilistic Modeling at UAI (TPM 2023).
(a) Probabilistic Circuit (b) Corresponding hardware representation for MAP Inference
max
1x1 =0 v1 1x1 =1 v2
max max
X1 = 0 X1 = 1
w3,2
w2,1 w2,2 w3,1 w3,2
Figure 1: Illustration of a PC (a) over discrete RVs (X1 , X2 , X3 ) and the corresponding hardware realization of MAP
inference (b). For this, sum nodes are replaced by max operators, and an additional propagation path for information bits is
added to back-track the most probable path (MAP result)
2
results in Mitchell’s approximate multiplication and called 4.2 ENERGY SAVING WITH DIFFERENT
as Addition-As-Int (AAI) [11]. By doing so, we can directly NUMBER OF BITS
obtain an approximation from Eq. (2) to Eq. (3). Denoting
×
e as the approximate multiplication, we obtain: We replaced all multipliers with AAI to assess the error
and the power savings for MAR and MAP queries under
x×
e y = FLOAT(INT(x) + INT(y)) (4) varying resolutions. For MAR queries, we computed the
squared error according to a software baseline (64-bits), i.e.,
2
P
Where INT(·) interprets the binary string of the IEEE x (p(x)−q(x)) where q(·) denotes the model with lower
754 floating-point representations as integer strings and resolution multipliers and p(·) the PC in software. In addi-
FLOAT(·) interprets the resulting integer string back to tion, we calculated the maximum and minimum obtainable
the IEEE 754 floating-point representation. Therefore, per- errors. For MAP queries, we calculated the MAP inference
forming AAI in hardware only requires integer addition accuracy over the latent variables (assuming complete evi-
operators. dence) regarding the baseline. We collected the optimized
bits in Table 1 where the Nb represents 32 bits, Nbe and Nba
are the number of bits related to the smallest error in the
Exact multiplier exact multiplier and approximate multiplier respectively.
AAI
40
Power (µW)
3
Table 1: Overview of optimal configuration and performances over several data sets. Nbe and Nba correspond to the settings
with the smallest error and the loss is the error relative to the max. error.
1
2
1 0.5
0.5
1
0 0 0 0
3 7 11 15 3 7 11 15 3 7 11 15 3 7 11 15
·10−3 ·10−26 ·10−68 ·10−2
3 2 1
Approx. Error
Exact Multi.
1
2
1 0.5
0.5
1
0 0 0 0
3 7 11 15 3 7 11 15 3 7 11 15 3 7 11 15
Mantissa Mantissa Mantissa Mantissa
Figure 3: Results for AAI (first row) and exact (second row) multipliers using varying number of exponent ( E=8,
E=11) and mantissa bits. Maximum possible error ( ) is shown for reference.
1 1 1 1
Exact Multi.
MAP ACC
Figure 4: MAP accuracy (ACC) results for AAI (first row) and exact (second row) multipliers using varying the number of
exponent and mantissa bits ( m=1, m=3, m=5).
4
Acknowledgements [10] John N Mitchell. Computer multiplication and divi-
sion using binary logarithms. IRE Transactions on
MT acknowledges funding from the Academy of Finland Electronic Computers, (4):512–517, 1962.
(grant number 347279).
MA acknowledges partial funding from the Academy of Fin- [11] Tsuguo Mogami. Deep neural network training with-
land through the project WHISTLE (grant number 332218). out multiplications. arXiv preprint arXiv:2012.03458,
This work has also been partially funded by the European 2020.
Union through the SUSTAIN project. Views and opinions
expressed are, however, those of the author(s) only and [12] B. Moons and M. Verhelst. Energy-efficiency and
do not necessarily reflect those of the European Union or accuracy of stochastic computing circuits in emerg-
EISMEA. Neither the European Union nor the granting ing technologies. IEEE Journal on Emerging and
authority can be held responsible for them. Selected Topics in Circuits and Systems, 4(4):475 –
486, 2014. ISSN 2156-3357. doi: 10.1109/JETCAS.
2014.2361070.
References
[13] Robert Peharz, Antonio Vergari, Karl Stelzner, Alejan-
[1] YooJung Choi. Probabilistic Reasoning for Fair and dro Molina, Martin Trapp, Xiaoting Shao, Kristian Ker-
Robust Decision Making. PhD thesis, 2022. sting, and Zoubin Ghahramani. Random sum-product
networks: A simple and effective approach to proba-
[2] YooJung Choi, Antonio Vergari, and Guy Van den bilistic deep learning. In Amir Globerson and Ricardo
Broeck. Probabilistic circuits: A unifying framework Silva, editors, 35th Conference on Uncertainty in Arti-
for tractable probabilistic models. oct 2020. ficial Intelligence (UAI), volume 115 of Proceedings
of Machine Learning Research, pages 334–344. AUAI
[3] Young-kyu Choi, Carlos Santillana, Yujia Shen, Adnan Press, 2019.
Darwiche, and Jason Cong. Fpga acceleration of prob-
abilistic sentential decision diagrams with high-level [14] Hoifung Poon and Pedro M. Domingos. Sum-product
synthesis. ACM Trans. Reconfigurable Technol. Syst., networks: A new deep architecture. In Fábio Gagliardi
sep 2022. ISSN 1936-7406. doi: 10.1145/3561514. Cozman and Avi Pfeffer, editors, 27th Conference on
Uncertainty in Artificial Intelligence (UAI), pages 337–
[4] Adnan Darwiche. A differential approach to inference 346. AUAI Press, 2011.
in bayesian networks. J. ACM, 50(3):280–305, 2003.
doi: 10.1145/765568.765570. [15] Tahrima Rahman, Prasanna V. Kothalkar, and Vibhav
Gogate. Cutset networks: A simple, tractable, and
[5] Robert Gens and Domingos Pedro. Learning the struc- scalable approach for improving the accuracy of chow-
ture of sum-product networks. In International con- liu trees. In Toon Calders, Floriana Esposito, Eyke
ference on machine learning, pages 873–880. PMLR, Hüllermeier, and Rosa Meo, editors, European Confer-
2013. ence in Machine Learning and Knowledge Discovery
in Databases ECML, volume 8725 of Lecture Notes
[6] Zoubin Ghahramani. Probabilistic machine learning in Computer Science, pages 630–645. Springer, 2014.
and artificial intelligence. Nature, 521(7553):452–
459, May 2015. ISSN 1476-4687. doi: 10.1038/ [16] Amirmohammad Rooshenas and Daniel Lowd. Learn-
nature14541. ing sum-product networks with direct and indirect vari-
able interactions. In International Conference on Ma-
[7] Ari Heljakka, Martin Trapp, Juho Kannala, and Arno chine Learning, pages 710–718. PMLR, 2014.
Solin. Disentangling model multiplicity in deep learn-
ing. arXiv preprint arXiv: 2206.08890, 2023. [17] Jae-sun Seo, Jyotishman Saikia, Jian Meng, Wangxin
He, Han-sok Suh, Anupreetham, Yuan Liao, Ahmed
[8] Doga Kisa, Guy Van den Broeck, Arthur Choi, and Hasssan, and Injune Yeo. Digital versus analog arti-
Adnan Darwiche. Probabilistic sentential decision di- ficial intelligence accelerators: Advances, trends, and
agrams. In Chitta Baral, Giuseppe De Giacomo, and emerging designs. IEEE Solid-State Circuits Maga-
Thomas Eiter, editors, 14th International Conference zine, 14(3):65–79, 2022. doi: 10.1109/MSSC.2022.
on Principles of Knowledge Representation and Rea- 3182935.
soning KR. AAAI Press, 2014.
[18] N. Shah, L. I. G. Olascoaga, S. Zhao, W. Meert, and
[9] Gary Marcus. The next decade in AI: Four steps to- M. Verhelst. 9.4 piu: A 248gops/w stream-based pro-
wards robust artificial intelligence. arXiv preprint cessor for irregular probabilistic inference networks
arXiv: 2002.06177, 2020. using precision-scalable posit arithmetic in 28nm. In
5
2021 IEEE International Solid- State Circuits Confer- for edge inference of deep neural networks. Nature
ence (ISSCC), volume 64, pages 150–152, 2021. doi: Electronics, 1(4):216–222, 2018.
10.1109/ISSCC42613.2021.9366061.
[19] N. Shah, W. Meert, and M. Verhelst. Dpu-v2: Energy-
efficient execution of irregular directed acyclic graphs.
In 2022 55th IEEE/ACM International Symposium on
Microarchitecture (MICRO), pages 1288–1307, Los
Alamitos, CA, USA, oct 2022. IEEE Computer Soci-
ety.
[20] Nimish Shah, Laura I Galindez Olascoaga, Wannes
Meert, and Marian Verhelst. Problp: A framework for
low-precision probabilistic inference. In Proceedings
of the 56th Annual Design Automation Conference
2019, pages 1–6, 2019.
[21] L. Sommer, J. Oppermann, A. Molina, C. Binnig,
K. Kersting, and A. Koch. Automatic mapping of
the sum-product network inference problem to fpga-
based accelerators. In 2018 IEEE 36th International
Conference on Computer Design (ICCD), pages 350 –
357, 2018. doi: 10.1109/ICCD.2018.00060.
[22] Lukas Sommer, Lukas Weber, Martin Kumm, and An-
dreas Koch. Comparison of arithmetic number for-
mats for inference in sum-product networks on fpgas.
In 2020 IEEE 28th Annual international symposium
on field-programmable custom computing machines
(FCCM), pages 75–83. IEEE, 2020.
[23] Emma Strubell, Ananya Ganesh, and Andrew McCal-
lum. Energy and policy considerations for deep learn-
ing in NLP. In Proceedings of the 57th Conference of
the Association for Computational Linguistics (ACL),
pages 3645–3650. Association for Computational Lin-
guistics, 2019.
[24] Martin Trapp, Robert Peharz, Hong Ge, Franz
Pernkopf, and Zoubin Ghahramani. Bayesian learning
of sum-product networks. In Hanna M. Wallach, Hugo
Larochelle, Alina Beygelzimer, Florence d’Alché-Buc,
Emily B. Fox, and Roman Garnett, editors, 32nd Con-
ference on Neural Information Processing Systems
(NeurIPS), pages 6344–6355, 2019.
[25] Fabrizio Ventola, Steven Braun, Zhongjie Yu, Martin
Mundt, and Kristian Kersting. Probabilistic circuits
that know what they don’t know. arXiv preprint arXiv:
2302.06544, 2023.
[26] N. Verma, H. Jia, H. Valavi, Y. Tang, M. Ozatay,
L. Chen, B. Zhang, and P. Deaville. In-memory com-
puting: Advances and prospects. IEEE Solid-State
Circuits Magazine, 11(3):43–55, Summer 2019. ISSN
1943-0590. doi: 10.1109/MSSC.2019.2922889.
[27] Xiaowei Xu, Yukun Ding, Sharon Xiaobo Hu, Michael
Niemier, Jason Cong, Yu Hu, and Yiyu Shi. Scaling