FEDERATED LEARNING FOR SPANISH PORTS AS AN AID TO DIGITIZATION

: The Spanish Port System is immersed in the process of digital transformation towards the concept of Ports 4.0. This entails new regulatory and connectivity requirements, making it necessary to implement the new technologies offered by the market towards digitalization. The digitalization of the individual processes in a first step helps the exchange of digital information between the members of the port community. The next step will mean that the information flow between the participants of a port community is done in a reliable, efficient, paperless way, and thanks to technologies. However, for the Spanish port sector, data exchange has a competitive disadvantage. That is why Federated Learning is proposed. This approach allows several organizations in the port sector to collaborate in the development of models, but without the need to directly share sensitive port data among themselves. Instead of gathering data on a single server, the data remains locked on your server, and the algorithms and predictive models travel between them. The goal of this approach is to benefit from a large set of data, which contributes to increased Machine Learning performance while respecting data ownership and privacy. Through an Inter-institution or "Cross-silo FL" model, different institutions contribute to the training with their local datasets in which different companies collaborate in training a learning machine for the discovery of patterns in private datasets of high sensitivity and high content. This environment is characterized by a smaller number of participants than the mobile case, with typically better bandwidth and less intermittency.


Introduction
Digital transformation is of great importance in the business world, having an important impact in any of its sectors. It is within this framework that ports and logistics within maritime transport are considered to exemplify these developments [23]. Thus, as actors in global supply chains, seaports are particularly affected by technological change [45].
Digitization is taking the maritime industry beyond its traditional boundaries, providing new opportunities to improve the productivity, efficiency and sustainability of logistics [41]. The most urgent needs of digitization are investments in technology and cooperation between actors. This could enable information sharing and better coordination and collaboration, where such data is often seen as an obstacle in highly competitive environments [21].
Therefore, the role of ports has changed dramatically from their traditional function of connecting sea and land through loading and unloading operations. It has become an essential part of the global logistics networks [29], which manage the flow of cargo and provide value-added logistics services in an efficient, effective and environmentally friendly manner [30].
In the specific case of maritime transport, one of the most notable examples of digitization is smart ports [2]. Their positive impact on the supply chain is allowing processes to be optimized through more intelligent production. The use of technology in the business context is always aimed at increasing performance [31]. For digitization, the smooth exchange of data is the key, but this obstacle is not yet overcome in the port environment [38]. It is therefore proposed that Federated Learning be used as a corporate machine learning system without centralized training data to support digitization [17].
The aim of this article is to show a new methodology for data exchange in ports. In times of uncertainty, organizations with clear challenges are adapting rapidly to new models of digital customer relationships and new, more flexible and digital ways of working. Dispersed and remote teams will make a clear difference to competitiveness in the short term. But the key will be to drive and accelerate new scenarios with unique customer and employee experiences in mind.
Organizations are investing in data analytics to transform customer experiences, improve efficiency and identify new business opportunities. But the value of data analytics will depend on the data they are given and on professionals who really know how to manage with data. To keep pace with changing customer expectations, organizations need faster ways to unlock data, visualize it and gain insights. That is why this article is intended as a sample methodology applicable to this sector.
Businesses turn to the data-driven company model to ensure that the decisions they make are the right ones, based on what they have learned so far, and ports need to join this trend, but they are hampered by the impediment of data sharing.

