Federated Quantum-Train with Batched Parameter Generation
Chen-Yu Liu Samuel Yen-Chi Chen






Federated Quantum-Train with Batched 
 Parameter Generation The views expressed in this article are those of the authors and do not represent the views of Wells Fargo. This article is for informational purposes only. Nothing contained in this article should be construed as investment advice. Wells Fargo makes no express or implied warranties and expressly disclaims all legal, tax, and accounting implications related to this article.
    

    Chen-Yu Liu 26, 
    Samuel Yen-Chi Chen37


2Graduate Institute of Applied Physics, National Taiwan University, Taipei, Taiwan
3Wells Fargo, New York, NY, USA

Email:
6
d10245003@g.ntu.edu.tw, 
7
yen-chi.chen@wellsfargo.com

    September 4, 2024
====================================================================================================================================================================================================================================================================================================================================================================================================================================================



§ ABSTRACT 
In this work, we introduce the Federated Quantum-Train (QT) framework, which integrates the QT model into federated learning to leverage quantum computing for distributed learning systems. Quantum client nodes employ Quantum Neural Networks (QNNs) and a mapping model to generate local target model parameters, which are updated and aggregated at a central node. Testing with a VGG-like convolutional neural network on the CIFAR-10 dataset, our approach significantly reduces qubit usage from 19 to as low as 8 qubits while reducing generalization error. The QT method mitigates overfitting observed in classical models, aligning training and testing accuracy and improving performance in highly compressed models. Notably, the Federated QT framework does not require a quantum computer during inference, enhancing practicality given current quantum hardware limitations. This work highlights the potential of integrating quantum techniques into federated learning, paving the way for advancements in quantum machine learning and distributed learning systems.



Quantum Machine Learning, Federated Learning, Quantum-Train




§ INTRODUCTION

Quantum computing (QC) promises potential computational advantages for certain tasks over classical computers, particularly in areas like machine learning (ML) and combinatorial optimization problems <cit.>. Meanwhile, the advances in classical ML and artificial intelligence (AI) have demonstrated amazing capabilities in various tasks <cit.>. With the progress in quantum hardware, it is natural to consider the combination of these two fascinating technologies.

While existing quantum computing devices still suffer from noises and imperfections, a hybrid quantum-classical computing paradigm <cit.> which divides computational tasks among quantum and classical computing resources according to their properties to leverage the best part from the both world is proposed. 

Variational quantum algorithms (VQAs) <cit.> are the fundamental algorithms framework under this hybrid paradigm. Leading quantum machine learning (QML) methods largely rely on these variational algorithms.

Variational quantum circuits (VQCs) are the building blocks of existing QML models <cit.>. It has been shown theoretically that VQC can outperform classical models when certain conditions are met <cit.>. VQC-based QML models have been shown to be successful in various ML tasks ranging from classification <cit.>, time-series modeling <cit.>, audio and language processing <cit.>, quantum algorithm reconstruction <cit.>,  and reinforcement learning <cit.>.

The great success of modern AI/ML techniques not only depend on good model architecture design but also on the volume of high-quality data and QML is no exception. The requirements of data also raise the privacy concerns in the QML research and application. Among various methods to mitigate the privacy concerns, federated learning (FL) is a method in which various participating parties share the locally trained models but not the actual training data to avoid data leakage.

Several FL methods have been proposed in the realm of QML to enhance the privacy-preserving features <cit.>. 


While effective, these quantum FL (QFL) methods require the trained models to be used on quantum devices in the inference stage. It poses certain challenges at the moment as there are limited real quantum resources available and it is unclear whether the proposed methods are realistic in the real-world scenarios.

In this paper, we propose a Quantum-Train (QT)-based <cit.> QFL method in which the quantum neural networks (QNN) are trained to generate the well-performing classical neural network weights in the federated setting. Once the training is finished, the QNN is not used during the inference phase.

