Federated Learning

Sungchul Kim·2022년 1월 24일
0

Federated-Learning

목록 보기
1/5
post-thumbnail

오늘은 Federated Learning에 간략하게 살펴보겠다.

Mobile Device with DL

최근 Mobile device가 점차 증가함에 따라, Mobile device에 딥러닝을 결합한 application이 현재 개발 중에 있다. Mobile device의 예시는 다음과 같다.

  • Sensor device
    • Camera, GPS
  • Smart phone, Tablets, Google Gboard(keyboard app)

기존 AI algorithm은 data를 single machine/server data에 올려놓는 방식으로 동작한다.

그러나 각 개인이 소유하고 있는 mobile device의 data를 data center(single machine/server)에 올려놓는 것은 몇 가지 문제점이 존재한다.

어떠한 문제점이 존재할까?

Al algorithm이 가지는 한계점(mobile data → data center)

Mobile device가 가지는 정보를 사용 하는 데 privacy issue가 존재

Figure 1. Google GBoard

  1. Google GBoard를 사용할때, 유저들의 채팅 기록이 남음(e.g., url message)

    Data전체를 data center(server)에 올려놓는 방식으로 사용 → privacy issue

  2. 환자 임상 데이터 → 환자 개인정보를 유출 할 수 있음 → privacy issue

Data양이 방대하다. → increasing cost

Smart phone에 저장되어 있는 사진첩을 예로 들면, 각 개인(client)이 소유하고 있는 사진 전체를 data center(server)에 올려 놓고 사용하기엔 비용이 많이 든다.

  • 각 개인(client)이 소유하고 있는 사진 수집 → Inf

Federated learning

본 연구에서는 decentralized network를 기반으로 한 Federated learning을 제안함과 동시에, 기존 연구의 문제점을 해결하는데 중점을 두었다. Federated learning이란, data를 data center에 업로드하지 않고, shared(global) model을 학습하는 방법을 의미한다.

아래 그림은 Federated learning의 예시이다.

Figure 2. https://medium.com/tensorflow/introducing-tensorflow-federated-a4147aa20041

이때, 각 client는 local data을 가지고 있으며, 이 data는 data center(server)로 보내지 않고 local 환경에 둔다. → data를 서버로 보내지 않고 local에서 model을 학습시킨 다음, weight 정보만 data center(server)로 전달하기 때문에 privacy issue 해결함.

Federated learning 동작 과정은 다음과 같다.

각 client가 소유한 local data의 weight 값을 계산(A) → 여러 local data의 weight를 aggregation(B) → shared(global) model로 transfer(다른 말로 focused collection[C])

Federated Optimization

Federated Learning은 몇가지의 특성을 지닌다. 특성은 다음과 같다.

Non-IID

  • 각 개인(client)이 사용하는 mobile device를 기반으로 하기 때문에, 특정 개인의 data로 모집단 분포를 표현할 수 없다. (a : 음식사진, b : 여행사진, c : 스포츠사진)

Unbalanced

  • 개인별 소유하고 있는 local data수는 다르다. (a : 100, b : 1000, c : 10000)

Massively distributed

  • Smart phone과 같이 edge device를 학습시킬수 있기 때문에, 많은 client data를 다룰 수 있다.

Federated learning (Non-IID setting)

KK는 client 수를 의미하며, 각 client별 loss는 FkF_{k}로 표현 가능하다.

즉, data는 KK명의 client에게 분산되어 있으며, Pk\mathcal{P}_{k}는 k번째 client가 소유한 data 집합을 의미한다.

각 client가 소유한 data수는 다르기 때문에 nkn\frac{n_{k}}{n} term을 추가하여 f(w)f(w)를 계산한다.

(nkn\frac{n_{k}}{n} = k번째 client가 소유한 data수전체 data수\frac{\text{k번째 client가 소유한 data수}}{\text{전체 data수}})

만약 각 local data가 서로 IID를 띤다고 가정해보면, f(w)=1ni=1nfi(w)f(w) = \frac{1}{n} \sum^{n}_{i=1} f_{i}(w)와 같다. (일반적으로 사용하는 수식)

다음은 본 연구에서 제안한 Federated Averaging algorithm에 대해 간략히 살펴보도록 하겠다.

Method(Federated Averaging algorithm)

Figure 3. FederatedAveraging Pseudo code

Notation

  • KK : Clients
  • B\mathcal{B} : Local minibatch
  • EE : Local epoch
  • η\eta : Learning rate
  • CC : The fraction of clients(0C10 ≤ C ≤ 1)

알고리즘 설명

만약 1000명의 client가 있다고 가정해보자. 이때 C(the fraction of clients)를 0.1로 둔다면, 매 round마다 100명의 client를 추출하여 학습을 진행하게 된다.

Server executes

  1. 사전에 정의한 tt(communication round)번 학습을 진행 (tt = 1,2, ...)
  2. 즉, tt(communication round)는 client의 weight를 server에 몇번 업로드할지 결정하는 변수
  3. 매 round마다 전체 client(k)중 일정 비율(CC)의 client만 추출 (random sampling을 통해 client 추출함)
  4. 추출된 client는 각각 local data를 가지고 있음 → BB를 client수인 KK로 나눔 → B\mathcal{B}(local batch)
  5. 각 client는 동일한 B\mathcal{B}(local batch)를 가지고 E번 학습을 진행하고 업데이트된 최종 model의 weight를 server로 보내게 된다.
  6. Server는 5번을 통해 나온 weight를 받아 평균내주고 global model을 update시켜줌

Distributed learning via Federated learning

Advances and Open Problems in Federated Learning[.,2021]

Federated learning을 살펴보면 Distributed learning과 비슷해 다소 비슷해 보이나, Federated learning은 Distributed learning과 차이가 존재한다. 어떤 차이가 있는지 살펴보도록 하겠다.

Distributed learning

  • Data를 single machine/data center(e.g., server)에서 학습을 진행한다. (centralized network)
  • Data는 data center(server)에 저장되며 data는 uniform분포를 띤다는 가정 (IID) → data shuffle
  • Network에 연결된 모든 client는 항상 접근이 가능하며 privacy정보를 확인할 수 있다.
  • Computing cost에 초점을 둔다.

Federated learning

  • Mobile/IoT device를 주로 다루며 local 환경에서 학습을 진행한다. (decentralized network)
  • 일반적으로 각 client의 local data는 서로 independent하다. (Non-IID)
  • 각 client의 privacy정보는 보호된다.
  • Communication cost에 초점을 둔다.
    • Communication cost → widely, it causes network environment problem

Conclusion

  • Federated learning의 motivation
    • 기존 연구는 data를 data center에 올려놓고 학습을 진행
    • Mobile device data의 경우 data center에서 학습을 진행하게 되면 , privacy issue가 발생 + data수에 따라 cost가 비례적으로 증가
  • Federated learning process
profile
김성철

0개의 댓글