feat: Variet Engine v1.0 + 5-model tuning complete

Phase 01 (LLM Tuning):
- Gemma4 26B: 74.65 t/s (fast)
- Qwen 35B: 61.62 t/s (balanced)
- Gemma4 31B: 16.0 t/s (deep-coder)
- Qwen 27B: 16.7 t/s (deep-logic)
- Qwen 122B: 8.95 t/s (ultra, GPU 1 only)

Phase 02 (API Engine):
- FastAPI reverse proxy on port 8000
- /engine/switch hot-swap with 503 protection
- config/engine_models.json as single source of truth
- Replaced 4 individual .bat files with unified engine

File cleanup:
- scripts/ 85 files -> 9 + _archive/
- Root .bat files -> _archive/
This commit is contained in:
Variet-Worker
2026-04-07 18:08:58 +09:00
parent 7c7a899fd5
commit c111b3a9b0
414 changed files with 3402 additions and 68598 deletions

View File

@@ -0,0 +1,43 @@
---
phase: 01-llm-tuning
task: 3
total_tasks: 5
status: in_progress
last_updated: 2026-04-06T21:18:00+09:00
---
<current_state>
We are currently assessing the max context bounds and generation speed for dense/mid-sized models (Qwen 27B and Gemma 4 31B) in Q4_K_M formats. Qwen 27B booted successfully with `-c 262144`. We need to run its benchmark and then move on to testing the Gemma 4 31B context bounding limit to see if it also fits 256K.
</current_state>
<completed_work>
- Task 1: Evaluate 122B Dual GPU vs Single GPU dynamics - Done
- Task 2: Prove physical memory bandwidth limits of DDR4 on MoE architecture - Done
- Task 3: Test Qwen 27B Dense max logic - In progress, booted successfully at -c 262144 inside 24GB VRAM
</completed_work>
<remaining_work>
- Task 3: Finish speed benchmark of Qwen 27B at 256K context.
- Task 4: Find maximum stable context for Gemma-4 31B Q4_K_M (17.0GB) and speed test.
</remaining_work>
<decisions_made>
- Concluded that hitting 20t/s on 122B Q4_K_M is physically impossible via system DDR4 RAM. The limit is ~10-12 t/s.
- Addressed `cudaMalloc failed` for dual GPU memory splitting. `n-cpu-moe` leaves a massive asymmetry that intrinsically fails to full-load dual 12GB VRAM cards efficiently.
- Pivoted entirely away from 122B and 35B optimization, redirecting efforts to dense models (27B and 31B) to guarantee speed and 256K context.
</decisions_made>
<blockers>
- None. Hardware limitations acknowledged and bounded.
</blockers>
<context>
The user demanded explicit proof and answers regarding hardware utilization and VRAM filling geometry. With those physically justified, they requested a shift to new assets (Qwen 27B, Gemma 4 31B). We found that 27B at Q4_K_M (15.5GB) fits 256K into the dual RTX 3060 perfectly.
</context>
<next_action>
Start with: Re-run `node scripts/find_max_dense.mjs` but make sure `CUDA_VISIBLE_DEVICES` correctly spans all GPUs or is explicitly blank (`$env:CUDA_VISIBLE_DEVICES=""`), to get the speed test output for Qwen 27B and Gemma 31B.
</next_action>

View File

