VQ Methods Literature Survey — track-f preparation¶
§0 본 조사의 목적¶
Peak_Analysis 프로젝트는 "Energy Community + On-Device ESS" 세팅에서 5-가구 Federated Learning (FL) 으로 24-step peak forecasting 을 수행한다. FedPM (Federated Pattern Matching) 프로토콜의 핵심은 VQ codebook 을 shared channel 로 활용해 client 간 peak 패턴을 교환하는 것이다. 초록에 "shared VQ codebook for federated pattern exchange" 가 C3 claim 으로 확정 기재되어 있다.
문제 상황:
- v6 R1b 에서 PAPE 38.40 을 달성했으나 codebook_util ≈ 4% (M=64 기준 effective ≈ 2.6 entries) — VQ 가 거의 쓰이지 않은 채 DLinear + decoder capacity 로만 성능이 나온 것.
- v7/v8 에서 decoder 를 Conv1d×2 로 축소한 결과, VQ 포함 cells 모두 PAPE 53~56 으로 악화. VQ 단독 rescue (EMA/K-means/RESET/MemoryAlignment) 도 실패.
- track-f 는 "v6 FC-MLP decoder 복원 (W1) + 축소 Transformer decoder (W2) 병렬 smoke" 로 decoder capacity 축을 먼저 복원한 뒤, 그 위에서 VQ 재탐색을 수행할 계획.
user 의 새 가설 (본 조사가 검증 근거를 제공):
VQ 를 "평균 오차 (PAPE) vs 피크 감지율 (HR) trade-off 축" 으로 재정의한다. 즉, VQ size / quantization 강도가 PAPE-HR Pareto frontier 에서 working knob 으로 작동하는지.
이 가설은 두 가지 예측을 내포한다: 1. VQ 강도가 높을수록 (codebook 작을수록, quantization error 클수록) → per-step smoothed prediction → PAPE 악화, 그러나 peak event 의 discrete 성격을 codebook entry 로 capture 해 HR 개선. 2. VQ 가 없거나 강도 약할수록 → continuous regression → PAPE 개선, HR 은 평균 회귀로 감소.
본 survey 는 이 가설 검증에 가장 적합한 VQ 방법 후보를 선정하기 위한 근거 자료다.
범위: - §1 taxonomy 표 - §2 방법론 15종 요약 (각 2~3 문단) - §3 relevance matrix (본 프로젝트 × 각 방법) - §4 track-f 이후 sub-phase 실험 sequence 초안 - §5 user 가설 검증용 experimental design 초안
§1 VQ 방법론 Taxonomy¶
| # | Method | Quantization Type | Codebook Structure | Update Rule | Collapse 해결 | FL 호환성 | 원 논문 |
|---|---|---|---|---|---|---|---|
| 1 | VQ-VAE | Hard NN | Single flat | STE + codebook loss | 없음 (baseline) | OK (flat weight FedAvg) | van den Oord 2017 |
| 2 | VQ-VAE-2 | Hard NN, multi-scale | Hierarchical (top/bottom) | STE + codebook loss | 간접 (scale 분업) | Medium (계층별 separate FL) | Razavi 2019 |
| 3 | EMA-VQ | Hard NN | Single flat | EMA moving avg | 부분 (slow drift) | OK (EMA state 공유 필요) | van den Oord 2017 Appx |
| 4 | RQ-VAE | Hard NN, residual | K-level sequential | STE + residual | 간접 (later levels rescue) | Medium (level별 동기화) | Lee 2022 |
| 5 | Product Quantization (PQ) | Hard NN, split | M sub-codebooks | K-means or gradient | 간접 (sub-space) | OK (sub-CB별 FedAvg) | Jégou 2011 |
| 6 | Gumbel-Softmax VQ | Soft → hard | Single flat | Gumbel reparam | 강함 (exploration) | OK (temperature schedule) | Jang 2016 (base), Sønderby 2017 |
| 7 | Straight-Through Gumbel | Soft forward, hard eval | Single flat | STE + Gumbel | 중간 | OK | Jang 2016 |
| 8 | K-means Re-init | Hard NN | Single flat | Periodic K-means | 강함 (직접 교체) | Medium (re-init 타이밍) | Dhariwal 2020 (Jukebox) |
| 9 | SoundStream RESET | Hard NN | Single flat | Dead code replacement | 강함 (직접 교체) | Medium (RESET 타이밍) | Zeghidour 2021 |
| 10 | FSQ (Finite Scalar Quant) | Per-dim level | No codebook | None (deterministic) | N/A (codebook 없음) | Excellent (weight 없음) | Mentzer 2023 |
| 11 | LFQ (Lookup-Free Quant) | Binary sign | No codebook | None | N/A | Excellent | Yu 2023 (MAGVIT-v2) |
| 12 | TOTEM time-series VQ | Hard NN | Single flat | VQ-VAE base | 없음 (baseline) | OK (작은 CB) | Talukder 2024 |
| 13 | TimeVQVAE | Hard NN (STFT 공간) | Two-level (LF/HF) | VQ-VAE base | 간접 (대역 분업) | Medium | Lee 2023 |
| 14 | VQ-BeT / RVQ-Transformer | Residual + code-transformer | Multi-level | RQ + autoregressive | 간접 | Medium-Hard | Lee 2024 |
| 15 | Huh 2023 "Straightening Out STE" | (분석 논문) | — | 분석/제안 fix | 진단 + alternatives | — | Huh 2023 |
Legend: - "OK" = 본 프로젝트 FL (VQ codebook 16K floats FedAvg) 와 1:1 호환. - "Medium" = 추가 state (EMA counter, level 별 동기화) 공유 필요. - "Excellent" = codebook 자체가 없어 FL 통신량 0 (encoder/decoder 로 shared 채널 이동 필요).
§2 방법별 요약¶
2.1 VQ-VAE (van den Oord et al. 2017)¶
Paper: "Neural Discrete Representation Learning", NeurIPS 2017. arXiv:1711.00937.
원조 VQ + Autoencoder 프레임워크. Encoder 출력 z_e(x) 를 codebook E = {e_1, ..., e_K} 에서 L2 최근접 entry 로 매핑. Forward 는 hard lookup, backward 는 Straight-Through Estimator (STE) 로 z_e 에 gradient 를 우회 전달. Loss = reconstruction + codebook loss (||sg[z_e] - e||^2) + commitment loss (β * ||z_e - sg[e]||^2). β≈0.25 가 논문 권장치.
Codebook collapse 해결: 없음. 오히려 원조 baseline 이 collapse 빈발의 주 원인. 저자들도 논문 Appendix 에서 EMA update 를 대안으로 제시.
본 프로젝트 적용성: src/fed_learning/fedpm.py 의 VectorQuantizer 가 정확히 이 구현 (commitment_beta 0.25 default, STE, 16K floats FedAvg). 즉 baseline 자체가 기본 VQ-VAE. v6 R1b 4% util 은 baseline 의 알려진 collapse 문제이므로 개선 여지 분명.
PAPE/HR trade-off 관련성: 중간. Codebook size M 을 sweep 하면 trade-off 가 드러날 수 있으나, collapse 가 동반되어 M 효과와 collapse 효과가 섞인다 → trade-off axis 로서는 noisy.
단점: Collapse 위험 / commitment β 민감 / hard NN 의 non-differentiability → STE 편향 발생 (Huh 2023 #15 참조).
2.2 VQ-VAE-2 (Razavi et al. 2019)¶
Paper: "Generating Diverse High-Fidelity Images with VQ-VAE-2", NeurIPS 2019. arXiv:1906.00446.
Multi-scale (top: 거친 의미, bottom: 세부 디테일) 로 계층 quantization. Top codebook 이 global 구조, bottom codebook 이 local residual 을 학습. 각 level 은 독립 codebook + 독립 decoder. PixelCNN prior 로 sampling.
Collapse 해결: 간접. 계층 분업으로 각 level 이 담당 scale 의 entropy 만 표현 → 단일 level collapse 위험 분산. 단, 각 level 이 개별적으로 collapse 할 수는 있음.
본 프로젝트 적용성: 낮음. 24-step forecasting 은 단일 temporal scale 이라 hierarchical 의 이점이 뚜렷하지 않다. 또한 two-level FL 은 통신량 2배, aggregation 복잡도 증가. 다만 "저주파 공유 + 고주파 per-client" 형태로 변형하면 FedPM personalization 과 결합 가능 (educated guess).
PAPE/HR trade-off 관련성: 낮음. Scale 분업은 trade-off axis 와 직접 관련 없음.
단점: 복잡도 / FL 통신량 증가 / prior 학습 추가 필요 / 본 과제 규모 (L=24) 에 과잉 설계.
2.3 EMA VectorQuantizer (van den Oord 2017 Appendix A.1)¶
Paper: VQ-VAE 원 논문 Appendix. arXiv:1711.00937 Appx.
Codebook entry 를 gradient 로 학습하지 않고 exponential moving average 로 업데이트. 각 entry e_k 는 해당 entry 에 assign 된 z_e 의 EMA 로 계산:
- N_k ← γ·N_k + (1-γ)·n_k (usage count)
- m_k ← γ·m_k + (1-γ)·Σ z_e^{(k)} (cluster sum)
- e_k ← m_k / N_k
γ=0.99 표준. Hard assignment 이지만 slow drift 로 학습 stability 향상.
Collapse 해결: 부분. Gradient 경로를 codebook 에서 분리해 commitment loss 민감도 감소. 그러나 초기에 미사용 entry 는 영원히 미사용 → dead code 해결은 여전히 별도 RESET 필요.
본 프로젝트 적용성: 높음. track-e v3 "Tier 1a" 의 V1 (EMA) cell 이 이미 구현되어 있으며 v7/v8 에서 smoke 수행. 단, decoder 붕괴 조건에서 EMA 만으로 PAPE 회복 실패. track-f 에서 decoder 복원 후 재시도 가치 있음.
PAPE/HR trade-off 관련성: 중간. EMA γ sweep (0.8 ~ 0.999) 이 quantization rigidity 를 조절 → trade-off axis 로 일부 작동 가능.
단점: Dead code 영구 미사용 / EMA state 를 FL 에서 공유할지 여부 설계 이슈 (현재 v7_runner 는 공유 안 함).
2.4 RQ-VAE / Residual Quantization (Lee et al. 2022)¶
Paper: "Autoregressive Image Generation using Residual Quantization", CVPR 2022. arXiv:2203.01941.
Single codebook 대신 K 단계 residual quantization:
- r_0 = z_e
- For k = 1..K: q_k = NN(r_{k-1}, E), r_k = r_{k-1} - q_k
- z_q = Σ q_k
각 level 은 이전 level 의 residual 만 양자화 → 동일 codebook size 로 지수적 표현력 (K=4, M=256 → 256^4 = 4.3B configurations). 모든 level 에서 codebook 을 공유하거나 분리 가능.
Collapse 해결: 간접 + 강함. 첫 level 이 high-usage 로 coarse 를 잡고, 후속 level 이 residual 을 쪼개며 rare pattern 을 rescue. 표현력 증가로 "하나의 entry 로 평균" 되는 collapse 회피.
본 프로젝트 적용성: 높음. 16 entries codebook 으로 K=4 만 써도 65K configurations → peak pattern 의 long-tail 담기 유리. VQ codebook size 증가 없이 표현력 확장 → FL 통신량 동일. track-e v3 "Tier 2" 에서 P2 로 언급되었고, track-f 이후 실험 후보 1순위로 추천.
PAPE/HR trade-off 관련성: 매우 높음. K (residual depth) 가 명시적 trade-off knob. K=1 → 강한 smoothing (PAPE↑, HR↓?), K=4 → near-continuous (PAPE↓). 본 프로젝트에서 PAPE/HR Pareto 를 뚜렷하게 그리는 가장 유력한 방법.
단점: Autoregressive 학습 요소 도입 시 복잡도↑ (본 프로젝트는 forecasting 이라 AR 필요 없으나 encoder 측에 sequential residual loop 필요) / level 간 sync 버그 위험 / FL 에서 level 별 codebook 공유 시 각 level 의 collapse 독립 분석 필요.
2.5 Product Quantization (Jégou et al. 2011)¶
Paper: "Product Quantization for Nearest Neighbor Search", IEEE TPAMI 2011. DOI:10.1109/TPAMI.2010.57.
D 차원 vector 를 M 개 sub-space 로 분할하고, 각 sub-space 에서 독립 K-means 로 K^(1/M) 크기 sub-codebook 학습. 표현 가능 configuration = K^M. 원래는 NN search 가속용이지만 VQ-VAE 와 결합하면 codebook collapse 완화.
Collapse 해결: 간접. 각 sub-codebook 이 sub-space 전체를 커버해야 하므로 unique usage 가 sub-space 별로 분산 → 합산 util 상승.
본 프로젝트 적용성: 중간. Prototype dim D=64 를 4 sub-space × 16-dim 으로 나누면 sub-CB M'=8 로도 8^4 = 4K configurations. FL 에서는 4 개 sub-CB 각각 FedAvg → 통신량 동일. 단, 구현 복잡도↑, peak 패턴이 sub-space 간 entangled 일 경우 표현 손실.
PAPE/HR trade-off 관련성: 중간. Sub-codebook 수 M 이 trade-off knob.
단점: Sub-space 분할이 arbitrary (peak-aware 분할 설계 부재) / implementation 복잡 / 원 논문은 ANN 맥락이라 forecasting 적응 사례 희소.
2.6 Gumbel-Softmax VQ (Jang 2016, Sønderby 2017)¶
Paper: - "Categorical Reparameterization with Gumbel-Softmax", Jang et al., ICLR 2017. arXiv:1611.01144. - "Continuous Relaxation of Discrete Random Variables", Maddison et al., ICLR 2017. arXiv:1611.00712. - VQ-VAE 적용: Sønderby et al. 2017 "Continuous Relaxation of Discrete Latent Variables".
Hard NN argmin 대신 Gumbel-Softmax relaxation 으로 codebook 을 확률 분포로 선택:
- p_k = softmax((-d_k + g_k) / τ) (g_k ~ Gumbel(0,1))
- z_hat = Σ p_k * e_k (soft) 또는 STE 로 hard one-hot 으로 converge
Temperature τ 를 schedule 로 annealing (1.0 → 0.1).
Collapse 해결: 강함. 초기 soft 단계에서 모든 entry 가 gradient 받음 → exploration 강제. Temperature 감소로 점진적 hardening.
본 프로젝트 적용성: 높음. 기존 VectorQuantizer.forward 에 Gumbel noise + softmax 만 추가하면 되므로 구현 난이도 낮음. track-e v3 Tier 2 P2 로 언급. track-f 이후 1순위 후보.
PAPE/HR trade-off 관련성: 높음. Temperature τ 가 직접적 trade-off knob. 높은 τ → soft blending (PAPE↓, HR↓?), 낮은 τ → hard quantization (HR↑ 가능성).
단점: Temperature schedule 튜닝 필요 / FL 에서 각 client 의 τ 가 sync 되어야 함 (global round counter 로 공유 가능) / Gumbel sample 의 추가 randomness → seed 분산 증가 가능.
2.7 Straight-Through Gumbel (Jang et al. 2016)¶
Paper: 위와 동일, arXiv:1611.01144.
Forward 에서 Gumbel-Softmax 로 soft 분포 계산 후 argmax 로 hard one-hot 반환, backward 에서 soft gradient 우회. 즉 inference 시에는 hard VQ 와 동일 / 학습 시에만 soft.
Collapse 해결: 중간. Soft gradient 로 exploration 유도하되 hard forward 로 discrete bottleneck 유지 → 실제 inference 와 학습이 일치.
본 프로젝트 적용성: 높음. #2.6 의 inference-time hard 변형. 실제로 forecasting 에서 discrete peak-mode 를 선택하려면 hard assignment 가 의미 있으므로 본 프로젝트에 더 적합할 수 있음.
PAPE/HR trade-off 관련성: 높음. τ 가 여전히 knob, inference 시에는 항상 hard 로 고정되어 HR 가설 검증이 깔끔.
단점: Forward-backward mismatch 로 gradient bias (Huh 2023 #15 가 이 편향을 체계적으로 분석).
2.8 K-means Re-initialization (Dhariwal et al. 2020, Jukebox)¶
Paper: "Jukebox: A Generative Model for Music", Dhariwal et al. 2020. arXiv:2005.00341 §3.2.
주기적으로 (every N batches) 현재 encoder output batch 에 K-means 를 돌려 codebook 을 재초기화. Dead code (usage < threshold) 를 live cluster 의 centroid + noise 로 대체.
Collapse 해결: 강함 (직접 교체). Collapse 된 entry 를 active 로 강제 복구.
본 프로젝트 적용성: 높음. track-e v3 "Tier 1a" V2 (K-means) / V3 (EMA+KMEANS) 로 이미 구현. v7/v8 에서 smoke 수행. Decoder 복원 후 (track-f) 재시도 필수.
PAPE/HR trade-off 관련성: 낮음. Collapse 해결이 목적이지 quantization strength knob 아님.
단점: Re-init 타이밍 민감 / FL 에서 client 별 K-means 가 같은 feature 분포로 수렴하지 않으면 aggregation 후 drift 위험 / re-init 시 학습 진동.
2.9 SoundStream RESET / Dead Code Replacement (Zeghidour et al. 2021)¶
Paper: "SoundStream: An End-to-End Neural Audio Codec", Zeghidour et al. 2021, IEEE/ACM TASLP. arXiv:2107.03312. §3.2 "Vector Quantizer".
Batch 내 각 codebook entry 의 usage count 추적, threshold 미만 dead code 를 random input vector 또는 high-usage entry 의 jittered copy 로 교체. EMA VQ 와 결합이 표준 (SoundStream §3).
Collapse 해결: 강함 (직접 교체 + usage tracking).
본 프로젝트 적용성: 높음. track-e v3 "Tier 1b" P0 RESET, track-v8 V5 로 편입되었으나 v8 은 실패했고 track-f 아직 적용 전. Decoder 복원 후 재시도 필수.
PAPE/HR trade-off 관련성: 낮음. #2.8 과 동일 이유.
단점: Dead-code threshold 민감 / RESET 주기 hyperparameter / FL 에서 각 client 가 다른 dead set 을 reset 하면 aggregation 후 일관성 훼손.
2.10 FSQ — Finite Scalar Quantization (Mentzer et al. 2023)¶
Paper: "Finite Scalar Quantization: VQ-VAE Made Simple", Mentzer et al., ICLR 2024. arXiv:2309.15505.
Codebook 자체를 제거. Encoder 출력의 각 차원을 tanh → fixed level 수 L 로 quantize (e.g., [-1, -0.5, 0, 0.5, 1]). 전체 표현 configuration = ∏ L_i (e.g., 5^6 = 15,625). Gradient 는 STE. 학습 가능한 codebook 이 없으므로 collapse 개념 자체가 없음.
Collapse 해결: N/A. Codebook 이 없어 collapse 불가. 모든 configuration 이 항상 reachable.
본 프로젝트 적용성: 매우 높음. FL 에서 codebook 통신량 = 0 (encoder/decoder 의 weight 만 공유 또는 per-client). 초록의 "shared VQ codebook" claim 은 framing 조정 필요 (shared encoder/decoder 로 re-spin 가능). User 가설 "VQ = trade-off axis" 검증에 Level 수 L 이 깔끔한 knob 으로 작동. 저자들은 VQ-VAE 와 동등 또는 우수 성능 보고.
PAPE/HR trade-off 관련성: 최고. Level 수 L = {3, 5, 7, 10} sweep 으로 quantization 강도와 표현력을 독립 조절 가능. 사용자 가설 검증에 가장 깔끔한 method.
단점: "Shared codebook for federated pattern exchange" 초록 claim 과 상충 → paper narrative 재편 필요 / level 수가 이산 hyperparameter 라 continuous sweep 불가 / peak 의 continuous 성격 손실 가능.
2.11 LFQ — Lookup-Free Quantization (Yu et al. 2023, MAGVIT-v2)¶
Paper: "Language Model Beats Diffusion: Tokenizer is Key to Visual Generation", Yu et al., ICLR 2024. arXiv:2310.05737. §3.1.
FSQ 의 극단 버전: 각 차원을 binary sign (±1) 으로 quantize. D 차원 → 2^D configurations (D=10 → 1024). Codebook 없음 (FSQ 와 동일). STE backward. 저자들은 VQ-VAE + LFQ 가 대규모 scale 에서 더 크고 효과적인 vocabulary 를 생성한다고 보고.
Collapse 해결: N/A (codebook 없음).
본 프로젝트 적용성: 중간-높음. D=6~10 정도면 64~1024 configurations 로 현 M=64 대응. FL 통신량 0. 단, binary 만 허용하므로 peak magnitude 의 미세 정보 손실 가능 — FSQ 가 본 과제에 더 자연.
PAPE/HR trade-off 관련성: 높음. D 가 knob. D=1 → 2 modes (peak vs non-peak), D 증가 → 더 많은 pattern.
단점: ±1 binary 로만 분해되므로 표현 granularity 한정 / 최신 (2023) 기법이라 시계열 적용 사례 희소 / 초록 claim 영향 FSQ 와 동일.
2.12 TOTEM — Tokenized Time Series Foundation Model (Talukder et al. 2024)¶
Paper: "TOTEM: TOkenized Time Series EMbeddings for General Time Series Analysis", Talukder et al. 2024. arXiv:2402.16412.
시계열 다변량 (multi-domain, multi-frequency) 데이터 에서 universal tokenizer 를 학습. VQ-VAE 기반 (encoder → VQ → decoder) 로 단일 codebook (K=256, D=64) 를 여러 dataset 에 공통 학습. Forecasting / classification / anomaly detection 모두에서 universal tokenizer 로 downstream head 만 교체하는 paradigm.
Collapse 해결: 없음 (baseline VQ-VAE 유지). 논문 보고 util 수치는 저자 코드 공개 저장소에서 확인 필요.
본 프로젝트 적용성: 높음 (개념적). 본 과제는 time-series VQ 가 forecasting 에 실제 활용 가능함을 보여주는 근거. TOTEM 의 encoder/decoder 구조 (Conv1d stack + bottleneck) 는 본 프로젝트의 v7 ProposedModel 과 유사. 단, TOTEM 은 non-FL centralized + multi-dataset 이라 FL 세팅 직접 이식은 불가.
PAPE/HR trade-off 관련성: 중간. Codebook size K 를 sweep 하면 trade-off 드러날 수 있으나 TOTEM 자체가 trade-off 를 주장하지는 않음 (downstream 일반화 목적).
단점: FL 없음 / multi-dataset pretraining 전제 / 본 과제 5-가구 소규모에서 동일 효과 불확실.
2.13 TimeVQVAE (Lee et al. 2023)¶
Paper: "Vector Quantized Time Series Generation with a Bidirectional Prior Model", Lee & Jang 2023, AISTATS 2023. arXiv:2303.04743.
STFT 로 시계열을 주파수 공간으로 전환 후 low-frequency + high-frequency 를 별도 codebook 으로 양자화. Bidirectional prior 로 생성. 시계열 generation 이 주 목적이지만 codebook 기반 시계열 표현의 효용을 실증.
Collapse 해결: 간접. LF/HF 분업으로 각 codebook 의 표현 영역 축소.
본 프로젝트 적용성: 중간. Peak forecasting 은 LF (daily cycle) + HF (peak spike) 구분이 자연스러워 STFT 분업 개념이 맞을 수 있음. 단, 구현 복잡도 ↑, FL 통신 × 2.
PAPE/HR trade-off 관련성: 중간. HF codebook 강도 조절이 HR 에 직접 영향 가능 (educated guess).
단점: Generation task 주 타겟 / STFT 전처리 추가 / 5-가구 소규모에서 HF codebook 이 충분히 학습되지 않을 위험.
2.14 VQ-BeT / RVQ-Transformer (Lee et al. 2024)¶
Paper: "Behavior Generation with Latent Actions", Lee et al., ICML 2024. arXiv:2403.03181.
Residual VQ (RQ) + autoregressive Transformer 로 action sequence 를 discrete token 으로 생성하는 robot 제어 framework. K level residual codebook × 각 level 의 Transformer head. Action decoder 가 VQ token 을 계층적으로 예측.
Collapse 해결: 간접 (RQ 와 동일).
본 프로젝트 적용성: 낮음-중간. RVQ 아이디어는 #2.4 에서 이미 커버. VQ-BeT 는 action generation context 로 본 forecasting 과 결이 다름.
PAPE/HR trade-off 관련성: 중간. #2.4 와 동일.
단점: 본 과제의 continuous forecasting 보다 복잡 / 별도 code-transformer 학습 필요.
2.15 Huh 2023 — "Straightening Out the Straight-Through Estimator" (Huh, Cheung, Wang, Krishnan 2023)¶
Paper: "Straightening Out the Straight-Through Estimator: Overcoming Optimization Challenges in Vector Quantized Networks", Huh et al., ICML 2023. arXiv:2305.08842.
분석 + 제안 혼합 논문. VQ-VAE 의 codebook collapse 를 STE gradient bias 로 설명 (soft forward 와 hard backward 의 불일치가 dead entry 강화). 제안: 1. Alternating training: encoder 와 codebook 을 교대로 freezing. 2. Stochastic rotation: codebook 에 rotation augmentation. 3. Affine reparameterization: codebook 전체에 learnable affine transform.
Collapse 해결: 분석 진단 + 3 가지 fix. Fix 들은 체계적 개선이지만 절대 성능은 EMA/RESET 대비 비교우위 미미 (논문 Table 1).
본 프로젝트 적용성: 연구 가치 높음 (분석 도구). 본 과제 v6 R1b util 4% 가 STE bias 인지 진단하려면 이 논문의 실험 protocol (alternating vs joint training) 을 replicate 가능. Collapse diagnosis 단계에서 참조.
PAPE/HR trade-off 관련성: 낮음 (분석 논문).
단점: 논문 제안 fix 들의 효과가 작고 (~2pp) 구현 비용 대비 이득 제한적 / 분석 도구로서 가치 주.
2.16 (참고) Federated VQ codebook 공유 관련¶
본 프로젝트 FedPM 은 VQ codebook 을 FL 공유 채널로 쓰는 독자 구조다. 관련 선행 연구 범위:
- FedVAE / FedGAN 계열: Autoencoder latent 공유는 있으나 VQ 특화 아님. (e.g., Hardy 2019 MD-GAN, arXiv:1811.03850.)
- Federated Clustering: Ghosh 2020 "An Efficient Framework for Clustered Federated Learning", arXiv:2006.04088. Codebook 과 유사한 cluster center 공유 개념, VQ 와 다름.
- Federated Prototype Learning: Tan 2022 "FedProto: Federated Prototype Learning across Heterogeneous Clients", AAAI 2022. arXiv:2105.00243. Client 별 class prototype 공유. 본 프로젝트 VQ codebook 공유의 가장 가까운 선행.
- TimeFed / FedTS: 최신 시계열 FL baseline 이지만 VQ 공유 채널은 드물다.
본 프로젝트 기여 포인트: "VQ codebook 을 FL 채널로 써서 pattern 공유" 는 시계열 FL 에서 드문 구성이며, user 가설의 "PAPE/HR trade-off 축" framing 과 결합하면 novelty 더 강해짐.
§3 본 프로젝트 Relevance Matrix¶
평가 기준: - 구현 난이도 (1=쉬움, 5=어려움): v7_runner / fedpm.py 통합 기준. - v7_runner 통합 가능성 (1=낮음, 5=바로 plug-in). - PAPE 개선 기대 (1=낮음, 5=높음): decoder 복원 전제 하. - HR trade-off 가능성 (1=낮음, 5=높음): user 가설 검증 강도. - 초록 C3 claim 유지 (1=claim 파기, 5=강화): "shared VQ codebook for federated pattern exchange" 기준.
| # | Method | 구현난이도 | v7 통합 | PAPE↑ | HR trade-off | C3 유지 | Total (높을수록 선호) |
|---|---|---|---|---|---|---|---|
| 1 | VQ-VAE baseline | 1 (완료) | 5 | 2 | 2 | 5 | — (baseline) |
| 2 | VQ-VAE-2 | 4 | 2 | 2 | 2 | 4 | 낮음 |
| 3 | EMA-VQ | 1 (완료) | 5 (V1) | 3 | 3 | 5 | 중간 |
| 4 | RQ-VAE | 3 | 4 | 4 | 5 | 5 | 매우 높음 |
| 5 | Product Quantization | 3 | 3 | 3 | 3 | 4 (sub-CB 공유로 재해석) | 중간 |
| 6 | Gumbel-Softmax VQ | 2 | 5 | 4 | 5 | 5 | 매우 높음 |
| 7 | ST-Gumbel | 2 | 5 | 4 | 4 | 5 | 높음 |
| 8 | K-means Re-init | 2 (완료 V2) | 5 | 3 | 2 | 5 | 중간 |
| 9 | SoundStream RESET | 2 (일부 완료) | 4 | 3 | 2 | 5 | 중간 |
| 10 | FSQ | 2 | 3 | 4 | 5 | 2 (claim 파기) | 높음 (narrative 조정 필요) |
| 11 | LFQ | 2 | 3 | 3 | 4 | 2 | 중간 |
| 12 | TOTEM (concept) | 2 | 4 | 3 | 3 | 5 | 중간 (reference 용) |
| 13 | TimeVQVAE | 4 | 2 | 3 | 3 | 4 | 낮음 |
| 14 | VQ-BeT / RVQ-TF | 4 | 2 | 3 | 3 | 4 | 낮음 |
| 15 | Huh 2023 analysis | 3 | 3 | 2 | 1 | 5 | 진단용 |
Top 3 후보 선정 (track-f 이후 1순위):
- RQ-VAE (#4): PAPE↑ + HR trade-off 모두 최상. K level 이 명시적 knob. 초록 claim 유지 (multi-level shared codebook). 구현 난이도 중 (residual loop + level 별 loss).
- Gumbel-Softmax VQ (#6): 구현 간단 (fedpm.py 수정 ~30 lines). Temperature τ 가 trade-off knob. Collapse 해결력 강함.
- FSQ (#10): Trade-off 검증에 가장 깔끔 (level L 이 knob). 단, 초록 claim narrative 조정 필요 (shared encoder as pattern channel 로 re-spin).
§4 추천 실험 Sequence (track-f 이후 sub-phase 설계 초안)¶
track-f 의 W1 (v6 FC decoder) / W2 (축소 Transformer) 가 PAPE ≤ 45 를 달성해 decoder capacity 복원이 확인된 뒤 실행.
4.1 Phase G (Gumbel exploration)¶
- 목적: VQ 의 PAPE/HR trade-off axis 실증.
- Cells: G1 (τ=schedule 1.0→0.1), G2 (τ=0.5 fixed), G3 (τ=0.1 fixed, near-hard).
- Seeds: {42, 123, 456}. 3 Apt (Apt6, Apt15, Apt88).
- Rounds: 10.
- Workload (educated guess): 9 runs × ~10분 = ~90분.
- Gate: 최소 1 cell PAPE < track-f 선정 variant + HR 상승 동반 → trade-off 가설 약검증.
4.2 Phase R (RQ-VAE)¶
- 목적: Residual depth K 로 trade-off 축 본격 탐색.
- Cells: R1 (K=2, M=16), R2 (K=4, M=16), R3 (K=4, M=32).
- Seeds: {42, 123, 456}. 5 Apt.
- Rounds: 10 → 통과 시 30.
- Workload (educated guess): 9 runs × ~15분 = ~2h.
- Gate: R 계열 best PAPE < G 계열 best, HR 동반 개선.
4.3 Phase S (FSQ + LFQ)¶
- 목적: Codebook 제거 방법이 FL 통신 0 로도 경쟁력 있는지.
- Cells: S1 (FSQ, L_i=[5,5,5,5,5,5]), S2 (FSQ L_i=[7,7,7,7]), S3 (LFQ D=8).
- Seeds: {42, 123, 456}. 3 Apt.
- Rounds: 10.
- Workload (educated guess): 9 runs × ~10분 = ~90분.
- Gate: S 계열 성능이 R 계열 대비 ±3pp 이내 → "shared codebook" narrative 조정 근거 확보.
4.4 Phase D (Diagnosis, 선택)¶
- 목적: Huh 2023 분석 protocol 으로 기존 collapse 원인 진단.
- Cells: D1 (alternating train), D2 (codebook rotation), D3 (affine reparam).
- 우선순위 P2 (위 3 phase 완료 후).
의존성 그래프:
track-f.3 gate 통과
│
├── Phase G (90분, Gumbel trade-off 검증, 필수) ─┐
│ │
├── Phase R (2h, RQ-VAE depth 탐색, 필수) ───────┼── 통합 분석
│ │ PAPE vs HR Pareto frontier plot
└── Phase S (90분, FSQ/LFQ narrative check) ────┘ → exp-critic → reporter
→ paper draft VQ section 재구성
§5 User 아이디어 검증 가능 설계¶
5.1 가설 재정의¶
H_trade-off: VQ 의 quantization 강도 (codebook size M 또는 FSQ level L 또는 Gumbel τ 또는 RQ K) 를 조절하면, 동일 architecture 에서 PAPE 와 HR 은 서로 교환 관계가 된다. 구체적으로:
H1: VQ off (M=∞, 즉 quantization bypass) → PAPE 최소, HR 중간 (continuous regression 의 평균 회귀).H2: VQ 강함 (M=4~8, 또는 τ→0) → PAPE 증가, HR 증가 (peak event discrete rescue).H3: Pareto frontier 상 hyperparameter 별 trade-off point 는 단조 (strictly monotone trade-off).
5.2 검증 실험 구조¶
단일 method 안에서 knob sweep 하는 쌍 비교가 가장 깔끔. Method 간 비교는 confounder (구현 차이, 학습 속도) 많음.
Design A — Codebook size sweep (간단, 먼저 실행): - Method: 기존 VQ-VAE + EMA (V1 baseline). - M ∈ {4, 8, 16, 32, 64, 128}. - 각 M × 3 seeds × 3 Apt × rounds=10. - 측정: PAPE, HR, codebook_util, perplexity. - 예상 패턴: M 감소 → util → 100%, PAPE 완만 증가, HR 증가 (가설 지지). - 실패 패턴: M 감소 → collapse 심화, util 붕괴 지속, PAPE+HR 동반 악화 (가설 기각).
Design B — FSQ level sweep (깔끔, 후속 실행):
- Method: FSQ (collapse 없음, 순수 quantization strength 만 변인).
- Level 수: [2]^D, [3]^D, [5]^D, [7]^D (D=6).
- 각 config × 3 seeds.
- 예상 패턴: Level ↓ → configuration 수 ↓ → PAPE ↑ + HR ↑ 또는 HR 유지 (깔끔한 trade-off).
- 장점: Collapse confounder 없어 user 가설 직접 검증 가능.
Design C — Gumbel τ sweep (중간 난이도): - Method: Gumbel-Softmax VQ, M=16 fixed. - τ ∈ {0.1, 0.5, 1.0, 2.0, 5.0}. - 각 τ × 3 seeds. - 예상: τ↓ → hard quantization → HR 개선, τ↑ → soft blending → PAPE 개선.
5.3 측정 지표 & 분석¶
- 1차: Pareto frontier plot (x: HR, y: PAPE, 각 hyperparam = 점). Trade-off 곡선 존재 = 가설 약 지지.
- 2차: Spearman rank corr between hyperparam 과 (PAPE, HR). |ρ_PAPE| > 0.5 AND |ρ_HR| > 0.5 AND sign(ρ_PAPE) ≠ sign(ρ_HR) = 가설 강 지지.
- 3차: bootstrap CI (N=1000) 로 각 point 의 신뢰구간. Frontier 상 점들의 CI 가 서로 분리 = 의미있는 trade-off.
5.4 어느 방법이 가장 뚜렷한 trade-off 를 drawing 할까¶
| Method | trade-off axis | Confounder | 기대 뚜렷함 |
|---|---|---|---|
| VQ-VAE M sweep | M | collapse 심화 (낮은 M) | 중간 |
| FSQ L sweep | L | 없음 (codebook 없음) | 매우 뚜렷 |
| Gumbel τ sweep | τ | exploration randomness | 뚜렷 |
| RQ-VAE K sweep | K | level 간 interaction | 중간 |
| LFQ D sweep | D | binary 한계 | 중간 |
추천: FSQ L sweep 을 trade-off 가설 검증의 golden experiment 로 설정. 이유:
1. Collapse 가 원리적으로 없으므로 quantization 강도만이 단일 변인.
2. Level L 이 이산 hyperparameter 라 명확한 configuration 수 계산 가능 (L^D).
3. FL 통신량 0 로 aggregation 교란 배제.
4. Paper narrative: "collapse 를 피하면서도 VQ strength axis 에서 PAPE-HR trade-off 를 실증" 이 강한 contribution.
단, 초록 C3 "shared VQ codebook for federated pattern exchange" 유지하려면 FSQ 를 sub-experiment 로 넣고 primary 는 RQ-VAE 또는 Gumbel 로 가는 양면 전략 권장.
5.5 예상 시나리오 (educated guess)¶
- 시나리오 α (가설 지지): FSQ L sweep 에서 L=2 → PAPE=45, HR=0.82 / L=7 → PAPE=38, HR=0.75. Pareto frontier 우상향. → paper VQ section 재구성, novelty 강화.
- 시나리오 β (부분 지지): Pareto frontier 가 존재하되 비단조 (L=3 이 peak). → "optimal quantization strength" framing.
- 시나리오 γ (기각): 모든 L 에서 PAPE 유사하거나 HR 변화 없음. → VQ 는 trade-off axis 아니며 shared channel 로만 기능 → C3 narrative 축소 재검토.
시나리오 γ 발생 시 ADR-010 로 paper direction pivot 필요.
§6 참고문헌 (arXiv ID / DOI)¶
- van den Oord et al., "Neural Discrete Representation Learning", NeurIPS 2017. arXiv:1711.00937.
- Razavi et al., "Generating Diverse High-Fidelity Images with VQ-VAE-2", NeurIPS 2019. arXiv:1906.00446.
- Lee et al., "Autoregressive Image Generation using Residual Quantization", CVPR 2022. arXiv:2203.01941.
- Mentzer et al., "Finite Scalar Quantization: VQ-VAE Made Simple", ICLR 2024. arXiv:2309.15505.
- Yu et al., "Language Model Beats Diffusion: Tokenizer is Key to Visual Generation" (LFQ/MAGVIT-v2), ICLR 2024. arXiv:2310.05737.
- Jang et al., "Categorical Reparameterization with Gumbel-Softmax", ICLR 2017. arXiv:1611.01144.
- Maddison et al., "The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables", ICLR 2017. arXiv:1611.00712.
- Jégou et al., "Product Quantization for Nearest Neighbor Search", IEEE TPAMI 2011. DOI:10.1109/TPAMI.2010.57.
- Zeghidour et al., "SoundStream: An End-to-End Neural Audio Codec", IEEE/ACM TASLP 2021. arXiv:2107.03312.
- Dhariwal et al., "Jukebox: A Generative Model for Music", 2020. arXiv:2005.00341.
- Huh et al., "Straightening Out the Straight-Through Estimator: Overcoming Optimization Challenges in Vector Quantized Networks", ICML 2023. arXiv:2305.08842.
- Talukder et al., "TOTEM: TOkenized Time Series EMbeddings for General Time Series Analysis", 2024. arXiv:2402.16412.
- Lee & Jang, "Vector Quantized Time Series Generation with a Bidirectional Prior Model", AISTATS 2023. arXiv:2303.04743.
- Lee et al., "Behavior Generation with Latent Actions" (VQ-BeT), ICML 2024. arXiv:2403.03181.
- Tan et al., "FedProto: Federated Prototype Learning across Heterogeneous Clients", AAAI 2022. arXiv:2105.00243.
- Ghosh et al., "An Efficient Framework for Clustered Federated Learning", NeurIPS 2020. arXiv:2006.04088.
- Hardy et al., "MD-GAN: Multi-Discriminator GAN", 2018. arXiv:1811.03850.
- Sønderby et al., "Continuous Relaxation of Discrete Latent Variables in VAE", 2017 (참고).
§7 본 survey 의 한계 (bias disclosure)¶
- 본 survey 는 공개 논문 정보 기반 체계적 정리이며, 본 프로젝트에서 각 방법을 직접 실험한 결과는 V1/V2/V3 (EMA/K-means/결합) 및 V4/V5 (MemoryAlignmentServer/RESET) 에 한정된다. 나머지 방법들의 "본 프로젝트 적용성" 평가는 문헌 + 구현 분석 기반 추정 (educated guess 명시).
- 구현 난이도 평가는
src/fed_learning/fedpm.py현 구조 기준이며, v7_runner.py 의 CellSpec 시스템 (B0~V5, W1/W2) 에 새 cell 추가 workload 를 1~2 일 기준으로 산정. - Workload 추정 (90분/9 runs 등) 은 v6 R1b 평균 run-time (~10분/1 cell/3 seeds/2 Apt) 기반 extrapolation. 방법별 overhead (Gumbel 추가 연산, RQ K-level 추가 forward) 는 미반영 → 실제 더 오래 걸릴 수 있음.
- user 가설 "PAPE/HR trade-off" 는 본 프로젝트 고유의 framing 이며, 문헌에 직접 대응 사례는 드물다. §5 의 예상 시나리오는 all hypothetical.