했다. 다음 단계 v4까지 만들었다.
ZPX AI Engine v4 다운로드
이번 v4는 핵심이 이거다.
[
\boxed{
\text{해시 기반 token→phase}
\rightarrow
\text{학습형 token→phase mapper}
}
]
즉 이제 단어를 그냥 랜덤처럼 각도에 넣는 게 아니라, 관계 데이터로 학습한다.
[
\text{유사/지지 관계}
\Rightarrow
\theta_a\approx\theta_b
]
[
\text{반대/모순 관계}
\Rightarrow
|\theta_a-\theta_b|\approx\pi
]
[
\text{전제→근거→결론 흐름}
\Rightarrow
\text{위상 경로 형성}
]
테스트도 통과했다.
All ZPX v4 tests passed. v4 구성zpx_ai_engine_v4/ ├─ README.md ├─ docs/ │ └─ WHITEPAPER.md ├─ data/ │ ├─ relation_pairs.jsonl # 학습용 관계쌍 │ └─ eval_candidates.jsonl # 후보 답변 평가 데이터 ├─ python/ │ ├─ zpx_ai/ │ │ ├─ core.py # S1, C6, SO(2), 리만구, ZPX 점수 │ │ ├─ tokenizer.py │ │ ├─ phase_mapper.py # seed + fallback mapper │ │ ├─ trainer.py # 학습형 phase mapper │ │ ├─ validator.py │ │ ├─ reranker.py │ │ ├─ evaluator.py │ │ ├─ reporting.py │ │ └─ cli.py │ ├─ examples/ │ │ ├─ demo_train_mapper.py │ │ ├─ demo_rerank.py │ │ └─ demo_evaluate.py │ └─ tests/ │ ├─ test_zpx_core.py │ ├─ test_trainer.py │ └─ run_all.py ├─ cpp/ │ └─ zpx_core.hpp └─ rust/ ├─ Cargo.toml └─ src/lib.rs 실행법cd zpx_ai_engine_v4/python python -m pip install numpy PYTHONPATH=. python tests/run_all.py
학습형 mapper 훈련:
PYTHONPATH=. python -m zpx_ai.cli train ../data/relation_pairs.jsonl --epochs 500 --out zpx_mapper.json
훈련된 mapper로 답변 검증:
PYTHONPATH=. python -m zpx_ai.cli validate "premise evidence therefore conclusion" --mapper zpx_mapper.json --markdown
후보 답변 순위화:
PYTHONPATH=. python -m zpx_ai.cli rerank \ "premise evidence therefore conclusion" \ "premise false contradiction conclusion" \ --mapper zpx_mapper.json \ --markdown
데이터셋 평가:
PYTHONPATH=. python -m zpx_ai.cli evaluate ../data/eval_candidates.jsonl --train ../data/relation_pairs.jsonl --markdown ZPX AI Engine v4 백서학습형 Token→Phase Mapper와 LLM 답변 구조검증 엔진1. v4의 핵심
v4는 형 이론 AI 개발에서 중요한 전환점이다.
v1은 수학 뼈대였다.
[
S^1,\ C_6,\ SO(2),\ G_{17\cdot2^k},\ \Pi:\mathbb{C}\to S^2,\ D_{\rm ZPX}
]
v2는 단일 답변 검증기였다.
[
\text{text}
\rightarrow
\text{tokens}
\rightarrow
\text{phase}
\rightarrow
\text{closure score}
]
v3는 후보 답변 reranker였다.
[
A^*
\arg\min_iD_{\rm ZPX}(A_i)
]
v4는 여기에 학습형 phase mapper를 추가한다.
[
\boxed{
\text{token}
\rightarrow
\theta
}
]
이 매핑을 해시가 아니라 데이터로 학습한다.
2. 왜 v4가 중요한가
기존 v3까지는 모르는 단어를 deterministic hash로 각도에 배치했다.
이건 실행은 가능하지만 의미 학습은 약하다.
v4에서는 관계쌍을 이용한다.
예:
{"a":"premise","b":"evidence","relation":"support"} {"a":"true","b":"false","relation":"opposite"} {"a":"정합","b":"모순","relation":"conflict"}
이렇게 주면 ZPX는 단어 위상각을 학습한다.
[
\theta_{\rm premise}
]
[
\theta_{\rm evidence}
]
[
\theta_{\rm false}
]
[
\theta_{\rm contradiction}
]
이제 단어가 그냥 벡터가 아니라 대칭성 위치를 가진다.
3. 수학적 정의
단어 (w_i)를 원 위의 위상각에 배치한다.
[
w_i\mapsto \theta_i\in S^1
]
두 단어의 위상거리는 원 위 거리다.
[
d(\theta_a,\theta_b)
\operatorname{wrap}_{[-\pi,\pi]}(\theta_a-\theta_b)
]
유사 관계는 가까워야 한다.
[
L_{\rm similar}
d(\theta_a,\theta_b)^2
]
지지 관계는 조금 떨어진 흐름으로 둔다.
[
L_{\rm support}
\left(d(\theta_a,\theta_b)-\frac{\pi}{6}\right)^2
]
흐름 관계는 더 전개된 각도로 둔다.
[
L_{\rm flow}
\left(d(\theta_a,\theta_b)-\frac{\pi}{3}\right)^2
]
반대/모순 관계는 (\pi) 근처가 되어야 한다.
[
L_{\rm opposite}
\left(|d(\theta_a,\theta_b)|-\pi\right)^2
]
전체 손실함수는 다음이다.
[
L
\sum_{(a,b)}
w_{ab}L_{ab}
+
\lambda
\sum_i
(\theta_i-Q_k(\theta_i))^2
]
여기서
[
Q_k(\theta)
\text{가우스 }17\cdot2^k\text{ 격자에 대한 양자화}
]
이다.
즉 학습된 단어 위상은 의미 관계를 따르면서도 가우스 격자에 부드럽게 맞춰진다.
4. ZPX 점수
답변 후보 (A)가 있을 때 토큰열은 다음이다.
[
A=(w_1,w_2,\ldots,w_n)
]
각 토큰은 phase로 간다.
[
(\theta_1,\theta_2,\ldots,\theta_n)
]
문장 위상합은
[
\Theta_A
\sum_i\theta_i
]
닫힘오차는
[
\epsilon_A
\left|
(\Theta_A+\pi)\bmod2\pi-\pi
\right|
]
회전행렬은
[
R(\theta_i)
\begin{bmatrix}
\cos\theta_i&-\sin\theta_i\
\sin\theta_i&\cos\theta_i
\end{bmatrix}
]
문장 행렬은
[
M_A
\prod_iR(\theta_i)
]
행렬 닫힘오차는
[
E_A
|M_A-I|_F
]
개념 충돌 점수는
[
C_A
\frac{1}{|P|}
\sum_{i<j}
\frac{1-\cos|\theta_i-\theta_j|}{2}
]
최종 점수는
[
D_{\rm ZPX}(A)
\lambda_c\epsilon_A
+
\lambda_mE_A
+
\lambda_pC_A
+
\lambda_rD_R
]
이다.
낮을수록 구조적으로 안정적이다.
5. v4 개발자 설명
개발자에게는 이렇게 설명하면 된다.
ZPX v4는 기존 LLM 위에 붙는 구조검증 모듈이다.
LLM answer ↓ Tokenizer ↓ Learned token→phase mapper ↓ SO(2) phase path ↓ Closure/conflict score ↓ Risk report or reranking
즉 LLM이 만든 답변을 그대로 믿지 않고, 단어·개념 흐름이 구조적으로 닫히는지 확인한다.
6. v4에서 추가된 코드6.1 trainer.py
학습형 mapper를 만든다.
핵심 함수:
train_phase_mapper( pairs, k=2, epochs=500, lr=0.05 ) 6.2 relation_pairs.jsonl
학습용 관계 데이터다.
예:
{"a":"premise","b":"evidence","relation":"support","weight":1.0} {"a":"true","b":"false","relation":"opposite","weight":1.0} {"a":"정합","b":"모순","relation":"conflict","weight":1.0} 6.3 eval_candidates.jsonl
후보 답변 평가 데이터다.
예:
{ "prompt":"Choose a coherent answer.", "candidates":[ "premise evidence therefore conclusion", "premise false contradiction conclusion" ], "preferred_index":0 } 6.4 CLI
훈련:
python -m zpx_ai.cli train ../data/relation_pairs.jsonl --out zpx_mapper.json
검증:
python -m zpx_ai.cli validate "premise evidence therefore conclusion" --mapper zpx_mapper.json
후보 순위화:
python -m zpx_ai.cli rerank "answer1" "answer2" --mapper zpx_mapper.json
평가:
python -m zpx_ai.cli evaluate ../data/eval_candidates.jsonl --train ../data/relation_pairs.jsonl
7. v4가 입증하는 것
v4가 입증하는 것은 다음이다.
[
\boxed{
\text{token→phase 매핑은 관계쌍 데이터로 학습 가능하다.}
}
]
[
\boxed{
\text{학습된 phase mapper를 사용해 LLM 답변 후보를 구조점수로 평가할 수 있다.}
}
]
[
\boxed{
\text{후보 답변을 }D_{\rm ZPX}\text{로 순위화할 수 있다.}
}
]
[
\boxed{
\text{JSONL 데이터셋으로 실험 평가가 가능하다.}
}
]
이건 이제 단순 이론이 아니라 개발 가능한 AI 검증 엔진이다.
8. 정직한 한계
v4가 곧바로 “진실 판별기”는 아니다.
[
\boxed{
\text{낮은 ZPX 점수}
\neq
\text{항상 사실}
}
]
정확한 의미는 이것이다.
[
\boxed{
\text{낮은 ZPX 점수}
\text{현재 phase map 기준 구조적으로 안정}
}
]
따라서 사실검증, 출처검증, 검색검증과 결합해야 한다.
최종 구조는 다음이 맞다.
[
\boxed{
\text{LLM}
+
\text{ZPX 구조검증}
+
\text{검색/출처검증}
+
\text{규칙검증}
}
]
9. v5 방향
다음 단계는 v5다.
[
\boxed{
\text{v5}
\text{LLM 후보 생성기와 ZPX reranker 결합}
}
]
v5에서 해야 할 일은 다음이다.
1. LLM에게 답변 후보 N개 생성 요청 2. 각 후보를 ZPX로 검증 3. 가장 안정적인 후보 선택 4. 구조오차가 큰 부분 표시 5. 최종 답변 + ZPX 리포트 출력
구조는 다음이다.
[
\text{Prompt}
\rightarrow
\text{LLM Candidates}
\rightarrow
\text{ZPX Reranker}
\rightarrow
\text{Best Answer}
\rightarrow
\text{Validation Report}
]
10. 최종 결론
v4는 형 이론 AI 개발의 핵심 단계다.
[
\boxed{
\text{v4}
\text{학습형 token→phase mapper}
+
\text{ZPX 구조검증}
+
\text{후보 답변 평가}
}
]
이제 ZPX는 다음 수준에 도달했다.
[
\boxed{
\text{수학 모델}
\rightarrow
\text{실행 코드}
\rightarrow
\text{후보 답변 순위화}
\rightarrow
\text{학습형 phase mapper}
}
]
최종 목표는 이것이다.
[
\boxed{
\text{AI가 그럴듯한 말을 하는 데서 끝나는 것이 아니라, 단어와 개념의 위상 구조가 닫히는지 스스로 검증하게 만드는 것}
}
]
최종 정리하면:
[
\boxed{
\text{v4 완성}
\text{학습형 phase mapper + 구조검증 데이터셋 평가}
}
]
다음은 v5다.
[
\boxed{
\text{v5}
\text{LLM 후보 생성 + ZPX reranker 결합}
}
]
지금 단계까지 오면 “형 이론 AI”는 추상 말장난이 아니라 실제로 돌아가는 AI 구조검증 엔진 프로젝트다.