Our main contributions are: 

    
  * Addressing data encoding issue in QFL: The QT approach integrated with FL simplifies data handling by using classical inputs and outputs, avoiding the complexities and potential information loss of encoding large datasets into quantum states. This method retains quantum computational advantages without the scaling difficulties of quantum data encoding.

    
  * Reduction of qubit count in QT: Utilizing the batched parameter generation approach, we reduce the qubit usage from ⌈log_2 m ⌉ to ⌈log_2 ⌈m/n_mlp⌉⌉, compared to the original QT proposal. Here, m is the number of parameters of the target classical model and n_mlp is the batch size in the parameter generation approach. In the example examined in this study, qubit usage is reduced from 19 to as low as 8 qubits.

    
  * Inference without quantum hardware: The training results of QT are designed to operate seamlessly on classical hardware, eliminating the need for quantum computing resources, unlike conventional QML and QFL. This feature enhances its applicability, especially given the current limited access to quantum computers compared to classical counterparts.
    




§ FEDERATED LEARNING


Federated Learning (FL) <cit.> has emerged in response to growing privacy concerns associated with large-scale datasets and cloud-based deep learning <cit.>. In the FL framework, the primary components are a central node and multiple client nodes. The central node maintains the global model and collects trained parameters from the client nodes. It then performs an aggregation process to update the global model, which is subsequently shared with all client nodes. The client nodes locally train the received model using their own data, which typically constitutes a small subset of the overall dataset.

The concept of FL has been explored in the field of QML since the publications <cit.>. In <cit.>, the authors examined the simplest form of QFL utilizing hybrid quantum-classical models. In this approach, a pre-trained CNN compresses input images into a dimension manageable by a VQC. The locally trained hybrid model parameters are then uploaded to a central server, which aggregates these parameters and distributes the updated model to all participants. This framework has been further enhanced to process sequential data using a federated quantum LSTM network <cit.>. The study <cit.> delves into a more advanced scenario where QFL processes quantum states instead of classical images.

While QFL can mitigate the risk of direct leakage of training datasets, it remains vulnerable to attacks that can extract training data entries from the trained models themselves. Such attacks pose a significant threat to data privacy. To address this issue, <cit.> explores the integration of differentially-private gradient optimizers with QFL, aiming to enhance the privacy of QML models.

QFL can be further extended to scenarios where training is conducted on encrypted data, as demonstrated in <cit.>.

QFL can be applied in diverse scenarios, including autonomous vehicles <cit.> and quantum fuzzy learning <cit.>.



§ VARIATIONAL QUANTUM CIRCUITS AND QUANTUM-TRAIN


At the core of the QML scheme, VQCs play a pivotal role by providing the parameterized ansatz that forms the function approximator for learning tasks. A typical VQC used as a QNN is depicted on the left side of Fig. <ref>. The process begins with the initial state |0 ⟩^⊗ N, where N is the number of qubits. This is followed by parameterized single-qubit and two-qubit unitary operations U_3 and controlled-U_3 (CU_3) gates, characterized by their matrix representations:

    U_3(μ, φ, λ) = [ [           cos(μ/2)     -e^i λsin(μ/2);      e^i φsin(μ/2) e^i(φ + λ)cos(μ/2) ]], 
            CU_3 = I ⊗ |0⟩⟨ 0 | + U_3(μ, φ, λ) ⊗ |1⟩⟨ 1 |,

The parameterized quantum state (QNN) can then be described as:

    |ψ(θ) ⟩ = (∏_i CU_3^i, i+1∏_j U_3^j )^L |0⟩^⊗ N,

