AI-MO Kimina-Prover-72B: 수학 정리 증명 특화 LLM 완전 가이드
⏱️ 예상 읽기 시간: 20분
서론
AI-MO의 Kimina-Prover-72B는 수학 정리 증명과 논리적 추론에 특화된 72B 파라미터의 언어 모델입니다. Qwen2.5-72B를 기반으로 하여 수학 올림피아드 문제와 고급 수학 정리 증명에 최적화되었으며, 형식 논리와 자동 증명 시스템을 지원합니다.
핵심 특징
1. 수학 정리 증명 특화 설계
주요 성능 지표:
- 모델 크기: 72B 파라미터
- 기반 모델: Qwen2.5-72B
- 특화 분야: 수학 정리 증명, 논리적 추론, 형식 논리
- 지원 언어: 영어 (수학 표기법 포함)
2. 논리적 추론 시스템
# Kimina-Prover-72B 기본 설정
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
import sympy as sp
from sympy import symbols, solve, simplify, expand
class KiminaProverModel:
def __init__(self, model_path="AI-MO/Kimina-Prover-72B"):
self.model_path = model_path
self.device = "cuda" if torch.cuda.is_available() else "cpu"
self.mathematical_context = {
"proof_methods": ["direct", "contradiction", "induction", "contrapositive"],
"logical_operators": ["and", "or", "not", "implies", "iff"],
"mathematical_objects": ["numbers", "sets", "functions", "spaces"]
}
self.load_model()
def load_model(self):
"""모델 및 토크나이저 로드"""
self.model = AutoModelForCausalLM.from_pretrained(
self.model_path,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
self.tokenizer = AutoTokenizer.from_pretrained(
self.model_path,
trust_remote_code=True
)
def prove_theorem(self, theorem_statement, method="direct", max_tokens=2048):
"""정리 증명 생성"""
# 수학적 증명을 위한 특화 프롬프트
proof_prompt = f"""
다음 수학 정리를 증명해주세요:
정리: {theorem_statement}
증명 방법: {method}
다음 형식으로 엄밀한 증명을 제시해주세요:
1. 주어진 조건 및 정의 명시
2. 증명 전략 설명
3. 단계별 논리적 전개
4. 각 단계의 근거 제시
5. 결론 도출
수학적 기호와 표기법을 정확히 사용하고, 논리적 비약 없이 증명하세요.
"""
messages = [
{"role": "system", "content": "You are a mathematician specializing in formal theorem proving. Provide rigorous, step-by-step mathematical proofs."},
{"role": "user", "content": proof_prompt}
]
# 채팅 템플릿 적용
text = self.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# 입력 토큰화
model_inputs = self.tokenizer([text], return_tensors="pt").to(self.device)
# 증명 생성
with torch.no_grad():
generated_ids = self.model.generate(
**model_inputs,
max_new_tokens=max_tokens,
temperature=0.3, # 수학적 정확성을 위해 낮은 temperature
top_p=0.9,
do_sample=True,
pad_token_id=self.tokenizer.eos_token_id
)
# 응답 디코딩
generated_ids = [
output_ids[len(input_ids):]
for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
proof = self.tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
return proof
def verify_logical_reasoning(self, premise, conclusion):
"""논리적 추론 검증"""
verification_prompt = f"""
다음 논리적 추론이 타당한지 검증해주세요:
전제: {premise}
결론: {conclusion}
검증 항목:
1. 논리적 타당성 (validity)
2. 전제의 참/거짓 여부
3. 결론의 도출 과정
4. 논리적 오류 여부
5. 추론 규칙의 정확성
상세한 분석과 함께 결론을 제시하세요.
"""
verification = self.generate_mathematical_response(verification_prompt)
return verification
def generate_mathematical_response(self, query, max_tokens=1500):
"""수학적 응답 생성"""
messages = [
{"role": "system", "content": "You are an expert mathematician. Provide precise, rigorous mathematical explanations."},
{"role": "user", "content": query}
]
text = self.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = self.tokenizer([text], return_tensors="pt").to(self.device)
with torch.no_grad():
generated_ids = self.model.generate(
**model_inputs,
max_new_tokens=max_tokens,
temperature=0.4,
top_p=0.9,
do_sample=True,
pad_token_id=self.tokenizer.eos_token_id
)
generated_ids = [
output_ids[len(input_ids):]
for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = self.tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
return response
3. 형식 논리 시스템
class FormalLogicSystem:
def __init__(self, kimina_prover):
self.prover = kimina_prover
self.logic_notation = {
"and": "∧",
"or": "∨",
"not": "¬",
"implies": "→",
"iff": "↔",
"forall": "∀",
"exists": "∃",
"in": "∈",
"subset": "⊆",
"union": "∪",
"intersection": "∩"
}
def parse_formal_statement(self, statement):
"""형식 논리 명제 파싱"""
# 자연어를 형식 논리로 변환
formal_statement = statement
for word, symbol in self.logic_notation.items():
formal_statement = formal_statement.replace(word, symbol)
return formal_statement
def prove_formal_theorem(self, premises, conclusion, method="natural_deduction"):
"""형식 논리 정리 증명"""
formal_premises = [self.parse_formal_statement(p) for p in premises]
formal_conclusion = self.parse_formal_statement(conclusion)
proof_query = f"""
형식 논리 정리 증명:
전제들:
{chr(10).join([f" {i+1}. {p}" for i, p in enumerate(formal_premises)])}
결론: {formal_conclusion}
증명 방법: {method}
다음 형식으로 엄밀한 형식 논리 증명을 제시하세요:
1. 전제들의 형식화
2. 추론 규칙 명시
3. 단계별 논리적 전개
4. 각 단계에서 사용된 규칙 표시
5. 결론 도출
표준 논리 기호를 사용하고 추론 규칙을 정확히 적용하세요.
"""
formal_proof = self.prover.generate_mathematical_response(
proof_query,
max_tokens=2000
)
return {
"premises": formal_premises,
"conclusion": formal_conclusion,
"method": method,
"proof": formal_proof
}
def check_logical_validity(self, argument):
"""논리적 타당성 검증"""
validity_query = f"""
다음 논증의 논리적 타당성을 검증하세요:
논증: {argument}
검증 과정:
1. 논증 구조 분석
2. 전제와 결론 식별
3. 추론 형태 분류
4. 타당성 검증 (진리표 또는 자연 연역)
5. 건전성 평가
결론: 타당/부타당을 명확히 제시하고 근거를 설명하세요.
"""
validity_check = self.prover.generate_mathematical_response(
validity_query,
max_tokens=1500
)
return validity_check
수학 정리 증명 시스템
1. 자동 증명 엔진
import re
from typing import List, Dict, Any
import json
from datetime import datetime
class AutomaticTheoremProver:
def __init__(self, kimina_prover):
self.prover = kimina_prover
self.formal_logic = FormalLogicSystem(kimina_prover)
self.proof_strategies = [
"direct_proof",
"proof_by_contradiction",
"proof_by_induction",
"proof_by_contrapositive",
"proof_by_cases"
]
def prove_theorem_automatically(self, theorem, domain="general_mathematics"):
"""자동 정리 증명"""
print(f"🔍 자동 정리 증명 시작: {domain}")
# 1. 정리 분석
theorem_analysis = self.analyze_theorem(theorem)
# 2. 증명 전략 선택
best_strategy = self.select_proof_strategy(theorem_analysis)
# 3. 증명 생성
proof_result = self.generate_proof(theorem, best_strategy)
# 4. 증명 검증
verification_result = self.verify_proof(proof_result)
# 5. 결과 종합
final_result = self.compile_proof_result(
theorem, theorem_analysis, proof_result, verification_result
)
return final_result
def analyze_theorem(self, theorem):
"""정리 분석"""
analysis_query = f"""
다음 수학 정리를 분석해주세요:
정리: {theorem}
분석 항목:
1. 정리의 유형 (존재성, 유일성, 등가성, 부등식 등)
2. 주요 수학적 개념 및 정의
3. 전제 조건 및 가정
4. 증명해야 할 결론
5. 적용 가능한 증명 방법
6. 필요한 보조정리나 정의
7. 예상 난이도 및 복잡도
"""
analysis = self.prover.generate_mathematical_response(
analysis_query,
max_tokens=1200
)
return {
"raw_analysis": analysis,
"theorem_type": self.extract_theorem_type(analysis),
"difficulty": self.estimate_difficulty(analysis),
"required_concepts": self.extract_concepts(analysis)
}
def select_proof_strategy(self, theorem_analysis):
"""증명 전략 선택"""
strategy_query = f"""
정리 분석 결과:
{theorem_analysis['raw_analysis']}
이 정리를 증명하기 위한 최적의 전략을 선택하고 이유를 설명하세요:
가능한 전략:
1. 직접 증명 (Direct Proof)
2. 귀류법 (Proof by Contradiction)
3. 수학적 귀납법 (Mathematical Induction)
4. 대우 증명 (Proof by Contrapositive)
5. 경우 분석 (Proof by Cases)
선택 기준:
- 정리의 형태와 구조
- 증명의 자연스러움
- 복잡도 및 효율성
- 수학적 관례
"""
strategy_response = self.prover.generate_mathematical_response(
strategy_query,
max_tokens=800
)
# 전략 추출
selected_strategy = self.extract_strategy(strategy_response)
return {
"strategy": selected_strategy,
"reasoning": strategy_response
}
def generate_proof(self, theorem, strategy_info):
"""증명 생성"""
proof = self.prover.prove_theorem(
theorem,
method=strategy_info["strategy"],
max_tokens=2500
)
return {
"theorem": theorem,
"strategy": strategy_info["strategy"],
"proof": proof,
"timestamp": datetime.now().isoformat()
}
def verify_proof(self, proof_result):
"""증명 검증"""
verification_query = f"""
다음 수학 증명을 검증해주세요:
정리: {proof_result['theorem']}
증명 방법: {proof_result['strategy']}
증명:
{proof_result['proof']}
검증 항목:
1. 논리적 타당성
2. 수학적 엄밀성
3. 완전성 (모든 단계 포함)
4. 정확성 (계산 및 추론)
5. 명확성 (이해 가능성)
각 항목에 대해 평가하고 개선사항을 제시하세요.
"""
verification = self.prover.generate_mathematical_response(
verification_query,
max_tokens=1500
)
return {
"verification_result": verification,
"is_valid": self.assess_proof_validity(verification),
"improvements": self.extract_improvements(verification)
}
def compile_proof_result(self, theorem, analysis, proof, verification):
"""증명 결과 종합"""
return {
"theorem": theorem,
"analysis": analysis,
"proof": proof,
"verification": verification,
"quality_score": self.calculate_quality_score(verification),
"timestamp": datetime.now().isoformat()
}
def extract_theorem_type(self, analysis):
"""정리 유형 추출"""
type_indicators = {
"existence": ["존재", "exist", "there exists"],
"uniqueness": ["유일", "unique", "only one"],
"equivalence": ["동치", "equivalent", "if and only if"],
"inequality": ["부등식", "inequality", "greater", "less"]
}
for theorem_type, indicators in type_indicators.items():
if any(indicator in analysis.lower() for indicator in indicators):
return theorem_type
return "general"
def estimate_difficulty(self, analysis):
"""난이도 추정"""
difficulty_indicators = {
"high": ["복잡", "어려운", "고급", "challenging", "complex"],
"medium": ["중간", "보통", "moderate", "intermediate"],
"low": ["간단", "쉬운", "기초", "simple", "basic"]
}
for level, indicators in difficulty_indicators.items():
if any(indicator in analysis.lower() for indicator in indicators):
return level
return "medium"
def extract_concepts(self, analysis):
"""필요 개념 추출"""
# 간단한 키워드 추출
math_keywords = ["함수", "집합", "수열", "극한", "미분", "적분", "행렬", "벡터"]
concepts = []
for keyword in math_keywords:
if keyword in analysis:
concepts.append(keyword)
return concepts
def extract_strategy(self, strategy_response):
"""전략 추출"""
strategy_map = {
"직접": "direct_proof",
"귀류": "proof_by_contradiction",
"귀납": "proof_by_induction",
"대우": "proof_by_contrapositive",
"경우": "proof_by_cases"
}
for korean, english in strategy_map.items():
if korean in strategy_response:
return english
return "direct_proof" # 기본값
def assess_proof_validity(self, verification):
"""증명 유효성 평가"""
positive_indicators = ["타당", "올바른", "정확", "valid", "correct"]
negative_indicators = ["부타당", "잘못된", "오류", "invalid", "incorrect"]
positive_count = sum(1 for indicator in positive_indicators if indicator in verification.lower())
negative_count = sum(1 for indicator in negative_indicators if indicator in verification.lower())
return positive_count > negative_count
def extract_improvements(self, verification):
"""개선사항 추출"""
improvement_indicators = ["개선", "수정", "보완", "추가", "improve", "fix"]
improvements = []
for indicator in improvement_indicators:
if indicator in verification.lower():
improvements.append(f"{indicator} 관련 개선사항 식별됨")
return improvements
def calculate_quality_score(self, verification):
"""품질 점수 계산"""
quality_keywords = ["우수", "좋은", "명확", "엄밀", "excellent", "good", "clear", "rigorous"]
quality_count = sum(1 for keyword in quality_keywords if keyword in verification["verification_result"].lower())
return min(quality_count / 4.0, 1.0) # 0~1 범위로 정규화
2. 수학 올림피아드 문제 해결
class MathOlympiadSolver:
def __init__(self, kimina_prover):
self.prover = kimina_prover
self.auto_prover = AutomaticTheoremProver(kimina_prover)
self.olympiad_types = [
"number_theory",
"algebra",
"geometry",
"combinatorics",
"functional_equations",
"inequalities"
]
def solve_olympiad_problem(self, problem, problem_type="unknown"):
"""올림피아드 문제 해결"""
print(f"🏆 올림피아드 문제 해결 시작: {problem_type}")
# 1. 문제 분석
problem_analysis = self.analyze_olympiad_problem(problem)
# 2. 해결 전략 수립
solution_strategy = self.develop_solution_strategy(problem_analysis)
# 3. 단계별 해결
solution_steps = self.execute_solution_steps(solution_strategy)
# 4. 해답 검증
verification = self.verify_solution(solution_steps)
# 5. 최종 답안 작성
final_answer = self.compile_final_answer(
problem, problem_analysis, solution_steps, verification
)
return final_answer
def analyze_olympiad_problem(self, problem):
"""올림피아드 문제 분석"""
analysis_query = f"""
다음 수학 올림피아드 문제를 분석해주세요:
문제: {problem}
분석 항목:
1. 문제 유형 (정수론, 대수, 기하, 조합론 등)
2. 핵심 개념 및 정리
3. 문제의 난이도 및 복잡도
4. 일반적인 해결 접근법
5. 필요한 보조정리나 기법
6. 예상 해결 시간
7. 함정이나 주의사항
"""
analysis = self.prover.generate_mathematical_response(
analysis_query,
max_tokens=1200
)
return {
"raw_analysis": analysis,
"problem_type": self.classify_problem_type(analysis),
"difficulty": self.estimate_olympiad_difficulty(analysis),
"key_concepts": self.extract_key_concepts(analysis)
}
def develop_solution_strategy(self, problem_analysis):
"""해결 전략 수립"""
strategy_query = f"""
문제 분석 결과:
{problem_analysis['raw_analysis']}
이 올림피아드 문제에 대한 상세한 해결 전략을 수립하세요:
1. 주요 접근법 및 기법
2. 단계별 해결 계획
3. 각 단계의 목표와 방법
4. 예상 난관 및 대응 방안
5. 대안적 접근법
6. 검증 방법
"""
strategy = self.prover.generate_mathematical_response(
strategy_query,
max_tokens=1500
)
return {
"strategy": strategy,
"approach": self.extract_main_approach(strategy),
"steps": self.extract_solution_steps(strategy)
}
def execute_solution_steps(self, solution_strategy):
"""해결 단계 실행"""
execution_results = []
for i, step in enumerate(solution_strategy["steps"]):
step_query = f"""
올림피아드 문제 해결 단계 {i+1}:
단계: {step}
이 단계를 자세히 실행하세요:
1. 단계의 목적 및 목표
2. 사용할 수학적 기법
3. 구체적인 계산 과정
4. 중간 결과 및 관찰
5. 다음 단계로의 연결
"""
step_result = self.prover.generate_mathematical_response(
step_query,
max_tokens=1000
)
execution_results.append({
"step": i + 1,
"description": step,
"execution": step_result,
"timestamp": datetime.now().isoformat()
})
return execution_results
def verify_solution(self, solution_steps):
"""해답 검증"""
solution_summary = "\n".join([
f"단계 {step['step']}: {step['execution']}"
for step in solution_steps
])
verification_query = f"""
다음 올림피아드 문제 해답을 검증해주세요:
해답:
{solution_summary}
검증 항목:
1. 수학적 정확성
2. 논리적 연결성
3. 계산 검증
4. 완전성 확인
5. 우아함 및 효율성
6. 대안적 검증 방법
검증 결과와 함께 개선사항을 제시하세요.
"""
verification = self.prover.generate_mathematical_response(
verification_query,
max_tokens=1500
)
return {
"verification": verification,
"is_correct": self.assess_solution_correctness(verification),
"confidence": self.calculate_confidence(verification)
}
def compile_final_answer(self, problem, analysis, solution_steps, verification):
"""최종 답안 작성"""
final_query = f"""
올림피아드 문제의 최종 답안을 작성하세요:
문제: {problem}
해결 과정 요약:
{json.dumps([step['execution'] for step in solution_steps], indent=2, ensure_ascii=False)}
검증 결과:
{verification['verification']}
다음 형식으로 최종 답안을 작성하세요:
1. 문제 요약
2. 핵심 아이디어
3. 상세한 풀이 과정
4. 최종 답
5. 추가 설명 (필요시)
올림피아드 답안지 형식에 맞게 명확하고 우아하게 작성하세요.
"""
final_answer = self.prover.generate_mathematical_response(
final_query,
max_tokens=2000
)
return {
"problem": problem,
"analysis": analysis,
"solution_steps": solution_steps,
"verification": verification,
"final_answer": final_answer,
"timestamp": datetime.now().isoformat()
}
def classify_problem_type(self, analysis):
"""문제 유형 분류"""
type_keywords = {
"number_theory": ["정수", "소수", "나머지", "합동", "integer", "prime"],
"algebra": ["방정식", "부등식", "다항식", "equation", "polynomial"],
"geometry": ["삼각형", "원", "각", "길이", "넓이", "triangle", "circle"],
"combinatorics": ["조합", "순열", "경우의 수", "combination", "permutation"],
"functional_equations": ["함수방정식", "functional equation"],
"inequalities": ["부등식", "inequality", "최대", "최소", "maximum", "minimum"]
}
for problem_type, keywords in type_keywords.items():
if any(keyword in analysis.lower() for keyword in keywords):
return problem_type
return "general"
def estimate_olympiad_difficulty(self, analysis):
"""올림피아드 난이도 추정"""
difficulty_map = {
"IMO": "매우 어려움",
"국가대표": "어려움",
"지역": "보통",
"학교": "쉬움"
}
# 키워드 기반 난이도 추정
if any(keyword in analysis for keyword in ["IMO", "국제", "매우 어려운"]):
return "IMO"
elif any(keyword in analysis for keyword in ["국가", "어려운"]):
return "국가대표"
elif any(keyword in analysis for keyword in ["지역", "보통"]):
return "지역"
else:
return "학교"
def extract_key_concepts(self, analysis):
"""핵심 개념 추출"""
concepts = []
concept_indicators = [
"피타고라스", "페르마", "오일러", "가우스", "베주", "디오판토스",
"삼각부등식", "산술기하평균", "코시-슈바르츠", "젠센부등식"
]
for concept in concept_indicators:
if concept in analysis:
concepts.append(concept)
return concepts
def extract_main_approach(self, strategy):
"""주요 접근법 추출"""
approaches = [
"직접 계산", "귀납법", "모순법", "구성적 증명", "비둘기집 원리",
"생성함수", "그래프 이론", "확률론적 방법"
]
for approach in approaches:
if approach in strategy:
return approach
return "직접적 접근법"
def extract_solution_steps(self, strategy):
"""해결 단계 추출"""
# 간단한 단계 추출 로직
steps = []
lines = strategy.split('\n')
for line in lines:
if any(keyword in line for keyword in ['단계', '절차', '방법', '과정']):
steps.append(line.strip())
return steps if steps else ["문제 분석", "해결 과정", "답 도출", "검증"]
def assess_solution_correctness(self, verification):
"""해답 정확성 평가"""
correct_indicators = ["정확", "올바른", "맞음", "correct", "right"]
incorrect_indicators = ["부정확", "틀린", "잘못", "incorrect", "wrong"]
correct_count = sum(1 for indicator in correct_indicators if indicator in verification.lower())
incorrect_count = sum(1 for indicator in incorrect_indicators if indicator in verification.lower())
return correct_count > incorrect_count
def calculate_confidence(self, verification):
"""신뢰도 계산"""
confidence_keywords = ["확신", "자신", "명확", "확실", "confident", "certain"]
confidence_count = sum(1 for keyword in confidence_keywords if keyword in verification["verification"].lower())
return min(confidence_count / 3.0, 1.0)
실전 활용 예제
1. 고급 정리 증명 데모
def advanced_theorem_proving_demo():
"""고급 정리 증명 데모"""
kimina = KiminaProverModel()
auto_prover = AutomaticTheoremProver(kimina)
# 고급 수학 정리
theorem = """
임의의 실수 a, b, c에 대해 a + b + c = 0이면,
a³ + b³ + c³ = 3abc가 성립함을 증명하시오.
"""
print("🧮 고급 정리 증명 시작...")
# 자동 증명 수행
proof_result = auto_prover.prove_theorem_automatically(
theorem,
domain="algebra"
)
print("📝 증명 결과:")
print(f"정리: {proof_result['theorem']}")
print(f"난이도: {proof_result['analysis']['difficulty']}")
print(f"증명 전략: {proof_result['proof']['strategy']}")
print(f"품질 점수: {proof_result['quality_score']:.3f}")
print("\n🔍 증명 내용:")
print(proof_result['proof']['proof'])
# 추가 검증
formal_logic = FormalLogicSystem(kimina)
validity_check = formal_logic.check_logical_validity(
proof_result['proof']['proof']
)
print("\n✅ 논리적 타당성 검증:")
print(validity_check)
return proof_result
def olympiad_problem_demo():
"""올림피아드 문제 해결 데모"""
kimina = KiminaProverModel()
olympiad_solver = MathOlympiadSolver(kimina)
# 올림피아드 문제 예제
problem = """
양의 정수 n에 대해 n² + n + 1이 완전제곱수가 되는 모든 n을 구하시오.
"""
print("🏆 올림피아드 문제 해결 시작...")
# 문제 해결 수행
solution_result = olympiad_solver.solve_olympiad_problem(
problem,
problem_type="number_theory"
)
print("📊 해결 결과:")
print(f"문제 유형: {solution_result['analysis']['problem_type']}")
print(f"난이도: {solution_result['analysis']['difficulty']}")
print(f"정확성: {solution_result['verification']['is_correct']}")
print(f"신뢰도: {solution_result['verification']['confidence']:.3f}")
print("\n🎯 최종 답안:")
print(solution_result['final_answer'])
return solution_result
if __name__ == "__main__":
# 고급 정리 증명 데모
theorem_result = advanced_theorem_proving_demo()
print("\n" + "="*50 + "\n")
# 올림피아드 문제 해결 데모
olympiad_result = olympiad_problem_demo()
2. 수학 교육 도구
class MathEducationTool:
def __init__(self, kimina_prover):
self.prover = kimina_prover
self.difficulty_levels = ["beginner", "intermediate", "advanced", "expert"]
def generate_learning_pathway(self, topic, student_level="intermediate"):
"""학습 경로 생성"""
pathway_query = f"""
수학 주제: {topic}
학생 수준: {student_level}
이 주제에 대한 체계적인 학습 경로를 생성하세요:
1. 선수 지식 및 개념
2. 단계별 학습 내용
3. 핵심 정리 및 증명
4. 연습 문제 및 예제
5. 응용 분야 및 확장
6. 평가 방법
각 단계별로 구체적인 내용과 학습 목표를 제시하세요.
"""
pathway = self.prover.generate_mathematical_response(
pathway_query,
max_tokens=2000
)
return {
"topic": topic,
"level": student_level,
"pathway": pathway,
"estimated_duration": self.estimate_learning_duration(pathway)
}
def create_practice_problems(self, topic, difficulty="intermediate", count=5):
"""연습 문제 생성"""
problems_query = f"""
주제: {topic}
난이도: {difficulty}
문제 수: {count}
이 주제에 대한 연습 문제를 생성하세요:
각 문제에 대해:
1. 명확한 문제 설명
2. 해결 방법 힌트
3. 단계별 풀이 과정
4. 최종 답안
5. 추가 설명 (필요시)
난이도를 점진적으로 증가시켜 주세요.
"""
problems = self.prover.generate_mathematical_response(
problems_query,
max_tokens=2500
)
return {
"topic": topic,
"difficulty": difficulty,
"problems": problems,
"problem_count": count
}
def explain_proof_technique(self, technique):
"""증명 기법 설명"""
technique_query = f"""
증명 기법: {technique}
이 증명 기법에 대해 자세히 설명하세요:
1. 기법의 정의 및 원리
2. 언제 사용하는가
3. 단계별 적용 방법
4. 구체적인 예제
5. 주의사항 및 함정
6. 관련 기법과의 비교
7. 연습 문제
초보자도 이해할 수 있도록 명확하게 설명하세요.
"""
explanation = self.prover.generate_mathematical_response(
technique_query,
max_tokens=2000
)
return {
"technique": technique,
"explanation": explanation,
"examples": self.extract_examples(explanation)
}
def estimate_learning_duration(self, pathway):
"""학습 기간 추정"""
# 간단한 추정 로직
content_length = len(pathway)
if content_length > 2000:
return "4-6주"
elif content_length > 1500:
return "3-4주"
elif content_length > 1000:
return "2-3주"
else:
return "1-2주"
def extract_examples(self, explanation):
"""예제 추출"""
examples = []
lines = explanation.split('\n')
for line in lines:
if '예제' in line or 'Example' in line:
examples.append(line.strip())
return examples if examples else ["예제 추출 필요"]
성능 평가 및 벤치마킹
1. 수학 능력 평가 시스템
class MathematicalCapabilityEvaluator:
def __init__(self, kimina_prover):
self.prover = kimina_prover
self.evaluation_categories = [
"theorem_proving",
"problem_solving",
"logical_reasoning",
"computational_accuracy",
"proof_verification"
]
def run_comprehensive_evaluation(self):
"""종합 수학 능력 평가"""
print("🔬 종합 수학 능력 평가 시작...")
evaluation_results = {}
# 각 카테고리별 평가
for category in self.evaluation_categories:
category_score = self.evaluate_category(category)
evaluation_results[category] = category_score
print(f" {category}: {category_score:.3f}")
# 전체 점수 계산
overall_score = sum(evaluation_results.values()) / len(evaluation_results)
evaluation_results["overall"] = overall_score
print(f"\n📊 전체 점수: {overall_score:.3f}")
# 상세 분석
detailed_analysis = self.analyze_performance(evaluation_results)
return {
"scores": evaluation_results,
"analysis": detailed_analysis,
"timestamp": datetime.now().isoformat()
}
def evaluate_category(self, category):
"""카테고리별 평가"""
test_problems = self.get_test_problems(category)
correct_count = 0
for problem in test_problems:
try:
solution = self.prover.generate_mathematical_response(
problem["query"],
max_tokens=1500
)
# 답안 평가
is_correct = self.evaluate_solution(solution, problem["expected"])
if is_correct:
correct_count += 1
except Exception as e:
print(f"문제 해결 실패: {e}")
return correct_count / len(test_problems)
def get_test_problems(self, category):
"""카테고리별 테스트 문제"""
problems = {
"theorem_proving": [
{
"query": "√2가 무리수임을 증명하시오.",
"expected": "귀류법을 사용한 증명"
},
{
"query": "소수가 무한히 많음을 증명하시오.",
"expected": "유클리드의 증명"
}
],
"problem_solving": [
{
"query": "2x + 3y = 7, 3x - 2y = 4를 만족하는 x, y를 구하시오.",
"expected": "x = 2, y = 1"
},
{
"query": "삼각형의 한 변이 5, 다른 변이 12일 때 빗변의 길이는?",
"expected": "13"
}
],
"logical_reasoning": [
{
"query": "모든 A는 B이고, 모든 B는 C이면, 모든 A는 C인가?",
"expected": "참 (삼단논법)"
},
{
"query": "P → Q가 참이고 Q가 거짓이면 P는?",
"expected": "거짓 (modus tollens)"
}
],
"computational_accuracy": [
{
"query": "∫(x² + 2x + 1)dx를 계산하시오.",
"expected": "x³/3 + x² + x + C"
},
{
"query": "lim(x→0) (sin x)/x의 값은?",
"expected": "1"
}
],
"proof_verification": [
{
"query": "다음 증명이 올바른가? '모든 짝수는 2의 배수이다. 4는 짝수이다. 따라서 4는 2의 배수이다.'",
"expected": "올바름 (modus ponens)"
}
]
}
return problems.get(category, [])
def evaluate_solution(self, solution, expected):
"""해답 평가"""
# 간단한 키워드 기반 평가
expected_keywords = expected.lower().split()
solution_lower = solution.lower()
match_count = sum(1 for keyword in expected_keywords if keyword in solution_lower)
return match_count >= len(expected_keywords) * 0.7 # 70% 이상 매칭
def analyze_performance(self, results):
"""성능 분석"""
analysis = {
"strengths": [],
"weaknesses": [],
"recommendations": []
}
# 강점 분석
for category, score in results.items():
if category != "overall" and score >= 0.8:
analysis["strengths"].append(f"{category}: {score:.3f}")
# 약점 분석
for category, score in results.items():
if category != "overall" and score < 0.6:
analysis["weaknesses"].append(f"{category}: {score:.3f}")
# 추천사항
if results["overall"] >= 0.8:
analysis["recommendations"].append("전반적으로 우수한 성능")
elif results["overall"] >= 0.6:
analysis["recommendations"].append("양호한 성능, 일부 개선 필요")
else:
analysis["recommendations"].append("전반적인 성능 개선 필요")
return analysis
결론
AI-MO의 Kimina-Prover-72B는 수학 정리 증명과 논리적 추론에 특화된 강력한 언어 모델입니다. 72B 파라미터의 규모와 Qwen2.5 기반의 견고한 아키텍처를 통해 복잡한 수학적 문제를 체계적으로 해결할 수 있습니다.
핵심 장점
- 정리 증명 특화: 형식적이고 엄밀한 수학 증명 생성
- 논리적 추론: 체계적인 논리 구조와 추론 체계
- 올림피아드 수준: 고난도 수학 문제 해결 능력
- 교육 도구: 수학 학습 및 교육 지원 기능
- 자동화: 증명 과정의 자동화 및 검증
활용 분야
- 수학 연구: 고급 정리 증명 및 수학적 발견
- 교육: 수학 개념 설명 및 학습 지원
- 올림피아드: 수학 경시대회 문제 해결
- 형식 검증: 논리적 타당성 검증 및 형식 증명
Kimina-Prover-72B를 통해 수학적 추론의 새로운 가능성을 탐험하고, AI의 도움으로 더 깊이 있는 수학적 이해를 구축할 수 있습니다.
참고 자료: