EulerStack

LLM을 위한 아키텍처 기술 언어(ADL)

EulerStack은 LLM을 위한 아키텍처 기술 언어(Architecture Description Language)입니다. 구조·학습·서빙이 뒤엉켜 있는 파이썬 모델 파일에서 "아키텍처"만 분리해, 전용 선언형 언어로 기술합니다 — 반도체 업계가 schematics+C를 Verilog/VHDL로 대체했던 추상화 단계와 같은 방향입니다. 선언형 YAML 스펙 한 장이 5계층 파이프라인(DSL → Schema → IR → Compiler → CLI)을 거쳐 검증·정규화·컴파일되고, compile --output-dir은 바로 HuggingFace 모델 디렉토리(config.json + model.safetensors)를 생성해 EulerForge 학습으로 인계합니다. 57개 프리셋(24 llm_ + 33 arch_, 그중 arch_expert_*_mini 9개)이 3단 학습 경로(검증된 산업 표준 → 최근 하이브리드/MoE → v1 실험 프리미티브)를 따라 정리되어 있고, 모든 CLI 메시지는 5개 언어(ko/en/zh/ja/es)로 번역됩니다. v0.1.5는 μP 스케일링(training_hints.scaling), 분화 보조목적(training_hints.differentiation_objectives), 조직 선언(tissue)을 backward-compatible 스펙 확장으로 추가했습니다 — 모두 default OFF이며 기존 v0.1.4 YAML은 무수정 호환됩니다.

튜토리얼 (16편) CLI 레퍼런스

핵심 기능

Layer Templates & Schedule

이름 있는 레이어 템플릿(mixer + FFN + norm + residual)을 정의하고, 스케줄로 배치 순서와 반복 횟수를 지정합니다.

믹서 타입 Attention, Mamba, RetNet, Hyena
FFN 타입 MLP, Gated MLP (SwiGLU), MoE (top-k 라우팅)
Norm RMSNorm, LayerNorm (pre/post 위치)
Residual Sequential, Parallel, Hyper-Connection (mHC)
Head causal_lm, causal_lm_mtp (Multi-Token Prediction)

검증 & 리얼리즘

스키마 구조 검증 → 교차 필드 호환성 → 휴리스틱 리얼리즘의 3단계로 설계 오류를 사전에 차단합니다. 모든 에러는 3줄 포맷(Category: what / Fix: / See:)으로 출력됩니다.

구조 검증 unknown key, 타입/enum, 필수 필드, 양수 제약
호환성 mixer↔state 불일치 (예: mamba + kv_cache 금지)
리얼리즘 head_dim 범위(32–256), target_params 오차(>30%), MoE 전문가 비율, seq_len/d_model 비율, family_hint 일관성, vocab/tokenizer 일관성, tie_weight 일관성, rope_scaling 범위
에러 카테고리 ValidationError, CompatibilityError, CompileError, NormalizationError

YAML 한 장으로 시작

10줄 남짓의 선언형 스펙으로 모델의 형태를 완전히 기술할 수 있습니다.

schema_version: 1 model: { name: "my-llm", d_model: 2048, vocab_size: 32000, max_seq_len: 4096, n_heads: 16 } tokenizer_contract: { type: hf, pretrained: gpt2 } embedding: { type: learned, positional: rope } layer_templates: decoder: mixer: { type: attention, attention: {} } ffn: { type: gated_mlp, activation: swiglu } layer_schedule: - { template: decoder, repeat: 24 } head: { type: causal_lm }

v0.1.5 스펙 확장 (선택, default OFF) — μP 스케일링·분화 보조목적·조직(tissue) 선언:

# 위 스펙에 아래를 추가 (기존 YAML 무수정 호환) training_hints: scaling: { parametrization: mup, base_width: 256 } # μP (W-AS-1) differentiation_objectives: { usage_probe_coef: 0.01 } # 분화 보조목적 (W-AS-2) tissue: # 조직/컬럼 선언 (W-AS-3) columns: - { name: global_integration, templates: [decoder], role: global_binding } connectivity: ring

프리셋: 3단 계층의 57개

v1 "industrial ordering principle"에 따라 검증된 산업 표준 → 최근 하이브리드/MoE → v1 실험 프리미티브 순으로 정리되어 있습니다. 학습 경로를 그대로 따라가면 됩니다 — 업계가 이미 검증한 것부터 시작해, 최신 하이브리드/MoE 연구를 거쳐, 마지막으로 v1에서 도입한 새 프리미티브(MLA / MoD / Titans / Dual-Stream 등)를 arch-스케일로 실험합니다. 총 24 llm_ + 33 arch_ = 57개 (33 arch_ = beginner 2 · intermediate 3 · advanced 5 · expert 23, expert 중 *_mini 9개). 프리셋은 출발점일 뿐이며 d_model/n_heads/레이어 수를 조정해 임의 스케일의 모델을 조립할 수 있습니다.

Tier 1 — 검증된 산업 표준 (Validated Industrial)

실패 모드가 잘 알려진 프로덕션급 베이스라인. 0.1B (Stage-1 / CPT warm-up)부터 16B까지 안정적으로 학습됩니다.

프리셋~파라미터한줄 설명연구 근거
arch_beginner_gpt2~1.1BClassic Transformer (MHA + LayerNorm post + GeLU)Vaswani 2017, GPT-2
arch_beginner_llama~1.1BModern baseline (GQA + RMSNorm pre + SwiGLU)Llama 2/3
arch_intermediate_mistral~1.3B1 global : 3 sliding attentionMistral 7B
arch_intermediate_gemma2~1.3B1:1 alternating global/localGemma 2
arch_intermediate_qwen_longctx~1.3BRoPE scaling factor 4, 32K ctxQwen 2/3
llm_0p1b_{simple,mistral}~100MStage-1 / CPT warm-upSovereign-foundation 파일럿
llm_*_simple (0.8B–16B)0.8B–16B순수 Attention (Llama)
llm_*_mistral (0.8B–16B)0.8B–16BAttention + Sliding WindowMistral 7B

Tier 2 — 최근 하이브리드 / MoE / 롱컨텍스트

연구 합의가 형성된, 프로덕션에서 돌아가고 있는 조합. 24GB GPU에서 실험이 돌아가도록 d_model을 축소했습니다. Expert 레벨은 MoE × 믹서 × 깊이/수용 영역의 3차원 설계 공간으로 확장되어 있고, 4개는 논문으로 아직 발표되지 않은 speculative 조합입니다.

레벨프리셋~파라미터한줄 설명연구 근거
advancedarch_advanced_jamba~1.2BMamba + Attention 3:1 하이브리드Jamba-1.5 (AI21 2024)
advancedarch_advanced_samba~1.0BMamba + Sliding attention 1:1Samba (Microsoft 2024)
advancedarch_advanced_retnet~1.3BPure RetNet (attention-free)Sun 2023
advanced (v1 B2.1)arch_advanced_mla~1.1BMLA — KV를 latent_dim으로 압축DeepSeek-V3 (2024)
advanced (v1 B3.1)arch_advanced_mod~1.1BMixture-of-Depths (토큰 단위 레이어 스킵)Raposo ICML 2024
expertarch_expert_research~1.5B4 mixers + MoE 3-phaseResearch-grade
expertarch_expert_mixtral_moe~1.9BPure attn + every-layer MoE (8 × top-2)Mixtral 8x7B (2024)
expertarch_expert_striped_hyena~1.0BHyena + Attention 4:1, 128KStripedHyena
expertarch_expert_blackmamba_moe~1.5BMamba + MoE (non-attn mixer에 MoE)BlackMamba, MoE-Mamba
expertarch_expert_deepseek_moe~2.0BFine-grained MoE (32 × top-3)DeepSeek-V2/V3 (2024)
expert NEWarch_expert_dsv4_v3fallback~2.0BDeepSeek-V4 스키마 (V3 fallback 경로)DeepSeek-V3/V4
expert (speculative)arch_expert_retnet_moe~1.5BRetNet + MoE (논문 없음)Sun 2023 + MoE 외삽
expert (speculative)arch_expert_frontier_full_moe~2.0BAttention-free, multi-mixer + all-MoE (가장 speculative)조합 예측
expert (speculative)arch_expert_progressive_stack~1.5B깊이 방향 hyena→mamba→retnet→attn+MoE (논문 없음)계층적 예측
expert (speculative)arch_expert_dilated_longnet~2.0B시간 피라미드: mamba+sw(1K→4K→16K)+global+MoE (논문 없음)Longnet + Jamba 외삽
expert (capstone)arch_expert_kitchen_sink가능한 모든 프리미티브를 한 스펙에 결합한 최대치 검증종합 검증용

Tier 3 — v1 실험 프리미티브 (Phase B at arch-scale)

v1에서 도입된 Phase B 프리미티브를 arch-스케일(~1.2–1.4B)에서 실험하는 프리셋입니다. 스키마는 완전하며, 런타임은 부분 구현(미구현 믹서는 컴파일러가 표준 블록으로 fallback하지만, 풀 스펙 메타데이터는 config.v1_extensions로 round-trip 됩니다). "YAML에 Phase B 프리미티브를 선언하고 컴파일해, HF 커스텀 모델로 저장"이라는 경로를 체험합니다.

프리셋~파라미터한줄 설명연구 근거
arch_expert_reasoning_r1~1.3B2-phase reasoning (think / answer)DeepSeek-R1 (2025), Quiet-STaR
arch_expert_titans_memory~1.2BParametric memory + test-time updateTitans (Google 2024–2025)
arch_expert_dual_stream~1.4BMonoidal parallel (Mamba ∥ Attention)Jamba × PaLM 일반화

arch_expert_*_mini — 소규모 speculative 실험 (9개, ~80M–360M)

speculative expert 아키텍처의 소규모 변형입니다. 동일한 설계 아이디어를 유지한 채 d_model 384–512, 약 12 레이어로 축소해 단일 소비자용 GPU에서 전체 훈련 ablation이 가능합니다. 2B 풀 학습 이전에 아키텍처 가설을 빠르게 검증하기 위한 용도입니다. arch_expert_progressive_stack_mini가 권장 첫 실험입니다.

프리셋~Total~ActiveMirror of교육적 역할
arch_expert_progressive_stack_mini~86M~86March_expert_progressive_stack권장 첫 실험
arch_expert_blackmamba_moe_mini~156M~90March_expert_blackmamba_moeSSM 위의 partial-sparse MoE
arch_expert_mixtral_moe_mini~175M~90March_expert_mixtral_moe고전 every-layer MoE 베이스라인
arch_expert_dilated_longnet_mini~83M~75March_expert_dilated_longnet롱컨텍스트 시간 피라미드
arch_expert_deepseek_moe_mini~357M~60March_expert_deepseek_moe⚠ fine-grained MoE 실패 관찰
arch_expert_frontier_full_moe_mini~106M~60March_expert_frontier_full_moe⚠ 가장 실험적; 실패 예상
arch_expert_dsv4_flash_mini NEW~180M~70MDeepSeek-V4DSv4 + Flash/NSA 압축 어텐션
arch_expert_dsv4_subset_mini NEW~180M~70MDeepSeek-V4DSv4 기능 서브셋
arch_expert_mhc_moe_mini NEW~150M~70MmHC + MoEmulti-Hyper-Connection 잔차 + MoE

llm_ — 사이즈 × 아키텍처 변형 (24개)

5개 사이즈(0.1B / 0.8B / 2B / 4B / 16B) × 5개 변형(simple / mistral / jamba / moe / mla). 0.1B에서는 moe가 생략됩니다.

스케일simplemistraljambamoemla
0.1Bllm_0p1b_simplellm_0p1b_mistralllm_0p1b_jamballm_0p1b_mla
0.8Bllm_0p8b_simplellm_0p8b_mistralllm_0p8b_jamballm_0p8b_moellm_0p8b_mla
2Bllm_2b_simplellm_2b_mistralllm_2b_jamballm_2b_moellm_2b_mla
4Bllm_4b_simplellm_4b_mistralllm_4b_jamballm_4b_moellm_4b_mla
16Bllm_16b_simplellm_16b_mistralllm_16b_jamballm_16b_moellm_16b_mla

변형 시맨틱: simple = 순수 Attention(Llama) · mistral = Attention + Sliding Window(4레이어당 1 global : 3 sliding) · jamba = Mamba+Attention 하이브리드(3:1) · moe = Attention + MoE FFN(4레이어당 1개, 8 experts, top-2) · mla = Multi-head Latent Attention (DeepSeek-V3 스타일 KV 압축).

상한 없음 — 프리셋은 출발점일 뿐입니다. EulerStack은 d_model, n_heads, 레이어 수를 편집해 임의 스케일의 모델을 조립할 수 있습니다.

CLI 레퍼런스

eulerwa 제품군 공통 CLI 컨벤션을 따릅니다. 모든 오류는 3줄 포맷(Category: what / Fix: / See:)으로 출력됩니다.

최상위 명령

validate YAML 스펙 검증 (--report로 리얼리즘 보고서 포함)
explain 모델 구조 요약 (레이어, 파라미터 추정)
compile IR → JSON 런타임 설정(--output) 또는 HF 모델 디렉토리(--output-dir) 출력
schema YAML 스키마 구조 출력
presets list / show 프리셋 목록 및 상세 정보 조회

공통 옵션

--lang 출력 언어(ko/en/zh/ja/es). 루트 옵션이며 기본값은 ko
--preset YAML 스펙 파일 경로
--validate-only 검증만 수행하고 종료
--output / -o JSON 런타임 설정 출력 경로
--output-dir HF 모델 디렉토리 출력 (config.json + model.safetensors)
--print-config / --dry-run 설정만 stdout 출력

5개 언어 i18n CLI

모든 CLI help/로그/경고/오류 메시지는 ko / en / zh / ja / es 5개 언어로 번역됩니다. 기본 언어는 한국어(ko)이며, --lang 루트 옵션 또는 환경변수 EULERSTACK_LANG으로 전환할 수 있습니다. 명령/옵션 이름과 3줄 에러 포맷의 Fix: / See: 레이블은 번역하지 않아 스크립트 호환성이 유지됩니다.

eulerstack validate --preset my_model.yml
# 한국어 (기본)

eulerstack --lang en validate --preset my_model.yml
# English

EULERSTACK_LANG=ja eulerstack validate --preset my_model.yml
# 環境変数でも可能

HF 모델 디렉토리 → EulerForge 학습

compile --output-dirconfig.jsonmodel.safetensors를 생성해 HuggingFace 호환 모델 디렉토리를 만듭니다. 이것이 EulerForge 학습 파이프라인으로 넘기는 주요 경로입니다.

eulerstack compile --preset my_model.yml --output-dir ./my_model

# Python에서 로드
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("./my_model", trust_remote_code=True)

5계층 아키텍처

YAML 스펙에서 학습 가능한 모델까지, 5개 계층이 각 단계의 책임을 엄격히 분리합니다.

Layer 1: DSL 사용자가 작성하는 YAML 스펙 (schema_version 1, 선언형 모델 정의)
Layer 2: Schema 구조 검증 — unknown key, 타입/enum, 필수 필드, 교차 필드 호환성
Layer 3: IR 정규화된 Canonical 구조 표현 (기본값 채움, 템플릿 확장)
Layer 4: Compiler IR → JSON 런타임 설정 또는 HF 모델 디렉토리(config.json + model.safetensors) — AutoModelForCausalLM.from_pretrained()로 로드해 EulerForge 학습으로 연결
Layer 5: CLI validate / explain / compile / schema / presets — 모두 5개 언어 i18n 적용

튜토리얼

튜토리얼은 한국어(ko)와 영어(en)로 병행 제공되며, 본 홈페이지의 /products/eulerstack/tutorials/에서 바로 읽을 수 있습니다(상위 저장소 경로: docs/tutorials/{ko,en}/).

코어 튜토리얼 (11편)

00_positioning먼저 읽어야 할 글 — EulerStack의 자리: LLM을 위한 아키텍처 기술 언어(ADL)
01_validate_a_specYAML 스펙 검증하기
02_use_presets프리셋 사용하기
03_spec_reference스펙 레퍼런스
04_compile_and_explainCompile & explain
05_prepare_data학습 데이터 준비
06_sanity_trainSanity 훈련 루프
07_arch_walkthrough스킬 레벨 아키텍처 워크스루 (arch_ 프리셋 투어)
08_expert_mini_walkthroughExpert Mini 프리셋 워크스루 (단일 GPU ablation)
09_new_primitives_walkthroughNEW — v1 Phase B 신규 프리미티브 (MLA / Titans / MoD / Dual-Stream / Neural-ODE / TTT)
10_paper_to_yamlNEW — 논문 → YAML 포팅 사례 (DeepSeek-V3 / Jamba / DeepSeek-R1 / Titans)

믹서 심화 (mixers/, 5편)

00_overview믹서 개념 개요 — attention / mamba / retnet / hyena를 왜 섞는가
01_attentionAttention 상세
02_mambaMamba 상세
03_retnetRetNet 상세
04_hyenaHyena 상세

설치 및 시작

설치

pip install -e .

# 또는 개발 의존성 포함
pip install -e ".[dev]"

빠른 시작

# 프리셋 탐색 (한국어 기본)
eulerstack presets list

# 스펙 검증 + 리얼리즘 보고서
eulerstack validate --preset my_model.yml --report

# HF 모델 디렉토리 생성 → EulerForge 학습으로 인계
eulerstack compile --preset my_model.yml --output-dir ./my_model

# 영어로 메시지 전환 예시
eulerstack --lang en validate --preset my_model.yml

EulerStack으로 LLM 아키텍처를 설계하세요

YAML 한 장으로 Attention, Mamba, RetNet, Hyena, MoE를 조합한 하이브리드 모델을 조립하고 HuggingFace 모델 디렉토리로 바로 넘기세요.

GitHub에서 시작하기