[인공지능] Generative AI (1) Normalizing flows

2026. 5. 12. 01:43·연구 Research/인공지능 Artificial Intelligent

 

Generative modeling에서 GAN 이후로 다양한 모델이 나왔는데 현재도 그 모델 안에서 발전 중이다.

 

나름대로 흐름을 설명하면서 이야기하고 싶어서 조금씩 커버를 하고자 한다.

 

 

첫 번째 이야기는 Normalizing flows에 대한 이야기이다. 정확히 이게 뭔지를 알아야 나중에 discrete normalizing flows에서 continuous normalizing flows로 넘어가는 걸 이해할 수 있다. 사실 이전에 Variational autoencoder를 또 이해해야하는 문제인데 그건 나중에 작성해서 여기에 링크를 남길 예정이다.

 

흐름 

normalizing flows (Ordinary differential equation model) (2016) - diffusion models (Stochastic differential equation models) - flow matching (how to train scalable continuous models) (2023)

 


0. Generative model이란 무엇인가?

 


Generative model은 sample을 생성하는 machine learning model이다.

Dataset (z_1,\ldots,z_N \sim p_{data})가 주어졌을 때,

$$
z \sim p_{data}
$$

를 생성하는 것이 목표이다.

만약 text prompt와 같은 conditioning variable (y)가 존재한다면,

$$
z \sim p_{data}(\cdot|y)
$$

를 생성하는 conditional generative model이 된다.



 

 


Normalizing flow는 “invertible transformation을 이용한 change of variables”로 설명할 수 있다. 그렇다면 왜 variable을 바꾸어야 할까?

생성 모델은 정답이 하나로 정해져 있지 않은 문제와 유사하다. 우리는 다양한 sample들을 생성하고 싶기 때문에, 일반적인 noise distribution으로부터 우리가 원하는 복잡한 data distribution으로 변환하는 과정이 필요하다.

즉, 랜덤하게 sampling한 (x)를 우리가 원하는 데이터 분포를 따르는 (z)로 변환하고 싶은 것이다.

$$
x \sim p_{init}
\quad \rightarrow \quad
\text{(generative model)}
\quad \rightarrow \quad
z \sim p_{data}
$$

우리는 이미 (p_{init})을 알고 있다. 예를 들어 (\mathcal{N}(0,I_d))와 같은 단순한 distribution이며 sampling도 쉽다.

반면, (p_{data})는 매우 복잡한 distribution이고, 우리는 dataset (z_1,\ldots,z_N)와 같은 일부 sample만 알고 있는 상황이다.

따라서 normalizing flow를 학습하여 이러한 distribution을 modeling한다.

 

 


2. “Discrete” normalizing flow의 formulation


더 자세한 내용:
Rezende and Mohamed 2016; Dinh, Krueger, and Bengio 2015; Dinh, Sohl-Dickstein, and Bengio 2017

모델은 다음과 같이 주어진다. $x=f_i(z), \quad z=f_i^{-1}(x)$와 같이 변수를 변환하는 mapping $f$가 있다고 하자.

이러한 mapping이 계속 모여서 $f$를 만들 때 이 mapping의 누적으로 만들어지는 확률 분포는 다음과 같다.

 


$$
p(x)
=p(z)
\left|
\det
\frac{\partial f^{-1}}{\partial x}
\right|
$$

여기서

$$
f = f_K \circ \cdots \circ f_1
$$

이다.

이는 invertible transformation들의 chain이다. 각 layer는 invertible해야 하며 tractable한 Jacobian determinant를 가져야 한다.또한 log-density는 다음과 같이 표현된다.

$$
\log p(x)
= \log p(z_0)
\sum_{k=1}^{K}
\log
\left|
\det J_{f_k}(z_{k-1})
\right|
$$

이 모델은 다음 조건들을 만족해야 한다.

* Input과 output의 dimension이 동일해야 한다.
* Transformation이 invertible해야 한다.
* Jacobian determinant 계산이 efficient하고 differentiable해야 한다.

추가적으로 $x,z$ 변수들이 deterministic하게 정해진다는 것도 특징이다.

 

3. normalizing flow 예시

 


(f_k)를 modeling하는 방법은 매우 다양하다. Neural network 기반으로는 다음과 같이 mapping (f)를 modeling할 수 있다.

