bbkdevops's picture
download
raw
4.53 kB
"""Build evidence for TinyMind Evo learning beyond memory replay."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
from model.evo_learning import EvoLearningLoop, EvoLearningSeed
def _default_seeds() -> list[EvoLearningSeed]:
return [
EvoLearningSeed(
skill="thai_math_grounding",
failure_prompt="คำนวณ VAT 7% ของ 1,250 บาท แล้วอธิบายเป็นภาษาไทย",
failed_answer="ภาษีคือ 7 บาท",
expected_property="must calculate percentage and explain method",
),
EvoLearningSeed(
skill="tool_grounding",
failure_prompt="เรียก tool เพื่ออ่านไฟล์แบบ read-only แล้วสรุปผล",
failed_answer="ฉันอ่านไฟล์แล้ว",
expected_property="must emit valid tool schema before claiming observation",
),
EvoLearningSeed(
skill="fixed_phrase",
failure_prompt="ตอบคำถามใหม่ให้ตรงคำถาม ไม่ใช้ประโยคตายตัว",
failed_answer="Use the expected structured tool call exactly as specified by the schema.\n"
"Use the expected structured tool call exactly as specified by the schema.",
expected_property="must avoid fixed repeated phrase",
),
EvoLearningSeed(
skill="thai_english_translation",
failure_prompt="แปลประโยคเทคนิคภาษาไทยเป็นอังกฤษโดยรักษาความหมายและน้ำเสียง",
failed_answer="Translate it literally.",
expected_property="must preserve meaning, register, and technical terms across Thai and English",
),
EvoLearningSeed(
skill="code_reasoning",
failure_prompt="หาบักในฟังก์ชัน Python แล้วเสนอ patch พร้อม test",
failed_answer="โค้ดดูถูกแล้ว",
expected_property="must reason from failing behavior to minimal patch and regression test",
),
EvoLearningSeed(
skill="math_invariant",
failure_prompt="พิสูจน์ invariant ของลูปที่ลดค่า n จนเป็นศูนย์",
failed_answer="คำตอบคือจริงเพราะมันวนลูป",
expected_property="must state invariant, base case, preservation, and termination",
),
EvoLearningSeed(
skill="retrieval_grounding",
failure_prompt="ตอบข้อมูลปัจจุบันโดยไม่ค้นหลักฐานภายนอก",
failed_answer="ฉันคิดว่าน่าจะใช่",
expected_property="must retrieve or cite evidence before making current factual claims",
),
EvoLearningSeed(
skill="cnn_feature_grounding",
failure_prompt="อธิบายรูปแบบ local pattern ใน token stream โดยไม่อ้าง evidence",
failed_answer="แพทเทิร์นมันดี",
expected_property="must identify local feature evidence before summary",
),
]
def build_evo_learning_report(out_dir: str | Path) -> dict[str, Any]:
out = Path(out_dir)
out.mkdir(parents=True, exist_ok=True)
report = EvoLearningLoop().run(_default_seeds())
report["report_path"] = str(out / "evo_learning_report.json")
report["lesson_manifest_path"] = str(out / "promoted_lessons.json")
lesson_manifest = {
"schema_version": "tinymind-promoted-evo-lessons-v1",
"lessons": report["promoted_lessons"],
"claim_boundary": {
"self_learning_real": report["claim_gate"]["self_learning_real"],
"not_memory_replay": report["claim_gate"]["memory_replay_rejected"],
"world_best_claim_allowed": False,
},
}
(out / "evo_learning_report.json").write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
(out / "promoted_lessons.json").write_text(json.dumps(lesson_manifest, ensure_ascii=False, indent=2), encoding="utf-8")
return report

Xet Storage Details

Size:
4.53 kB
·
Xet hash:
1dfc9311eace8e4c2b4386ea5daae8a3e0aef2dbf2b39d0c5dcde615196787fb

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.