Spanish ports, data and digitalization
The transformation towards Port 4.0 involves measures to enhance logistics efficiency, infrastructure efficiency and operations efficiency in the provision of services, as well as improving environmental and energy sustainability, safety and security [54]. This will require support for the digitization of processes and intelligent platforms [1].
It is often not clear what "digital" means for a port organization [40]. It is, in fact, a long-term process that requires organizations and stakeholders to undergo continuous structural, functional and strategic transformation [33].
The digital transformation is a process, the results of which go far beyond technological considerations. Complex knowledge of processes and markets is needed down to the last link in the chain: How to do processes work in the different actors of the transport chain? What difficulties exist in international logistics? How are customer opinions processed properly? Which areas should be protected and how? [48] Nowadays, new technologies allow their implementation even in the smallest steps of the logistic and productive chains [32]. More and more things can be controlled at a lower cost, but it is necessary to decide carefully what you want to control, what data and what knowledge you need for this [9]. It must also be decided what benefits can be derived to achieve the objectives in terms of quality, productivity and efficiency [12].
The Port of Rotterdam, in association with the Future Ports program of the British Ports Association, recently published the document "Step by Step to the Digital Port", which describes a digital maturity model, as described in fig. 1.   Fig. 1. Digital Maturity Levels developed by the Association of British Ports and Harbors from https://www.portofrotterdam.com/en/port-forward/step-by-step-towards-a-digital-port The level 1 of the Spanish Port System means that there are a large number of actors involved in the operation processes in the port. For example, we have the port authority, nautical service providers, terminal operators and customs agents. By digitizing their processes, each actor can be more efficient.
The automation of each individual process facilitates the collection of data that can be used to make the port operate more efficiently, safely and sustainably [28]. In Rotterdam, the implementation of a Port Management System (PMS) reduced ship clearance time by 30 minutes, representing a saving of 150 million Euros per year. The money companies waste on non-automated processes exceeds 400 billion Euros. This amount is the result, among other reasons, of the complexity of the spreadsheets sent by e-mail or the volume of information still collected in the databases from handwritten notes [51].
The study [14] highlights that towards the digitalization of Spanish ports, the indicators that must be influenced in order to define a strategic plan and future lines of action are (see fig. 2), firstly, data: a clear message is that sharing data strengthens processes, reduces waste and makes port operations more efficient. While it is clear that digitization can lead to greater efficiency, help reduce costs and provide numerous environmental benefits. Ports and the maritime industry in general have been slower to adopt digitization than other industries, the main problem facing the Spanish port sector is the fear of generating a competitive disadvantage if data is shared. Secondly, it is necessary to move towards a new paradigm for the port community, and the third important element to advance in the process is the development of new profiles.   [39]. The One-Stop Shop is conceived as the only point where the information to be declared is communicated for once when a ship calls at a Spanish port [45]. Puertos del Estado makes the necessary information available to the competent Spanish authorities, to other Member States, and to European authorities such as the EMSA. The Port Authorities are the local access points to the national window [47]. In order for the systems to be interoperable and compatible, Puertos del Estado establishes the formats for making the information available as well as the syntax and structure of the electronic exchange messages, and the necessary business rules and procedures. This section contains the User Guides for the different messages and process flows, and the Business Rules and Procedures applicable to interaction with the Public Administrations and the National Single Window.
Within this effort to promote an exchange of data Puertos del Estado, the first milestone of the SIMPLE (SIMplification of Processes for a Logistic Enhancement) platform that contemplates the analysis, development, implementation and management of a useful prototype for a logistics information exchange system [15]. In this sense, the SIMPLE technological platform is required to include, with a distributed architecture configuration, the functionalities corresponding to the information flows related to the intermodal transport chain: road and rail routes of the goods and means of transport, access to the rail-road intermodal terminals and to the ports and their terminals, and certain services of the user communities of the ports and intermodal terminals [42].
The public bodies involved in the project are the Ministerio de Transportes, Movilidad y Agenda Urba, Adif 1 and Puertos del Estado. The work that is the object of this tender consists of the analysis, design, development and subsequent implementation, maintenance and management of an operational prototype in relation to the aforementioned technological platform, as set out in the specifications. The solution must cover the processes related to the import, export and transit of goods, both from origin to departure through a Spanish port, as well as those that enter through a port to their destination and the flows of national and international land transport goods, whether by road or rail. With regard to traceability, documentary traceability must be considered, through the monitoring of the different documents generated in the various business interactions, the physical one, where users must be able to monitor the goods in the greatest possible detail, and the administrative formalities one, where users can provide data to the administration electronically or complete the procedures that may be required. This project is not yet a reality.
An example of a Blockchain project is the DataPorts project (A Data Platform for the Cognitive Ports of the Future) [13]. The project is co-financed by the European Commission through the H2020 programme and its main objective is to take advantage of the large amount of data generated in seaports by digitalization. However, to achieve efficient collaboration and benefit from AI-based technology, a new integrative environment is needed. The EU-funded DataPorts project will design an industrial data platform [35]. The Cognitive Ports Data Platform will connect existing digital infrastructures of seaports and their systems, establish rules for secure and reliable data exchange and trade, and provide powerful data analysis services. This will enable the creation of different intelligent applications according to the related requirements. Before full implementation in European ports, the platform will be launched in two European seaports. The platform will make European seaports reliable, strong and integrated.
The efficient use and reuse of information is the key to the correct flow of data from businesses to authorities, as well as to the improvement of the logistics chain and competitiveness [43]. It will therefore be necessary to increase security and data protection in the sector to avoid manipulation of sensitive systems as well as implement measures to protect data against unauthorized access and any kind of abuse (by cloud-based user systems, access management, device management and data backup) [19].
Most of the authors point out that the great challenge is precisely sharing of information by Port Authorities, the collaboration between ports and the management capacity of stakeholders by Port Authorities [4]. The need for cooperation between ports, in order to truly share data and perceptions, is something that has not been explored. Driven by a certain form of protectionism by port authorities on their own data, it is a major obstacle to the development of a true Smart Port strategy [27]. Finally, the dichotomy between the port authority and the terminal operator adds a level of complexity. Operational implementations cannot be forced by the Port Authority at terminal level. This could create a port with a highly integrated infrastructure network, but with a lack of superstructure integration. The role of the Port Authority in a smart port strategy includes development and facilitation for its users [3]. The final level of integration will be the result of management, and stakeholder identification shown by the port authority [7].

