[200] SERVERAPP_STRATEGY_PRECONDITION_UNMET¶
Description¶
The strategy received replies that cannot be aggregated because either not all replies contain a supported number of records, because the keys used within each record do not match those in other replies, or because the key required by the strategy to perform weighted averaging is missing.
How to Resolve¶
Please ensure all replies returned by ClientApps have one ArrayRecord
(none when
replies are from a round of federated evaluation, i.e. when message type is
MessageType.EVALUATE) and one MetricRecord
.
The records in all replies must use identical keys. In addition, if the strategy expects
a key to perform weighted average (e.g. in FedAvg
) please ensure the returned
MetricRecord
from ClientApps do include this key.
Let's see a few examples of payloads (RecordDict
) that can and can't be
aggregated. Let's assume the ServerApp has been configured to use FedAvg
with
num-examples as the key to perform weighted averaging:
These two payloads can be aggregated because all keys match, there is one record of each type, and the key for weighted averaging is present.
payload1 = RecordDict(
{
"model-parameters": ArrayRecord(...), # no ArrayRecord if in an evaluate round
"metrics": MetricRecord({"loss": 0.123, "num-examples": 1234}),
}
)
payload2 = RecordDict(
{
"model-parameters": ArrayRecord(...), # no ArrayRecord if in an evaluate round
"metrics": MetricRecord({"loss": 0.01, "num-examples": 1234}),
}
)
These payloads can't be aggregated because they have unmatching keys (see one has loss, the other has loss and accuracy)
payload1 = RecordDict(
{
"model-parameters": ArrayRecord(...),
"metrics": MetricRecord({"loss": 0.123, "num-examples": 1234}),
}
)
payload2 = RecordDict(
{
"model-parameters": ArrayRecord(...),
"metrics": MetricRecord({"loss": 0.01, "accuracy": 0.99, "num-examples": 1234}),
}
)
These two payloads can't be aggregated (one has a missing ArrayRecord)
payload1 = RecordDict(
{
"model-parameters": ArrayRecord(...),
"metrics": MetricRecord({"loss": 0.123, "num-examples": 1234}),
}
)
payload2 = RecordDict({"metrics": MetricRecord({"loss": 0.01, "num-examples": 1234})})
These payloads can't be aggregated because there is no key for weighted averaging
payload1 = RecordDict(
{
"model-parameters": ArrayRecord(...),
"metrics": MetricRecord({"loss": 0.123, "accuracy": 0.83}),
}
)
payload2 = RecordDict(
{
"model-parameters": ArrayRecord(...),
"metrics": MetricRecord({"loss": 0.01, "accuracy": 0.99}),
}
)