Giter Club home page Giter Club logo

Comments (4)

bellet avatar bellet commented on May 27, 2024 1

Thanks @jeandut for the proposal.

Some comments:

  1. It is quite common in FL papers to compare algorithms under different budgets of communication rounds, with some approaches aiming to reach reasonably good models under a small number of rounds (there is even work on "one-shot FL"). So perhaps we could set a small number of regimes between 1 and the maximum number of rounds you propose.
  2. There is quite some work on compressing model updates (through quantization, low-rank approximations, etc). In the above proposal, these methods would not provide any gain as they would be compared to methods that can communicate much more per round. Here again, perhaps a few regimes could be considered (e.g., 10 times the gradient size, 1 time the gradient size, 10% the gradient size).

Of course these suggestions would make things a bit more complex, so as always there is a trade-off between generality and complexity of the benchmark.

from flamby.

jeandut avatar jeandut commented on May 27, 2024

An example of a function monitoring the number of bits exchanged would be:

import numpy as np
import torch
LIMIT = 1000
def check_exchange_compliance(tensors_list, units="bytes"):
    """
    Check that for each round the quantities exchanged are below the dataset specific limit.
    Parameters
    ----------
    tensors_list: List[Union[torch.Tensor, np.ndarray]]
        The list of quantities sent by the client.
    units: str
        The units in which to return the result. Default to bytes.
    """
    assert units in ["bytes", "bits", "megabytes", "gigabytes"]
    assert isinstance(tensors_list, list), "You should provide a list of tensors."
    assert all([(isinstance(t, np.ndarray) or isinstance(t, torch.Tensor)) for t in tensors_list])
    bytes_count = 0
    for t in tensors_list:
        if isinstance(t, np.ndarray):
            bytes_count += t.nbytes
        else:
            bytes_count += t.shape.numel() * torch.finfo(t.dtype).bits // 8
        if bytes_count > LIMIT:
            raise ValueError(f"You cannot send more than {LIMIT} bytes, this "
            f"round. You tried sending more than {bytes_count} bytes already")
    if units == "bytes":
        res = bytes_count
    elif units == "bits":
        res = bytes_count * 8
    elif units == "megabytes":
        res = 1e-6 * bytes_count
    elif units == "gigabytes":
        res = 1e-9 * bytes_count

    return bytes_count


l = [torch.ones((2, 2)), torch.zeros((2,2), dtype=torch.float64), torch.Tensor(1).long()]
print(check_exchange_compliance(l))

from flamby.

jeandut avatar jeandut commented on May 27, 2024

Thank you @bellet for your insights !

I will describe it this afternoon but we propose benchmarking guidelines and not rules to give the liberty to users to do as they please: if they are not satisfied with the constraints, we will provide users with ways to disable these constraints.

For 1. Good point it's doable easily in the current implementation, for 2. you indeed have a point maybe by adding a total number of bits exchanged counter in the class and by disabling constraints per round maybe we can facilitate the arrival of users from the quantization community.

from flamby.

jeandut avatar jeandut commented on May 27, 2024

Closing this issue for now as the decisions were made.

from flamby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.