4티어(Seed-X-PPO-7B) 번역 경로가 모델 카드 요구사항을 어기고 있었다. - 프롬프트 끝의 `<ko>` 등 대상 언어 태그가 빠져 있었다. PPO 학습에 쓰인 신호라 없으면 번역 품질이 흔들린다. - Seed-X 는 chat template 없는 번역 전용 completion 모델인데 "구어체로 자연스럽게" 같은 지시문 래퍼를 씌우고 있었다. 학습 분포를 벗어난다. - 그 결과 MTSpec.supports_prompt_glossary=True 가 사실과 달랐다. Seed-X 는 용어집 지시문을 이해하지 못하므로 플레이스홀더 치환을 써야 한다. 수정 - PromptStyle(NONE/SEEDX/INSTRUCT) 도입, supports_prompt_glossary 를 prompt_style 에서 파생시켜 둘이 어긋날 수 없게 함 - build_seedx_prompt() 로 모델 카드 형식을 분리 (지시문 주입 불가) - INSTRUCT 경로는 chat template 사용, Qwen3 thinking 모드는 끔 - LANGUAGES 에 seedx 태그 명시 - finetune_mt.py 가 티어의 prompt_style 을 따라가게 해 학습/추론 프롬프트 일치 - AWQ Int4 로드 실패 시 autoawq 설치 안내를 담은 오류 메시지 검증: pytest 52개 통과 (프롬프트 회귀 테스트 13개 추가), ruff clean 근거: https://huggingface.co/ByteDance-Seed/Seed-X-PPO-7B Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
from hearo.models.tiers import (
|
|
DEFAULT_TIER,
|
|
TIERS,
|
|
MTBackend,
|
|
PromptStyle,
|
|
get_tier,
|
|
ordered_tiers,
|
|
)
|
|
|
|
|
|
def test_exactly_five_tiers_ordered_by_quality():
|
|
tiers = ordered_tiers()
|
|
assert len(tiers) == 5
|
|
assert [t.order for t in tiers] == [1, 2, 3, 4, 5]
|
|
|
|
|
|
def test_latency_and_vram_increase_monotonically():
|
|
tiers = ordered_tiers()
|
|
latencies = [t.approx_latency_s for t in tiers]
|
|
vram = [t.min_vram_gb for t in tiers]
|
|
assert latencies == sorted(latencies)
|
|
assert vram == sorted(vram)
|
|
|
|
|
|
def test_exactly_one_recommended_and_one_finetune_pick():
|
|
assert sum(t.recommended for t in TIERS.values()) == 1
|
|
assert sum(t.best_after_finetune for t in TIERS.values()) == 1
|
|
|
|
|
|
def test_only_instruct_models_support_prompt_glossary():
|
|
"""LLM이라고 다 되는 게 아니다 — 지시문을 이해하는 instruct 모델만 가능하다.
|
|
|
|
Seed-X 는 번역 전용 completion 모델이라 지시문을 넣으면 오히려 망가진다.
|
|
"""
|
|
for tier in TIERS.values():
|
|
expected = tier.mt.prompt_style is PromptStyle.INSTRUCT
|
|
assert tier.mt.supports_prompt_glossary is expected, tier.key
|
|
|
|
|
|
def test_seq2seq_backends_have_no_prompt_style():
|
|
for tier in TIERS.values():
|
|
if tier.mt.backend is MTBackend.CTRANSLATE2:
|
|
assert tier.mt.prompt_style is PromptStyle.NONE, tier.key
|
|
|
|
|
|
def test_unknown_key_falls_back_to_default():
|
|
assert get_tier("does-not-exist").key == DEFAULT_TIER
|
|
|
|
|
|
def test_default_tier_exists():
|
|
assert DEFAULT_TIER in TIERS
|