FL Explainer

Horizontal & Vertical
Federated Learning

PLAY PAUSE
0:00
/
PLAY PAUSE

Isolated Data, Unified Goal: Federated Learning as the Future of AI

Federated learning lets multiple parties jointly train a single model without sharing raw data. Two variants address different data partitions:
Horizontal Federated Learning (HFL) — same features, different entities (e.g., several banks on their separate customer pools) — and
Vertical Federated Learning (VFL) — different features, same entities (e.g., a bank and a retailer on shared customers). On this page both approaches are benchmarked against centralized and local-only training on a real 36,457-row credit-card dataset using XGBoost.

Federated Learning is a rapidly advancing branch of machine learning, encompassing various approaches for distributed collaboration.

Depending on how data is shared among participants and how the global model is constructed, Federated Learning can be classified into two key types:

Horizontal
Federated Learning (HFL)

Participants share the same feature space but have different data samples.

For instance, this approach can be used to train models based on customer data from multiple banks operating in different regions.

Party A
Party B
sample space
feature space
label

It can take the following forms:

Cross-silo Federated Learning

In this type, data owners collaborate to build a more accurate global model than their local data could achieve individually.

It assumes participants have the necessary computational resources and perform independent global model inference after training.

Cross-device Federated Learning

In this scenario, the global model is fine-tuned directly on devices that generate the data. The primary stakeholder is the provider of the original model, which is updated as it interacts with new data.

The secondary stakeholder is the device owner, who benefits from a more accurate outcome as the model adapts to their specific data.

Vertical
Federated Learning (VFL)

This approach applies when participants have different features for the same set of entities.

For example, a bank and an online retailer may have information on the same users, but the bank holds financial transaction data, while the retailer has information on shopping preferences.

Party B
Party A
sample space
feature space
label

Key Comparative
Features of HFL and VFL

FeaturesHFLVFL
Data PartitioningEntity spaceFeature space
Model TrainingEach client can train a local modelTraining is not possible without combining local dataset parts
Training ScenarioCross-device, cross-siloCross-silo
Data TransmittedModel parametersIntermediate results
Local InformationDataClient models, data
Outcome for ParticipantsGlobal modelClient models
Independent InferenceYesNo

Practical examples of usage are often more effective for understanding than theoretical explanations.

Let’s explore the key features of the mentioned types using a binary classification task as an example.

The experimental dataset, prepared from publicly available data on Kaggle, contains 36,457 unique records of credit card holders.

Each customer is described by 15 features and a class label: 0 indicates no overdue debt, while 1 indicates an overdue payment.

The targets are fairly balanced:

01 52%
00 48%

The feature description of credit card holders consists of the following fields:

CODE_GENDERGender
FLAG_OWN_CARIs there a car
FLAG_OWN_REALTYIs there a property
CNT_CHILDRENNumber of children
AMT_INCOME_TOTALAnnual income
NAME_INCOME_TYPEIncome category
NAME_EDUCATION_TYPEEducation level
NAME_FAMILY_STATUSMarital status
NAME_HOUSING_TYPEWay of living
CUSTOMER_AGEBirthday
EMPLOYED_LENGTHDuration of employment
FLAG_WORK_PHONEIs there a work phone
FLAG_PHONEIs there a phone
FLAG_EMAILIs there an email
OCCUPATION_TYPEOccupation
STATUSCredit status

Let’s assume that, based on accumulated data, the financial organization aims to predict the creditworthiness of new clients.

To compare results, we will use the XGBClassifier from the XGBoost library in each case.

The training will be conducted on a sample of 30,000 records, while the remaining 6,457 records will form a common test set for all scenarios.

Case 1:
Baseline―Centralized Learning

Let’s consider a scenario where several branches of a bank have accumulated the entire dataset. The first step is to consolidate the data into a single location.

Then, we can train the XGBoost classifier to categorize the data. The model trained using this method achieves an accuracy of 0.657 on the test set.

This conservative approach to training has clear advantages: transparency and relatively high accuracy. However, it also requires data to be centralized, which often presents challenges.

plus
XGBoost
result
Train accuracy Test accuracy
0.823 0.657

Case 2:
Training on Local Datasets Only

The data is divided among several owners, meaning that two banks have collected similar information and each decides to train locally on their respective datasets, each containing 15,000 records of bank customers.

By simulating this situation and training the classifier on a randomly selected half of the records, we obtain a trained model with accuracy metrics of 0.595 on the test set.

There is a noticeable decline in quality on the test set compared to better performance on the training set, indicating overfitting due to the reduced representativeness of the training data.

plus
XGBoost
result
Train accuracy Test accuracy
0.892 0.595

Case 3:
Horizontal Federated Learning

In this scenario, data is divided among several owners, specifically Bank A and Bank B, each possessing 15,000 records of customers.

Both banks are interested in developing a more accurate model for better customer classification, so they decide to collaborate on distributed training using Horizontal Federated Learning (HFL).

In this case, the metrics of the trained model are closer to those achieved with centralized learning.  Additionally, each client ultimately receives a global model that they can use independently.

However, this framework poses privacy risks to the training data, especially in cases of malicious intent or curiosity from the opposing party or server. Numerous studies demonstrate the possibility of reconstructing training data by analyzing update parameters.

Furthermore, one participant could intentionally degrade the learning outcomes.

Global Model Bank A Bank B
Train accuracy Test accuracy
0.737 0.635

Case4:
Vertical Federated Learning

In this scenario, the data is divided among several owners. Client A, a bank, has collected information about financial and property characteristics, while Client B possesses social characteristics.

