Abstract
The functional programming language Erlang is well-suited for concurrent and distributed applications, but numerical computing is not seen as one of its strengths. Yet, the recent introduction of Federated Learning, which leverages client devices for decentralized machine learning tasks, while a central server updates and distributes a global model, motivated us to explore how well Erlang is suited to that problem. We present the Federated Learning framework ffl-erl and evaluate it in two scenarios: one in which the entire system has been written in Erlang, and another in which Erlang is relegated to coordinating client processes that rely on performing numerical computations in the programming language C. There is a concurrent as well as a distributed implementation of each case. We show that Erlang incurs a performance penalty, but for certain use cases this may not be detrimental, considering the trade-off between speed of development (Erlang) versus performance (C). Thus, Erlang may be a viable alternative to C for some practical machine learning tasks.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Source code artifacts accompanying this paper are available at https://gitlab.com/fraunhofer_chalmers_centre/functional_federated_learning.
- 2.
For illustrative purposes, we chose clear code over computationally more efficient code at some points. For instance, the function forward in Code Listing 1.3 constructs a temporary list, which could be avoided by computing the dot product with an accumulator. However, for benchmarking purposes we used more efficient code.
- 3.
Training normally ends after a given number of iterations or once a predefined error threshold has been met. The latter would make use of the computed error, based on the list Delta, but the corresponding code is omitted as it is not conceptually interesting.
- 4.
Refer to the section on Natively Implemented Functions (NIFs) in the official Erlang documentation for further details: http://erlang.org/doc/man/erl_nif.html (accessed on June 28, 2018).
- 5.
The corresponding code repository is located at https://bitbucket.org/nato/yanni (accessed on August 6, 2018).
References
Allison, L.: Models for machine learning and data mining in functional programming. J. Funct. Program. 15(1), 15–32 (2005)
Bauer, H., Goh, Y., Schlink, S., Thomas, C.: The supercomputer in your pocket. McKinsey on Semiconductors, pp. 14–27 (2012)
Chen, D., Zhao, H.: Data security and privacy protection issues in cloud computing. In: Proceedings of the 2012 International Conference on Computer Science and Electronics Engineering (ICCSEE), vol. 1, pp. 647–651. IEEE (2012)
Coppola, R., Morisio, M.: Connected car: technologies, issues, future trends. ACM Comput. Surv. (CSUR) 49(3), 1–36 (2016)
Cuccu, G., Togelius, J., Cudre-Mauroux, P.: Playing atari with six neurons. arXiv preprint arXiv:1806.01363 (2018)
Evans-Pughe, C.: The connected car. IEE Rev. 51(1), 42–46 (2005)
Fisher, R., Marshall, M.: Iris Data Set. UC Irvine Machine Learning Repository (1936)
Gybenko, G.: Approximation by superposition of sigmoidal functions. Math. Control Signals Syst. 2(4), 303–314 (1989)
Hornik, K.: Approximation capabilities of multilayer feedforward networks. Neural Netw. 4(2), 251–257 (1991)
Johansson, E., Pettersson, M., Sagonas, K.: A high performance Erlang system. In: Proceedings of the 2nd ACM SIGPLAN International Conference on Principles and Practice Of Declarative Programming, pp. 32–43. ACM (2000)
LeCun, Y., Cortes, C., Burges, C.J.: MNIST handwritten digit database. AT&T Labs (2010). http://yann.lecun.com/exdb/mnist
Lee, J., Kim, C.M.: A roadside unit placement scheme for vehicular telematics networks. In: Kim, T., Adeli, H. (eds.) ACN/AST/ISA/UCMA -2010. LNCS, vol. 6059, pp. 196–202. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-13577-4_17
Löscher, A., Sagonas, K.: The Nifty way to call hell from heaven. In: Proceedings of the 15th International Workshop on Erlang, pp. 1–11. ACM (2016)
McMahan, H.B., Moore, E., Ramage, D., Hampson, S., et al.: Communication-efficient learning of deep networks from decentralized data. arXiv preprint arXiv:1602.05629 (2016)
Nissen, S.: Implementation of a fast artificial neural network library (FANN). Report, Department of Computer Science University of Copenhagen (DIKU) 31, 29 (2003)
Orr, G.B., Müller, K.R.: Neural Networks: Tricks of the Trade. Springer, Heidelberg (2003). https://doi.org/10.1007/978-3-642-35289-8
Sagonas, K., Pettersson, M., Carlsson, R., Gustafsson, P., Lindahl, T.: All you wanted to know about the HiPE compiler (but might have been afraid to ask). In: Proceedings of the 2003 ACM SIGPLAN Workshop on Erlang, pp. 36–42. ACM (2003)
Sher, G.I.: Handbook of Neuroevolution Through Erlang. Springer, Heidelberg (2013). https://doi.org/10.1007/978-1-4614-4463-3
Srihari, S.N., Kuebert, E.J.: Integration of hand-written address interpretation technology into the United States postal service remote computer reader system. In: Proceedings of the Fourth International Conference on Document Analysis and Recognition, vol. 2, pp. 892–896. IEEE (1997)
Tene, O., Polonetsky, J.: Privacy in the age of big data: a time for big decisions. Stan. L. Rev. Online 64, 63–69 (2011)
Ulm, G., Gustavsson, E., Jirstrand, M.: OODIDA: On-board/Off-board distributed data analytics for connected vehicles. arXiv preprint arXiv:1902.00319 (2019)
Yu, T., Clack, C.: PolyGP: a polymorphic genetic programming system in Haskell. In: Genetic Programming, vol. 98 (1998)
Acknowledgements
Our research was financially supported by the project On-board/Off-board Distributed Data Analytics (OODIDA) in the funding program FFI: Strategic Vehicle Research and Innovation (DNR 2016-04260), which is administered by VINNOVA, the Swedish Government Agency for Innovation Systems. It was carried out in the Fraunhofer Cluster of Excellence “Cognitive Internet Technologies.” Adrian Nilsson and Simon Smith assisted with the implementation. Melinda Tóth pointed us to Sher’s work. We also thank our anonymous reviewers for their helpful feedback.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Mathematical Derivation of Federated Stochastic Gradient Descent
A Mathematical Derivation of Federated Stochastic Gradient Descent
In Sect. 2.2 we briefly describe Federated Stochastic Gradient Descent. In the current section, we present the complete derivation. As a reminder, we stated that in Stochastic Gradient Descent, weights are updated this way:
Furthermore, we started with the following equation, which is the objective function we would like to minimize:
The gradient of \(F^{j}\) is expressed in the following formula:
To continue from here, each client updates the weights of the machine learning model the following way:
On the server, the weights of the global model are updated. The original equation can be reformulated in a few steps:
The reformulation in the last line is equivalent to Eq. 6 above. In case the transformation between Eqs. 12 and 13 is unclear, consider that the summand simplifies to
The second summand in Eq. 12 can be simplified as follows:
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Ulm, G., Gustavsson, E., Jirstrand, M. (2019). Functional Federated Learning in Erlang (ffl-erl). In: Silva, J. (eds) Functional and Constraint Logic Programming. WFLP 2018. Lecture Notes in Computer Science(), vol 11285. Springer, Cham. https://doi.org/10.1007/978-3-030-16202-3_10
Download citation
DOI: https://doi.org/10.1007/978-3-030-16202-3_10
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-16201-6
Online ISBN: 978-3-030-16202-3
eBook Packages: Computer ScienceComputer Science (R0)