$$
z_k
= f_{\theta}(z_{k-1})=
z_{k-1}
+
u h\left(
\mathbf{w}^{\top} z_{k-1} + b
\right)
$$

여기서 (u,w,b)는 trainable parameter이다.

 

 

이 외에도 다양한 모델링 방법이 있지만 현재 주로 쓰이는 것은 diffusion model과 flow matching이므로 빠르게 넘어가도록 한다.

 

 


https://deepgenerativemodels.github.io/notes/flow/

 

Normalizing Flow Models

If , then the mappings is volume preserving, which means that the transformed distribution will have the same “volume” compared to the original one .

deepgenerativemodels.github.io

 

저작자표시 비영리 변경금지 (새창열림)

'연구 Research > 인공지능 Artificial Intelligent' 카테고리의 다른 글

[공부] Automatic differentiation forward mode & reverse mode  (0) 2025.03.09
[연구] SciML 분야 라이브러리 기록  (0) 2024.03.11
[chatGPT] chatGPT 프롬프트 엔지니어링  (0) 2023.11.28
[JAX] L-BFGS optimizer로 학습하는 예제 코드  (0) 2023.11.02
[Deep learning] Bayesian Neural Network (1)  (0) 2023.10.23
'연구 Research/인공지능 Artificial Intelligent' 카테고리의 다른 글
  • [공부] Automatic differentiation forward mode & reverse mode
  • [연구] SciML 분야 라이브러리 기록
  • [chatGPT] chatGPT 프롬프트 엔지니어링
  • [JAX] L-BFGS optimizer로 학습하는 예제 코드
보통의공대생
보통의공대생
수학,프로그래밍,기계항공우주 등 공부하는 기록들을 남깁니다.
  • 보통의공대생
    뛰는 놈 위에 나는 공대생
    보통의공대생
  • 전체
    오늘
    어제
    • 분류 전체보기 (482)
      • 공지 (1)
      • 영어 공부 English Study (40)
        • 텝스 TEPS (7)
        • 글 Article (21)
        • 영상 Video (10)
      • 연구 Research (102)
        • 최적화 Optimization (4)
        • 데이터과학 Data Science (8)
        • 인공지능 Artificial Intelligent (41)
        • 제어 Control (45)
      • 프로그래밍 Programming (36)
        • 매트랩 MATLAB (25)
        • 파이썬 Python (33)
        • 줄리아 Julia (2)
        • C++ (3)
        • 리눅스 우분투 Ubuntu (6)
      • 항공우주 Aeronautical engineeri.. (21)
        • 항법 Navigation (0)
        • 유도 Guidance (0)
      • 기계공학 Mechanical engineering (3)
        • 열역학 Thermodynamics (0)
        • 고체역학 Statics & Solid mechan.. (10)
        • 동역학 Dynamics (1)
        • 유체역학 Fluid Dynamics (0)
      • 수학 Mathematics (35)
        • 선형대수학 Linear Algebra (18)
        • 미분방정식 Differential Equation (3)
        • 확률및통계 Probability & Sta.. (2)
        • 미적분학 Calculus (1)
        • 복소해석학 Complex Analysis (5)
        • 실해석학 Real Analysis (1)
      • 수치해석 Numerical Analysis (29)
      • 확률 및 랜덤프로세스 Random process (2)
      • 추론 & 추정 이론 Estimation (3)
      • 기타 (97)
        • 설계 프로젝트 System Design (8)
        • 논문작성 Writing (58)
        • 세미나 Seminar (2)
        • 생산성 Productivity (3)
      • 실험 Experiment (1)
      • 유학 생활 Daily (8)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    pytorch
    텝스공부
    Statics
    JAX
    우분투
    생산성
    Numerical Analysis
    Linear algebra
    Julia
    수치해석
    ChatGPT
    인공지능
    논문작성
    matplotlib
    WOX
    Zotero
    텝스
    teps
    IEEE
    에러기록
    옵시디언
    고체역학
    LaTeX
    obsidian
    Dear abby
    머신러닝
    MATLAB
    Python
    딥러닝
    논문작성법
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
보통의공대생
[인공지능] Generative AI (1) Normalizing flows
상단으로

티스토리툴바