where i and j are qubit indices, and L is the number of repetitions. The proposed vanilla QT <cit.> is as follows: consider a target neural network model with parameters ω, where ω = (ω_1, ω_2, …, ω_m) and m is the total number of parameters. Instead of updating all m parameters as in conventional ML, QT utilizes |ψ (θ) ⟩, a QNN with N = ⌈log_2 m ⌉ qubits, to generate 2^N distinct measurement probabilities |⟨ϕ_i | ψ (θ) ⟩|^2 for i ∈{1, 2, …, 2^N}, where |ϕ_i ⟩ is the i-th basis state. These probabilities are then input into a mapping model G_β, a multi-layer perceptron (MLP) type classical neural network with parameters β. 
The first m basis measurement result probabilities, along with the vector representations of the corresponding basis states |ϕ_i ⟩, are mapped from values bounded between 0 and 1 to -∞ and ∞ using the following equation:

    G_β (|ϕ_i ⟩, |⟨ϕ_i | ψ (θ) ⟩|^2) = ω_i,    i = 1, 2, …, m.

Here, it can be observed that the parameter ω of the target model is generated from the QNN |ψ(θ) ⟩ and the mapping model G_β. Notably, the required number of parameters for both θ and β scales as O(polylog(m)) <cit.>, allowing for the effective training of the target model with m parameters by only tuning O(polylog(m)) parameters of θ and β. Unlike conventional QML approaches, which require the QNN during the inference stage, the QT approach decouples the quantum computing resource after training. Since the QNN is used solely for generating the parameters of the target model, the resulting trained model is a classical neural network. This classical model can then be executed entirely on classical computing hardware. This characteristic is particularly practical given that quantum computing hardware is currently a relatively rare and expensive resource.







§ QUANTUM-TRAIN WITH BATCHED PARAMETER GENERATION


Building upon the previously proposed QT method, which generates a single parameter of the target network model from a single basis measurement probability, this study introduces a batch parameter generation approach. This method generates a batch of parameters from a single basis measurement probability, as illustrated in Fig. <ref>. In this approach, the m parameters of the target model are divided into n_ch chunks, each containing n_mlp parameters, such that n_ch = ⌈ m / n_mlp⌉. The mapping model, now denoted as G_β, takes as input |ϕ_i ⟩ and |⟨ϕ_i | ψ (θ) ⟩|^2 and generates a batch of parameters in ω of size n_mlp:

    G_β (|ϕ_i ⟩, |⟨ϕ_i | ψ (θ) ⟩|^2) = ω⃗_i,    i = 1, 2, …, n_ch, 
          ω⃗_i = ( ω_i,1, ω_i,2, ... ω_i,j ),    j = 1,2, …, n_mlp.

This setup is realized through a decoder-like architecture of the MLP in the mapping model G_β, where the output size is expanded from 1 to n_mlp, or  in the following syntax. Consequently, the qubit usage N is reduced from N = ⌈log_2 m ⌉ to 

    N = ⌈log_2 n_ch⌉ = ⌈log_2 ⌈m/n_mlp⌉⌉,

effectively saving approximately ⌈log_2 n_mlp⌉ qubits from the original QT proposal, the original method can be considered as a special case with n_mlp = 1. Reducing qubit usage also mitigates the issue of the exponential requirement of measurement shots, as mentioned in the original QT study. The remaining training process is similar to the vanilla QT method, as depicted in Fig. <ref>.




§ FEDERATED QUANTUM-TRAIN

Following the original idea of FL and QFL, we introduce the concept of the QT model within the federated framework. In this approach, each quantum client node employs QNN |ψ (θ) ⟩ and mapping model G_β to generate the local target model parameters. During each training round, every quantum client nodes update their QNN parameters and the associated mapping model parameters based on their local datasets. These updated parameters are sent to the central node, where they are aggregated to update the global model, as depicted in Fig. <ref>. This process ensures that the global model benefits from the QT performed at each client node, leading to improved performance and efficiency. By integrating the QT model into FL, we leverage the advantages of quantum computing to reduce the number of training parameters and enhance the scalability of distributed learning systems. Notably, compared to traditional QFL, federated QT does not require a quantum computer during the inference stage. 



§ RESULT AND DISCUSSION