Specifically, dataset A contains 30,000 records with the fields [FLAG_OWN_CAR, FLAG_OWN_REALTY, AMT_INCOME_TOTAL, NAME_INCOME_TYPE, EMPLOYED_LENGTH, FLAG_WORK_PHONE, OCCUPATION_TYPE, STATUS], whereas Client B holds information on the fields [CODE_GENDER, CNT_CHILDREN, NAME_EDUCATION_TYPE, NAME_FAMILY_STATUS, CUSTOMER_AGE, NAME_HOUSING_TYPE, FLAG_PHONE, FLAG_EMAIL] for the same set of individuals.

Client B does not have access to the target variables, which are only available to Client A. Therefore, Client B cannot independently use their data to train models. This situation can be resolved using Vertical Federated Learning (VFL) technology.

Bank A Bank B
Train accuracy Test accuracy
0.802 0.652
What is the difference between horizontal and vertical federated learning?
Horizontal Federated Learning (HFL) is used when parties hold the same features about different entities — for example, two banks holding the same column structure (income, credit rating, etc.) but for separate customer pools. Vertical Federated Learning (VFL) is used when parties hold different features about the same entities — for example, a bank with financial features and a retailer with shopping features for an overlapping customer base. HFL aggregates model parameters; VFL exchanges intermediate computations and requires entity-alignment between parties.
What is horizontal federated learning (HFL)?
Horizontal Federated Learning is a setup where each participant trains a local model on its own data subset and sends model updates (parameters or gradients) to a central aggregator. The aggregator combines updates from all participants into a single global model, which each party can then use independently. HFL fits scenarios with many parties holding the same feature schema — banks, smartphones, hospitals — and supports both cross-silo (a few organizations) and cross-device (many small devices) deployments.
What is vertical federated learning (VFL)?
Vertical Federated Learning is a setup where each participant holds a different subset of features about an overlapping set of entities. Training requires secure entity alignment (finding shared records without revealing identities) and joint computation of model updates. Unlike HFL, VFL participants cannot perform inference independently — the trained model lives across all parties, and prediction time requires collaboration. VFL is the right fit when complementary data sources (e.g., bank + retailer, hospital + wearable) describe the same individuals.
What are cross-silo and cross-device federated learning?
Cross-silo federated learning involves a small number of well-resourced participants (typically organizations such as hospitals or banks) collaborating to build a shared model. Each silo has reliable compute, stable connectivity, and contributes substantial data. Cross-device federated learning involves a large number of resource-constrained devices (smartphones, IoT sensors) where individual contributions are small but aggregate to large scale. HFL supports both modes; VFL is almost exclusively cross-silo because joint inference requires reliable connections between participants.
How accurate is federated learning compared to centralized training?
On a 36,457-record credit-card benchmark with XGBoost, the four approaches scored: centralized baseline 0.657 test accuracy, local-only training 0.595 (overfitting on 15,000 records), Horizontal FL 0.635, and Vertical FL 0.652. Both federated approaches reached within 4% of the centralized baseline without raw-data transfer. VFL outperformed HFL in this setup because the complementary feature sets gave the joint model more information than the duplicated samples in the HFL split.
Does federated learning protect data privacy on its own?
No — federated learning alone is not sufficient for strong privacy guarantees. Research has shown that model updates (gradients or parameters) can leak training data through inversion attacks, and a malicious participant can degrade the global model with poisoned updates. Production federated learning requires a cryptographic layer: secure aggregation, homomorphic encryption, differential privacy, or trusted execution environments. The "no raw data leaves the device" property reduces, but does not eliminate, the attack surface
When should I use HFL versus VFL?
Use HFL when multiple parties hold the same kind of data about different customers (e.g., several banks each with their own credit card holders) and want a stronger shared model. Use VFL when multiple parties hold complementary data about the same customers (e.g., a bank with payment history plus a telecom with usage patterns about overlapping subscribers). If only one party holds labels (the target variable), VFL is the only federated option — HFL requires labels on every participant.
How does Guardora support horizontal and vertical federated learning?
Guardora provides production infrastructure for both variants. Guardora VFL is a commercial platform for two-party VFL scenarios — for example, a bank and an analytics vendor jointly training credit scoring models. It supports GBDT and other tabular ML models, includes Paillier homomorphic encryption for gradient protection, encrypted gRPC communication between parties, and works without GPU on the client side. For HFL use cases, the platform extends to cross-silo deployments where the same architecture pattern can be reused across multiple participants.

Addressing Privacy Risks
in Federated Learning

The first challenge faced by participants is the need to establish correspondences between records from both parties without revealing the datasets themselves, which is known as the secure set intersection problem.

Similar to HFL, if we consider the potential for dishonesty from the associated party, we cannot assume that the training data is secure.

A key distinction of VFL is that the inference of the trained model must also be performed collaboratively, which creates further interdependence between the parties and increases the risk of leakage of newly incoming information.

Thus, by addressing the challenge of central learning, federated learning enables models to be trained to achieve comparable quality metrics.

However, there exists an extensive list of threats that necessitates a comprehensive approach to ensuring data privacy during federated learning.

This includes employing various cryptographic methods such as encryption, integrity checks, and authentication of updates, as well as implementing mechanisms to detect and block suspicious activities during the training process.

The implementation of effective solutions requires expertise in customizing training scenarios to achieve both practical value from the method and the security of the data.

Share your feedback
on Discord community

Are you interested in FL (Federated Learning) in a secure implementation?
What challenges have you faced in implementing Federated Learning solutions?
How can we improve our discussions on Federated Learning?

We welcome your suggestions and feedback in our Discord community.

Community