> For the complete documentation index, see [llms.txt](https://docs.rhinofcp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rhinofcp.com/creating-and-running-code-objects/creating-and-running-nvflare-code-and-running-inference/running-federated-learning-without-all-sites-nvflare.md). Agents can also search and read this documentation through its [MCP server](https://docs.rhinofcp.com/~gitbook/mcp).

# Running Federated Learning Without All Sites (NVFlare)

How to configure the minimum number of clients required before FL training begins.

{% hint style="info" %}
**NOTE**: This feature applies to NVFlare training runs only.
{% endhint %}

By default, all requested sites must be ready before a training run can start. You can change this setting by **specifying the minimum number of clients that are required to connect before an NVFlare training begins**. This enables training on available sites even if not all sites are connected, which is particularly helpful for consistently starting large training runs.

To configure this, specify the `min_clients` setting in your `config_fed_server` file. This allows an NVFlare training run to start even if some sites are not ready. For example, if a site is offline or slow to respond, the run can proceed with the available sites rather than failing.

{% hint style="info" %}
**NOTE**: This feature is different from NVFlare’s per round `min_clients`.  NVFlare reads it every round, as the number of results to collect before aggregating.  (Some workflows use a different name for this, such as FedAvg’s `num_clients`. Rhino still reads only `min_clients`.) In contrast, Rhino FCP reads `min_clients` once, before training starts, to decide which sites will be part of the run.&#x20;
{% endhint %}

* If you set the `min_clients` variable, training begins as soon as the **specified minimum** number of sites have connected. Sites failing to connect in time will be **excluded** from the run.
* If you do not set the `min_clients` variable, **every** site must connect. If any site is missing, the run fails.

***

## Configuring Minimum Sites

To configure `min_clients` and set the minimum number of sites required for a training run, complete the following steps.

1. Add the `min_clients` setting to the workflow arguments in your `config_fed_server` file. You can locate or supply this configuration in one of the following places:

* Within the `config_fed_server` section of your code object.
* When starting a run, enter the `min_clients` setting into the "Federated server config override (optional)" field in the configuration section of the Run training dialog.

{% hint style="info" %}
NOTE: In the SDK, you can specify the `min_clients` setting within `config_fed_server` on `ModelTrainInput`.
{% endhint %}

2. Set the minimum number of sites required to be present before the run begins.&#x20;

* This value cannot exceed the total number of training sites configured for the run.
* Providing an override replaces the entire file rather than merging with the code object's configuration, so you must include the full configuration block, not just the `min_clients` setting.\
  \
  An example configuration is shown below:

```
{
  "workflows": [
    {
      "id": "scatter_and_gather",
      "path": "nvflare.app_common.workflows.scatter_and_gather.ScatterAndGather",
      "args": {
        "min_clients": 2,
        "num_rounds": 5
      }
    }
  ]
}
```

Once you start a run, the following sequence occurs:

3. Offline sites are skipped initially. If a training site's Rhino Client is offline, the run starts without that site.
4. The run waits for sites to connect. This can take anywhere from 5-15 minutes when sites run on VMs.
5. Once `min_clients` sites have connected, the run waits approximately one additional minute for any remaining sites. (If `min_clients` is 0, the FL Server waits 1 minute before it starts with connected clients.)
6. Training starts with all connected sites. Any sites that failed to connect in time are excluded.

***

## Validation Sites

A **Validation Site** is a site that contributes only validation datasets to the run, not training datasets.  Once training finishes, the trained model is run on its data to measure how well the model performs. &#x20;

Therefore, a site dedicated solely to validation data does not affect training, even if it goes offline. Validation executes on reachable sites and skips unreachable ones. Validation fails only if no validation sites can be reached.

***

## Troubleshooting Tips

This section provides details on troubleshooting issues related to running federated learning across multiple sites.

### Common Scenarios&#x20;

The following table lists scenarios and issues:

| Scenario                                                                                              | Issues                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Every training site is offline                                                                        | The run is rejected immediately and a message appears: “Rhino Client offline”.                                                                                                                                                                                                                                                                                                                                                           |
| A site has no Rhino Client set up                                                                     | The run is rejected because setting up a client is required.                                                                                                                                                                                                                                                                                                                                                                             |
| Fewer sites than the number of `min_clients` are available                                            | <p>The run fails.</p><p></p><p>If too few sites start, the run fails immediately after launching (up to 60 minutes). If enough sites start but too few connect, the run times out after 5 minutes (or 50 minutes for VM sites). Sites that are offline or fail to launch are logged individually with specific reasons, while connection timeouts show a general message requiring server log comparisons to identify missing sites.</p> |
| <p>No <code>min\_clients</code> value is configured, and one or more sites are missing</p><p><br></p> | The run fails because every site is required.                                                                                                                                                                                                                                                                                                                                                                                            |

### Using Logs to Troubleshoot

To use the logs to troubleshoot issues, complete the following steps:

1. The **Training Progress** section in the code run page displays each stage as it occurs. Stages include waiting for FL clients to connect to the NVFlare server, having enough FL clients to start training, and/or having all FL clients connected to the NVFlare server. A note can also appear indicating sites that were excluded because they failed to connect or start in time.
2. If a run starts without some of the sites, the **logs** can display a few things including the following:

* If you have permission to view project collaborators, the log includes client counts (e.g., "This training run ran with 1 of 2 FL clients…").
* If you do not have permission, the log displays "This training run did not include all of the FL clients it was started with." Specific participating sites are hidden.&#x20;
* Note that validation outputs a similar warning: "This inference run ran with N of M sites…"

3. Each site that was left out gets its own log entry with the **reason**:

* The site’s Rhino Client was offline when the run was requested.
* The site’s Rhino Client couldn’t be reached when the run was sent out.
* The site didn’t connect to the NVFlare server in time.
* The site didn’t start running the training job in time.

{% hint style="info" %}
**NOTE**: You’ll always see your own site’s reason, regardless of your permission settings.
{% endhint %}

***

## Additional Tips

* A site that recently went offline may not report as offline for up to 15 minutes. Until detected, the system attempts to send work to it, but excludes it if it fails to respond in time. The outcome remains the same, though the run takes longer to initiate.
* To require participation from all sites, leave the `min_clients` parameter unset.
* A run with no offline sites behaves exactly as before.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rhinofcp.com/creating-and-running-code-objects/creating-and-running-nvflare-code-and-running-inference/running-federated-learning-without-all-sites-nvflare.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