Federated learning in the Spanish Port System
Companies are turning to the data-driven company model to ensure that the decisions they make are the right ones, based on what they have learned so far. But this does not mean that they review their results every quarter. To achieve this status, company managers are focusing their strategy on all the tangible data they obtain through the different measurement tools. Knowing how to collect them, separating those that are of interest from those that are not and interpreting them in the right way has become vital to ensure the survival of companies. Therefore, it is important for all types of companies to start working with this data and leave aside hunches and predictions that are not based on experience. Doing things the way they were done years ago no longer makes sense in today's world, and data has to be the backbone from which everything flows. Ports must therefore adapt their processes and mindset to this growing wave of data sharing and data collection.
By capturing, managing and interpreting data we can develop a much more optimal line of business. Big Data means that if we correctly interpret and process the acquired information we can provide the service with a greater capacity and speed for the resolution of activities. Beyond all this, Federated learning can be used.
Federated learning (FL) is a form of machine learning technique in which the devices that collect the data participate in the formation of the central machine learning model [53]. This technique is most popular with mobile devices or any other type of system deployed at scale. Federated learning is useful for cases where the participating devices do not want to share the data with the central server or the load of the collected data on the central server is prohibited (high cost, unreliable connection, etc.) [24].
Federated learning is a decentralized machine learning (ML) procedure recently proposed to train machine learning models with multiple data providers. Instead of collecting data on a single server, the data remains locked on your server and the algorithms and predictive models travel between them [52]. The aim of this approach is to benefit from a large data set, which contributes to higher performance of the LM, while respecting the ownership and privacy of data [18].
There are two main application scenarios for this technology.
-On-device or "mobile FL": covers mobile devices and other connected devices.
Mobile giants such as Google and Apple have used it respectively for the keyboard (prediction models for the next word) and the detection of the wake word "Hey Siri". Mozilla has also tested the FL for its search bar in web browsers [36]. This environment is characterized by a large number of devices to group (tens or hundreds of millions), as well as by the intermittent and low bandwidth of the connection. This is where federated learning comes into play. The machine learning models are trained on their smart phones and then the things (weights in the neural networks or other types of machine learning models) are sent to the central server. Now the central server averages the things (averages the weights or other ways the FL Algorithm could do) it receives from various smartphones and then uses them to train its central machine learning model [6]. After being trained for a while (a couple of times or iterations), that central learning model of the machine is distributed back to the smartphones to be used for prediction purposes or to continue the training [25].
-Inter-institution or "Cross-silo FL": in this environment, different institutions contribute to the training with their local data set. One example is the MELLODDY project, in which ten pharmaceutical companies are collaborating on the training of a learning machine for drug discovery based on highly sensitive, high-content private data sets. This environment is characterized by fewer participants than the mobile case, with typically better bandwidth and less intermittency [56]. While one of the first algorithms for federated learning was proposed by [20], FL's most popular algorithm is Federated Averaging (FedAvg). In FedAvg, a central server is in charge of coordinating the training in FL of the models located in different devices.
The training proceeds by an iteration of FL rounds. In each round, the central value of the model parameters is sent to all devices participating in this round. The devices then update those parameters based on their local data sets after several epochs, resulting in being locally tuned. They are then returned to the central server, which adds them. This concludes the round [55].
Standard machine learning approaches require training data to be centralized on a machine or in a data center. Now, for models trained from user interaction with mobile devices, there is an additional approach: federated learning that can be applied to the port environment [49].
Federated learning allows in the "mobile FL" model for mobile phones to collaboratively learn a shared predictive model while keeping all the training data on the device, decoupling the ability to do automatic learning from the need to store the data in the cloud [5]. This goes beyond the use of local models that make predictions on mobile devices by providing model training to the device as well.
Here's how it works: a device downloads the current model, enhances it by learning from the data on your phone, and then summarizes the changes as a small, focused update. Only this model update is sent to the cloud, via encrypted communication, where it is immediately averaged with other user updates to improve the shared model. All training data remains on your device and no individual updates are stored in the cloud [10].
Federated Learning (FL) is a proposed collaborative approach to empowering selflearning models on decentralized data, particularly for privacy reasons. In FL, only ML models transit between sites, not the data samples themselves [44].
Federated learning in an ML model typically works as follows. Suppose there are n centers that contain data, either mobile devices or remote data centers, and a central server that coordinates the training. In each federated training round, the central server will send the current value of the ML model to (a subset of) the centers [25]. Each selected center will adjust the current value of the model in the local data, and then return it to the central server. The server finally aggregates the local models into a single global model, that is the new current value of the ML model. These steps are repeated until satisfactory performance is achieved [51].
The key to becoming a port specialist, in any discipline, is experience.
Knowing how to interpret situations, what to do next in critical situations, and what solutions to take, all comes down to the training that person has had and the opportunities they have had to apply it.
For Artificial Intelligence (AI) algorithms, experience comes in the form of large and varied sets of high quality data. However, such datasets have traditionally proved difficult to obtain, especially in the port sector.
A clear message is that sharing data strengthens processes, reduces waste and makes port operations more efficient. While it is clear that digitization can lead to greater efficiency, it also helps to reduce costs and provide numerous environmental benefits. Ports and the maritime industry in general have been slower to adopt digitization than other industries. This has been due to the fear of creating a competitive disadvantage.
Federated learning makes it possible for AI algorithms to gain experience from a wide range of data located in different locations.
This approach allows several organizations in the port sector to collaborate in the development of models, but without the need to directly share sensitive port data with each other.
Over the course of several training iterations, shared models are exposed to a significantly wider range of data than a single port organization within the sector (see fig. 3).

