Files
QuantEngineByItz/spec/58_llm_determinism_contract.yaml
kjh2064 366a6da825 WBS-8.7: spec-코드 동기화 100% 완료
모든 spec 파일에 has_code_implementation 메타데이터 추가:
- 140개 spec 파일 중 100% 태깅 완료
- 코드 참조 자동 판정 (formula_registry, decision_flow, routing 등)
- tag_spec_code_implementation.py: 자동화 도구 추가

진행률: 66.4% → 100%

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-23 00:22:28 +09:00

112 lines
3.1 KiB
YAML

acceptance_criteria:
- all_decision_fields_precomputed: true
- all_tables_sorted_in_packet: true
- no_instruction_requires_arithmetic: true
authority: spec/58_llm_determinism_contract.yaml
code_path: tools/validate_llm_determinism_pack_v1.py
contract_id: H008_LLM_DETERMINISM_AUDIT
created_at: '2026-06-10T23:29:00+09:00'
hard_gates:
- condition: arithmetic_instruction_count == 0
gate_id: NO_ARITHMETIC_INSTRUCTION
on_fail: BLOCK_RELEASE
- condition: missing_sections == []
gate_id: ALL_SECTIONS_PRESENT
on_fail: BLOCK_RELEASE
- condition: precomputed_field_coverage_pct == 100.0
gate_id: PRECOMPUTED_COVERAGE
on_fail: BLOCK_RELEASE
harness_file: tools/validate_llm_determinism_pack_v1.py
has_code_implementation: true
inputs:
- field: final_context_for_llm_v5.yaml
required: true
source: Temp/final_context_for_llm_v5.yaml
lifecycle_state: active
meta:
has_code_implementation: false
output_fields:
- description: 누락된 required section 목록
name: missing_sections
type: list[str]
- description: LLM에게 계산을 요구하는 지시 건수
name: arithmetic_instruction_count
type: int
- description: 사전 계산된 필드 비율
name: precomputed_field_coverage_pct
type: float
- enum:
- PASS
- FAIL
name: gate
type: str
owner: pm
purpose: '저성능 LLM도 packet copy-only로 같은 결과를 렌더링할 만큼 final_context_for_llm이 충분히 사전
계산되어 있는지 검증한다. LLM에게 산술 연산을 요구하는 항목이 있으면 릴리즈를 차단한다.
'
required_precomputed_sections:
- must_contain:
- document_id
- generated_at_kst
- active_artifact_alias
section: 01_metadata_and_manifest_alias
- must_contain:
- total_asset_krw
- cash_ratio_pct
- goal_achievement_pct
section: 02_portfolio_health
- must_contain:
- blocked_tickers
- blocker_reasons
section: 03_hard_blockers
- must_contain:
- rank
- ticker
- sell_action
- sell_reason_code
note: 이미 정렬된 순서로 제공. LLM은 재정렬하지 않는다.
section: 04_sell_priority_table
- must_contain:
- ticker
- final_action
- entry_price
- stop_price
- quantity
section: 05_buy_hold_sell_action_table
- must_contain:
- available_cash_krw
- d2_cash_krw
- max_allowed_mdd_pct
section: 06_cash_and_risk_budget
- must_contain:
- formula_id
- lifecycle_state
- sample_n
- promotion_allowed
section: 07_shadow_ledger_visible_items
- must_contain:
- missing_field
- reason
section: 08_data_missing_items
- must_contain:
- regime_label
- regime_score
- position_scale_factor
section: 09_market_regime_summary_precomputed
- note: 사전 승인된 교육 노트만 포함. LLM이 신규 작성 금지.
section: 10_education_notes_preapproved
- must_contain:
- forbidden_phrases
- no_math_rule
section: 11_forbidden_phrases_and_no_math_rules
retirement_condition: 'LLM 파이프라인이 완전 결정론적 서버 사이드 렌더링으로 교체될 때까지 유효하다.
'
schema_version: llm_determinism_contract.v1
validation_rules:
- all_numeric_fields_precomputed: true
- all_tables_pre_sorted: true
- no_arithmetic_instruction_in_prompt: true
- llm_numeric_generation_count: 0