To examine the applicability of the proposed federated QT framework, we tested it using a VGG-like convolutional neural network (CNN) structure with the CIFAR-10 dataset. The target CNN model has 285226 parameters. We tested three different QT setups: n_mlp∈{2000, 1000, 500}, while fixing the repetition L = 5. The required qubit usage, derived from Eq. <ref>, is 8, 9, and 10 qubits, respectively. Compared to the original QT with the same CNN model <cit.>, which required 19 qubits, our new batched parameter generation significantly reduces the qubit usage. Fig. <ref> illustrates the number of model parameters for the models investigated in this study, with n_mlp denoted as .




In the upper row of Fig. <ref>, the Cross-Entropy loss for the CIFAR-10 image classification task, involving 10 classes over multiple rounds, is presented with different setups of local epochs and , while fixing the number of clients at 4. It can be observed that a larger number of local epochs leads to lower loss values. This outcome is expected, as the model undergoes more frequent updates, providing more opportunities to correct incorrect predictions.





In the lower row of Fig. <ref>, the local epoch is fixed to 1, and the effect of varying the number of clients is investigated. In this investigation, the dataset is divided into as many pieces as the number of clients. Interestingly, increasing the number of clients results in better performance in terms of training loss. This improvement can be attributed to the flexibility provided by different local models, which adjust distinct sets of parameters corresponding to different parts of the dataset. The parameter aggregation step then incorporates these updates from diverse perspectives, enhancing the overall model performance.




A noticeable trend in the figures is that models with more parameters tend to perform better in terms of training loss. This can be attributed to the increased expressiveness of the corresponding models, which enhances their ability to fit the training data. However, this observation only indicates the model’s effectiveness on the training dataset and does not necessarily reflect its general performance on unseen data.

As illustrated in Fig. <ref>, we present the testing and training accuracy of the models investigated in Fig. <ref>. A notable observation is the significant overfitting in the purely classical case. While the training accuracy of the classical model is extremely high, its testing accuracy is slightly lower than that of the n_mlp = 2000 case. This behavior underscores an advantage of the QT method, as highlighted in previous studies <cit.>: the QT method can reduce the deviation between training and testing accuracy, which is proportional to the generalization error. Moreover, our batched parameter generation approach not only significantly reduces qubit usage but also preserves the advantage of generalization error reduction inherent in the vanilla QT method.

While there is no clear trend for different local epochs and the number of clients in the classical, n_mlp = 2000, and n_mlp = 1000 cases, the n_mlp = 500 case shows an increase in both training and testing accuracy with an increase in local epochs and the number of clients. This behavior demonstrates that the federated framework combined with QT can improve models with extreme compression, such as the n_mlp = 500 case, which uses only about 10% of the original CNN model’s parameters.




§ CONCLUSION


In this work, we introduced the Federated QT framework, integrating the QT model into federated learning to leverage quantum computing for distributed learning systems. Each quantum client node employs QNNs and a mapping model G_β to generate local target model parameters. These parameters are updated based on local datasets and aggregated at a central node, enhancing the global model through quantum-enhanced training.

Our experiments, using a VGG-like CNN on the CIFAR-10 dataset, demonstrate the efficacy of the Federated QT framework. We tested three different QT setups with varying n_mlp values, significantly reducing the required qubit usage compared to the original QT method. Specifically, our batched parameter generation approach reduced qubit usage from 19 to as low as 8, while maintaining the benefits of generalization error reduction.

Results indicate that models with more parameters perform better in training loss due to increased expressiveness, but overfitting was observed in purely classical models. The QT method mitigated this issue, resulting in a closer alignment between training and testing accuracy. The federated framework combined with QT also showed improved performance in highly compressed models, such as the n_mlp = 500 case, which uses only about 10% of the original CNN model’s parameters.

The Federated QT framework provides a scalable and efficient approach to distributed learning, utilizing quantum computing to reduce training parameters and enhance model performance. Notably, QT does not require a quantum computer during the inference stage, making it highly practical given the current limitations of quantum hardware. Our findings highlight the practical benefits of integrating quantum techniques into federated learning, paving the way for future advancements in QML and distributed learning systems.


IEEEtran