Fig. 3. Inter-institution or "Cross-silo FL" associated with port sector
To be considered an expert in a field usually takes about 20 years of work. To train models to the same degree as experts, AI algorithms need to be fed with a large number of cases. And these examples need to sufficiently represent the port environment in which they will be used.
And it's not just the amount of data that counts. It also needs to be very diverse and incorporate elements of the entire logistics chain associated with a port.
Port concessionaires, port authorities, customs agents, freight forwarders, ... individually may have files containing hundreds of thousands of records and images, but these data sources are typically kept in silos. This is largely because port sector data is private and cannot be used without the necessary consent and approval.
The LF decentralizes deep learning by eliminating the need to group data in one place. Instead, the model is trained in multiple iterations at different sites.
For example, let's say four port authorities decide to join together and build a model to help automatically analyze images of container storage yards.
If they decided to work with a federated client-server approach, a centralized server would maintain the global deep neural network and each participating port authority would receive a copy to train on its own data set.
Once the model had been trained locally for a couple of iterations, participants would send their updated version of the model to the centralized server and maintain their dataset within their own secure infrastructure.
The central server would then aggregate the contributions of all participants. The updated parameters would then be shared with the participating Port Authorities, so that they could continue their study.
If one of the Port Authorities decided to leave the training team, this would not stop the training of the model, as it does not depend on any specific data. Similarly, a new Port Authority could choose to join the process at any time.
This way, each participant gains global knowledge from local data, everyone wins and we remove the burden of belief from the competitive disadvantage of sharing port data.
In no port in the world, neither port community nor port-related research environment has LF been implemented, indeed its use has not even been planted to date. The most important applications of LF are in the medical sector.
For LF we can summarize its advantages and disadvantages as follows in fig. 4. The federated learning model offers users several other benefits on top of privacy. Instead of continually sharing data with the server, the learning process can be conducted when a device is charging, connected to wifi and not in use, minimizing the inconveniences faced by users [37].
This means that users are not wasting their precious data or battery when they are out and about. Because federated learning only transfers a summary of relevant data, rather than the data itself, the process ends up transferring less data overall than under traditional learning models.
Federated learning can also deliver both global and personalized algorithmic models. It can glean insights from a broader group of users and combine them with information from the individual user to deliver a more effective model that suits their unique needs [8].  [22,24] When modelling federated data, it may also be important to consider issues beyond accuracy, such as fairness. In particular, naively solving an aggregate loss function may implicitly advantage or disadvantage some of the devices, as the learned model may become biased towards devices with larger amounts of data, or (if weighting devices equally), to commonly occurring groups of devices [16].
In addition to the potential security issues, federated learning has a number of other limitations that prevent it from being a magic pill to solve all our data privacy issues.
One consideration is that when compared to traditional machine learning methods, federated learning requires significantly more local device power and memory to train the model. However, many new devices have ample power for these functions, and this approach also results in a much smaller amount of data being transferred to central servers, reducing data usage. Many users may find this trade-off beneficial, as long as their device is powerful enough [57].
Another technical issue involves bandwidth. Federated learning is conducted over wifi or 4G, while traditional machine learning occurs in data centres. The bandwidth rates of wifi or 4G are magnitudes lower than those used between the working nodes and servers in these centres [26].
Bandwidth to devices hasn't grown as rapidly as their computation power over the years, so insufficient bandwidth could potentially cause a bottleneck that increases latency and makes the learning process slower when compared to the traditional approach.
If algorithm training is conducted while a device is in use, it reduces a device's performance. Google has gotten around this problem by only training devices when they are idling, switched on and plugged into an outlet. While this solves the problem, it slows down the learning cycle, because training can only be done at off-peak times.
• Researchers can train models using private and sensitive data without having to worry about handling the data -the data remains on the device and only learned model updates are transferred between the lab and the data owners • Compliant with data protection regulations like GDPR Advantages • The cost for implementing federated learning is higher than collecting the information and processing it centrally, especially during the early phases of R&D when the training method and process are still being iterated on • Requires data owners to perform computations on the device that holds data -for some devices with limited computation capacity this may not be possible or economic • Implementing FL is not enough to guarantee privacy, as model updates may include traces that can be used to infer private and sensitive information, thus requiring mixing with other techniques Disadvantages A further challenge is that devices drop out during the training process -they may be put to use by their owners, turned off, or undergo some other disruption. The data of devices that drop out may not be able to be used properly, which could lead to a less accurate algorithmic model [34].