@@ -0,0 +1,50 @@
# Phase 01: LLM Tuning — PLAN
## 목표
듀얼 RTX 3060 (24GB VRAM, 96GB DDR4) 환경에서 5가지 모델의 최적 추론 설정을 확정한다.
## 완료 태스크
### Task 1: Gemma 4 26B-A4B (Fast Tier) ✅
- 실측: **74.65 t/s** (AVG), 256K 컨텍스트
- 듀얼 GPU, 캐시 타입 f16, mlock 활성
- 전체 VRAM 적재 (16.8GB)
### Task 2: Qwen 3.5 35B-A3B (Balanced Tier) ✅
- 실측: **61.62 t/s** (AVG), 256K 컨텍스트
- 듀얼 GPU, tensor split 0.5/0.5, 캐시 q4_0
- 비대칭 스플릿 시 12+ t/s 하락 확인 → 0.5/0.5 확정
### Task 3: Gemma 4 31B Dense (Deep Coder) ✅
- 실측: **16.0 t/s** (AVG), 192K 컨텍스트 (한계)
- 듀얼 GPU, 전체 VRAM 적재
- 256K 시 OOM, 192K가 안정 최대값
### Task 4: Qwen 3.5 27B Dense (Deep Logic) ✅
- 실측: **16.7 t/s** (AVG), 256K 풀 컨텍스트
- 듀얼 GPU, tensor split 0.5/0.5
- System Prompt 누락 시 Empty Response 버그 확인
### Task 5: Qwen 3.5 122B-A10B MoE (Ultra Heavy) ✅
- 실측: **8.95 t/s** (BEST), 256K 컨텍스트
- **GPU 1 단독 사용** (-sm none --main-gpu 1)
- Expert CPU 오프로드 (n-cpu-moe=48)
- PCIe x4 병목 발견 → GPU 0 제외로 2배 속도 향상 (4.8 → 8.95 t/s)
## 핵심 발견사항 (Key Findings)
### GPU 0 PCIe x4 병목
- 메인보드: Gigabyte B550M AORUS ELITE
- GPU 0: PCIe 3.0 x4 (~4 GB/s) — 보조 슬롯
- GPU 1: PCIe 4.0 x16 (~32 GB/s) — 메인 슬롯
- MoE 모델처럼 CPU↔GPU 데이터 교환이 잦은 경우 GPU 0은 병목
- Dense 모델(VRAM 내 100% 적재)에서는 영향 미미
### 3-Tier → 5-Tier 전략 확장
- 원래 Fast/Balanced/Deep 3단계 → 5단계로 확장
- deep-coder (Gemma 4 31B)와 deep-logic (Qwen 27B) 추가
## 산출물
- `scripts/optimal_configs.py` — 실측값 레퍼런스 (deprecated → engine_models.json)
- `config/engine_models.json` — 프로덕션 설정 (Single Source of Truth)
- `scripts/_archive/results/` — 모든 벤치마크 결과 JSON

View File

@@ -0,0 +1,23 @@
# Phase 01: LLM Tuning — Verification Report
## 검증 결과
| # | 모델 | 역할 | 실측 속도 | 컨텍스트 | GPU 구성 | 상태 |
|:-:|------|------|:--------:|:-------:|----------|:----:|
| 1 | Gemma 4 26B-A4B Q4_K_M | fast | 74.65 t/s | 256K | 듀얼 | ✅ |
| 2 | Qwen 3.5 35B-A3B Q4_K_M | balanced | 61.62 t/s | 256K | 듀얼 | ✅ |
| 3 | Gemma 4 31B Dense Q4_K_M | deep-coder | 16.0 t/s | 192K | 듀얼 | ✅ |
| 4 | Qwen 3.5 27B Dense Q4_K_M | deep-logic | 16.7 t/s | 256K | 듀얼 | ✅ |
| 5 | Qwen 3.5 122B-A10B Q4_K_M | ultra | 8.95 t/s | 256K | GPU 1만 | ✅ |
## UAT 기준 달성 여부
- [x] Fast tier ≥ 70 t/s → **74.65 t/s**
- [x] Balanced tier ≥ 50 t/s → **61.62 t/s**
- [x] Deep tier 안정 구동 → **16.0 / 16.7 t/s**
- [x] Ultra tier 구동 가능 → **8.95 t/s**
- [x] 모든 모델 VRAM 12GB x 2 이내 → ✅
- [x] 최적 설정값 JSON으로 체계화 → `config/engine_models.json`
## Phase Status: ✅ COMPLETE
완료 일시: 2026-04-07