Conclusions
The FL still requires careful implementation to ensure that port user data is kept secure. But it has the potential to address some of the challenges faced by approaches that require the sharing of sensitive data.
In the case of the FL, data from concessionaires, port authorities or any other actor in the port environment does not need to be taken outside of an institution's security measures. Each participant maintains control of its own port data.
Thus, the FL opens the possibility for teams to build larger and more diverse data set to train their AI algorithms.
The implementation of a LF approach also encourages different ports, port actors and the entire logistic chain, as well as port research centers or universities to collaborate in the construction of a model that could benefit everyone.
Federated learning could revolutionize the way AI models are trained, and the benefits would also filter down to the port ecosystem and the entire logistics chain.
Transport networks could work together and benefit from access to secure inter-agency data. While smaller port stakeholders would enjoy access to expert-level AI algorithms, allowing large volumes of diverse data from different organizations to be included in the model development, while complying with local governance of port data.
Ports would have access to more robust AI algorithms, based on data representing the entire chain. They could also contribute to the ongoing training of these algorithms when they disagree with the results.
In the meantime, port research institutions could direct their work towards real port needs, based on a wide variety of real world data, rather than the limited supply of open data sets.
Technical challenges abound in LF. Among them, three are particularly important. The first is statistical heterogeneity. Due to the very nature of LF, data are produced in different environments, possibly using different procedures. As a result, there are real changes in the distribution of data among different devices. This breaks the assumption of identical distribution that is one of the cornerstones of the modern LF.
The second is the efficiency of communication. Due to the distributed nature of federated learning, communication costs are often higher than local computing costs. Therefore, there is a need for efficient communication algorithms.
Another important challenge is privacy. In fact, LF is primarily motivated to prevent data leakage. However, even the quantities related to the LF model exchanged during the LF training can leak identifying information about the underlying data samples. Techniques such as differential privacy and secure multi-party computing are being used to mitigate these risks.
The application of federated learning requires that machine learning practitioners adopt new tools and a new way of thinking: model development, training and evaluation without direct access to or labelling of the raw data, with the cost of communication as a limiting factor. The benefits to the LF user make it worthwhile to address the technical challenges.