# CHO-FAM 3주차 · Probability + Metrics

> **현재 위치:** 1개월차 3주차  
> **핵심 연구질문:** 확률적인 AI 출력과 운영 결과를 어떤 관찰 단위와 지표로 측정해야 CHO-FAM의 개선 여부를 재현 가능하게 판단할 수 있는가?

[전체 커리큘럼](https://cho-fam.com/docs/cho-fam-ai-curriculum.html) · [1개월차 상세](https://cho-fam.com/docs/curriculum/month-01.html) · [2주차](https://cho-fam.com/docs/curriculum/week-02.html) · [3주차 HTML](https://cho-fam.com/docs/curriculum/week-03.html) · [Markdown 원문](https://cho-fam.com/docs/curriculum/week-03.md)

## 학습 결과

[3주차 학습 리포트](reports/week-03-study-report.html) · [Markdown 원문](reports/week-03-study-report.md)

대화형 학습의 설계 판단이며 실제 구현·실험 증거와 구분합니다.

## 목차

1. [이전 주 연결](#1-이전-주-연결)
2. [이번 주 목표](#2-이번-주-목표)
3. [시간표](#3-시간표--기본-10시간)
4. [교재와 읽을 자료](#4-교재와-읽을-자료)
5. [구현 과제](#5-구현-과제--measurement-harness-v01)
6. [실험·평가](#6-실험평가)
7. [주간 산출물](#7-주간-산출물)
8. [완료 기준](#8-완료-기준과-회고-질문)
9. [12개월·48주 탐색](#9-12개월48주-탐색)

## 1. 이전 주 연결

1–2주차의 정규 학습성과는 완료된 선수 지식으로 간주한다. 특히 Workflow/Agent 구분, deterministic policy·validator의 역할, Human·Agent·Knowledge·Workflow 경계와 계약, C4 Context/Container 수준의 분리를 전제로 한다.

이전 주의 미진행 읽기·구현·실험·산출물은 학습 운영상 **완료한 것으로 처리한다.** 미진행분을 3주차로 이월하거나 보충 과제·추가 시간으로 배정하지 않는다. 이번 주에는 오직 Probability + Metrics의 정규 목표·시간표·산출물만 수행한다.

## 2. 이번 주 목표

- foundation model의 sampling과 확률적 출력이 동일 입력의 결과 변동성으로 이어지는 이유를 설명한다.
- population, sample, sampling bias, sampling distribution, bootstrap, confidence interval을 CHO-FAM 평가 데이터에 적용한다.
- accuracy 하나가 아니라 task success, validation failure, false action, latency, cost 등 **의사결정 가능한 metric family**를 정의한다.
- metric마다 관찰 단위, 분모, 집계 방식, 방향성, 최소 표본, uncertainty 표현을 명시한다.
- 동일 평가 세트를 반복 실행해 point estimate와 bootstrap 95% confidence interval을 계산한다.
- 평균값만 보고 내린 판단과 uncertainty를 포함한 판단이 달라지는 사례를 기록한다.

## 3. 시간표 · 기본 10시간

| 세션 | 활동 | 시간 | 산출물 |
|---|---|---:|---|
| 화 | T1 Ch.2 발췌: Sampling Fundamentals, Sampling Strategies, Probabilistic Nature | 1.5h | 확률적 출력·sampling 노트 |
| 수 | T1 Ch.3 발췌: evaluation metric, exact/functional evaluation, similarity, AI-as-a-Judge | 1.5h | metric 후보와 실패 모드 |
| 목 | S5 Ch.2 발췌 + 공식문서 세미나 | 1.5h | 표본·bootstrap·CI 세미나 노트 |
| 금 | CHO-FAM measurement schema와 metric registry 구현 | 2.0h | YAML/JSON schema, metric 함수, 테스트 |
| 토 | Cho-Pilot Mini 또는 현재 실행 가능한 CHO-FAM workflow 30-case 반복 평가 | 2.0h | raw run JSONL, summary CSV |
| 일 | bootstrap 분석·metric card·Research Note 작성 | 1.5h | CI 결과, metric card, 연구노트 |

읽기 시간을 늘려 구현·실험을 잠식하지 않는다. 3주차의 총 정규 학습시간은 **10시간**이다.

## 4. 교재와 읽을 자료

### 4.1 O’Reilly 주교재 · T1~T8 지정

이번 주 T1~T8 중 **필수는 T1**이다. T2~T8은 새 정규 읽기로 배정하지 않는다.

| 우선순위 | 교재·범위 | 읽기 초점 | CHO-FAM 적용 질문 |
|---|---|---|---|
| 필수 | [T1 · *AI Engineering*](https://www.oreilly.com/library/view/ai-engineering/9781098166298/) **Ch.2 Understanding Foundation Models** 중 Sampling Fundamentals, Sampling Strategies, The Probabilistic Nature of AI | temperature·sampling과 결과 변동성 | 같은 요청의 반복 실행을 단일 성공/실패로 기록해도 되는가? |
| 필수 | T1 **Ch.3 Evaluation Methodology** 중 Challenges, Exact Evaluation, Functional Correctness, Similarity Measurements, AI as a Judge, Comparative Evaluation | 열린 출력의 평가 방식과 한계 | deterministic validator와 model judge가 각각 소유해야 할 평가는 무엇인가? |
| 참고만 | T1 Ch.3의 entropy·cross entropy·perplexity 절 | 모델 수준 확률 지표와 제품 수준 지표 구분 | perplexity 개선이 CHO-FAM task success 개선을 직접 의미하는가? |

T1의 공개 목차 기준으로 Ch.2는 sampling과 AI의 확률적 성격을, Ch.3은 exact/functional evaluation, similarity, AI-as-a-Judge와 comparative evaluation을 다룬다.

### 4.2 통계 보조교재 · O’Reilly

[S5 · *Practical Statistics for Data Scientists, 2nd Edition*](https://www.oreilly.com/library/view/practical-statistics-for/9781492072935/) **Ch.2 Data and Sampling Distributions**에서 아래 절만 읽는다.

- Random Sampling and Sample Bias
- Sampling Distribution of a Statistic
- Standard Error
- The Bootstrap
- Confidence Intervals
- Binomial Distribution

목표는 통계 이론 완독이 아니라, **평가 결과의 점추정치 하나를 불확실성이 있는 추정으로 바꾸는 것**이다.

### 4.3 논문·공식문서 세미나

1. [Google Machine Learning Crash Course · Accuracy, recall, precision, and related metrics](https://developers.google.com/machine-learning/crash-course/classification/accuracy-precision-recall)  
   confusion matrix와 threshold에 따라 precision/recall이 달라지는 이유를 확인한다. CHO-FAM의 validator·action decision처럼 오탐과 미탐 비용이 다른 경우에 연결한다.
2. [Google Machine Learning Crash Course · ROC and AUC](https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc)  
   threshold 하나의 성능과 threshold 전 구간의 성능을 구분한다. 이번 주에는 ROC/AUC를 필수 구현하지 않고 threshold 사고방식만 가져온다.
3. [NIST AI Risk Management Framework](https://www.nist.gov/itl/ai-risk-management-framework)  
   MEASURE 기능을 중심으로 성능 수치가 맥락·위험·모니터링과 분리될 수 없는 이유를 토론한다.

세미나 노트는 `주장 / 측정 대상 / 관찰 단위 / 실패 비용 / 불확실성 / CHO-FAM 적용 결정` 형식을 사용한다.

### 4.4 Manning Agent·LLM 심화 참고

이번 주 Manning은 **심화 참고자료**로만 사용하며 별도 필독 시간을 추가하지 않는다.

- [*Build an AI Agent (From Scratch)*](https://www.manning.com/books/build-an-ai-agent-from-scratch) — evaluation 관련 장·절을 찾아 Agent의 최종 성공률뿐 아니라 step/tool/validation 수준 관찰 지표를 비교한다.
- [*AI Agents in Action, Second Edition*](https://www.manning.com/books/ai-agents-in-action-second-edition) — Agent 평가·관찰 예시가 필요할 때만 참조한다.

Manning 예제의 프레임워크 지표를 그대로 채택하지 말고 이번 주 metric registry의 정의와 분모에 맞춰 번역한다.

## 5. 구현 과제 · Measurement Harness v0.1

CHO-FAM 실제 프로젝트 중 **Cho-Pilot Mini 또는 현재 재현 가능한 단일 workflow**를 대상으로 한다. 새 기능을 만드는 주가 아니라 기존 실행을 측정 가능한 데이터로 바꾸는 주다.

### 5.1 파일

```text
docs/research/03-probability-metrics.md
docs/evaluation/metric-cards.md
platform/evaluation/metrics.yaml
platform/evaluation/schema/run.schema.json
scripts/evaluate_runs.py
scripts/bootstrap_metrics.py
tests/evaluation/test_metrics.py
results/week03-runs.jsonl
results/week03-metrics.csv
```

### 5.2 Metric registry 최소 스키마

```yaml
metrics:
  task_success_rate:
    unit: run
    numerator: successful_runs
    denominator: eligible_runs
    direction: higher_is_better
    uncertainty: bootstrap_95ci
  validation_failure_rate:
    unit: validation
    numerator: failed_validations
    denominator: validation_attempts
    direction: lower_is_better
    uncertainty: bootstrap_95ci
  unsafe_or_unapproved_action_rate:
    unit: action
    numerator: blocked_or_invalid_actions
    denominator: proposed_actions
    direction: lower_is_better
    uncertainty: bootstrap_95ci
  latency_ms:
    unit: run
    aggregate: [median, p95]
    direction: lower_is_better
  cost_per_success:
    unit: successful_run
    aggregate: mean
    direction: lower_is_better
```

각 metric은 이름만 두지 말고 **관찰 단위·분자·분모·집계·방향·불확실성**을 기계 판독 가능하게 남긴다.

### 5.3 구현 규칙

- 원시 run은 수정하지 않는 JSONL로 저장한다.
- summary CSV는 원시 run에서 재생성할 수 있어야 한다.
- 성공률 계열에는 최소 2,000회 bootstrap resampling으로 95% CI를 계산한다.
- latency는 평균만 쓰지 않고 median과 p95를 함께 기록한다.
- 비용은 run당 비용과 success당 비용을 분리한다.
- judge 기반 점수는 deterministic validator 결과와 같은 열에 섞지 않고 평가자 종류를 기록한다.

## 6. 실험·평가

### 6.1 가설

> 동일한 CHO-FAM 실행 결과라도 point estimate만 사용할 때보다 표본 설계와 uncertainty를 명시할 때 개선 여부에 대한 과도한 확신이 줄고, 다음 실험의 판단 기준이 명확해진다.

### 6.2 평가 세트

새 대규모 benchmark를 만들지 않는다. 현재 재현 가능한 CHO-FAM workflow에서 **30개 case**를 고정한다.

- 정상 요청 10
- 모호하거나 추가 정보가 필요한 요청 10
- validation·policy boundary를 건드리는 요청 10

각 case를 동일 설정으로 최소 3회 반복할 수 있게 runner를 구성하되, 이번 주 정규 실험에서는 총 실행량이 시간·비용 한도를 넘지 않도록 한다. 모델·temperature·prompt version·timestamp·latency·token/cost·validator result를 기록한다.

### 6.3 비교

두 분석을 같은 raw data에 적용한다.

| 분석 | 표시 | 판단 질문 |
|---|---|---|
| A · Point estimate | task success, failure rate의 단일 값 | 어느 쪽이 더 높거나 낮은가? |
| B · Uncertainty-aware | 동일 지표 + bootstrap 95% CI + sample size | 관측 차이를 개선으로 주장할 근거가 충분한가? |

이번 주에는 새 모델·새 프롬프트를 최적화하지 않는다. 목적은 **metric과 measurement harness 자체의 검증**이다.

### 6.4 평가 기준

| 항목 | 완료 기준 |
|---|---|
| Schema completeness | 100% run에 case/model/config/result/latency 기록 |
| Metric reproducibility | raw JSONL → summary CSV 재실행 결과 동일 |
| Metric definition | 핵심 metric 5개 모두 unit·denominator·direction 명시 |
| Uncertainty | 비율 지표에 sample size와 bootstrap 95% CI 표시 |
| Tail latency | median과 p95 모두 산출 |
| Judge separation | deterministic / human / model judge 출처 구분 |
| Decision quality | point estimate와 CI 해석이 달라지는 사례 또는 “달라지지 않음”을 근거와 함께 기록 |

## 7. 주간 산출물

- `docs/research/03-probability-metrics.md` — 연구질문, 가설, 표본, 결과, 해석, 한계가 있는 Research Note
- `docs/evaluation/metric-cards.md` — 핵심 metric 5개의 정의와 오용 가능성
- `platform/evaluation/metrics.yaml` — metric registry
- `platform/evaluation/schema/run.schema.json` — 원시 관찰 schema
- `scripts/evaluate_runs.py`, `scripts/bootstrap_metrics.py` — 재현 가능한 집계·CI 계산
- `tests/evaluation/test_metrics.py` — 분모 0, missing value, 실패 run, outlier latency 테스트
- `results/week03-runs.jsonl` — 원시 실험 로그
- `results/week03-metrics.csv` — 지표·표본수·CI 결과

CSV 최소 열:

```csv
metric,n,estimate,ci_low,ci_high,unit,aggregation,direction,notes
```

## 8. 완료 기준과 회고 질문

- [ ] T1 Ch.2·3의 지정 절을 읽고 CHO-FAM 적용 결정 3개 이상을 기록했다.
- [ ] S5 Ch.2 지정 절에서 sampling bias, bootstrap, confidence interval을 설명할 수 있다.
- [ ] 공식문서 세미나에서 threshold와 오류 비용을 CHO-FAM 사례 하나에 연결했다.
- [ ] 핵심 metric 5개의 관찰 단위와 분모가 명시되어 있다.
- [ ] 30-case 평가 데이터가 schema를 통과한다.
- [ ] raw JSONL에서 summary와 bootstrap CI를 재생성할 수 있다.
- [ ] 평균 latency만으로 결론내리지 않고 median/p95를 기록했다.
- [ ] Research Note에 표본의 대표성 한계와 다음 주 실험설계에 넘길 결정 1개 이상을 기록했다.

회고 질문:

1. “성공”이라는 단어가 run, step, tool call, user outcome 중 무엇을 의미하는가?
2. 현재 표본에서 가장 큰 uncertainty는 모델 randomness인가, case selection bias인가?
3. metric을 개선했지만 사용자 결과를 악화시킬 수 있는 Goodhart’s law 사례는 무엇인가?
4. 4주차 Experiment Design에서 고정해야 할 독립변수·통제변수·stopping rule은 무엇인가?

## 9. 12개월·48주 탐색

### 1개월차 · Research Methodology + CS Foundations

[월별 상세](https://cho-fam.com/docs/curriculum/month-01.html)

- [1주차 · Research Methodology + Agent vs Workflow](https://cho-fam.com/docs/curriculum/week-01.html) — 완료
- [2주차 · CS Foundations + System Decomposition](https://cho-fam.com/docs/curriculum/week-02.html) — 완료
- [3주차 · Probability + Metrics](https://cho-fam.com/docs/curriculum/week-03.html) **(현재)**
- 4주차 · Experiment Design — 예정

### 2개월차 · Machine Learning + Deep Learning + LLM Systems
[월별 상세](https://cho-fam.com/docs/curriculum/month-02.html) · 5–8주차 예정

### 3개월차 · Knowledge Engineering + RAG
[월별 상세](https://cho-fam.com/docs/curriculum/month-03.html) · 9–12주차 예정

### 4개월차 · Software Architecture + Distributed Systems
[월별 상세](https://cho-fam.com/docs/curriculum/month-04.html) · 13–16주차 예정

### 5개월차 · AI Agent Architecture
[월별 상세](https://cho-fam.com/docs/curriculum/month-05.html) · 17–20주차 예정

### 6개월차 · Agent Architecture + Runtime Reliability
[월별 상세](https://cho-fam.com/docs/curriculum/month-06.html) · 21–24주차 예정

### 7개월차 · Multi-Agent + MCP/A2A
[월별 상세](https://cho-fam.com/docs/curriculum/month-07.html) · 25–28주차 예정

### 8개월차 · Human-AI Interaction
[월별 상세](https://cho-fam.com/docs/curriculum/month-08.html) · 29–32주차 예정

### 9개월차 · AI Software Engineering
[월별 상세](https://cho-fam.com/docs/curriculum/month-09.html) · 33–36주차 예정

### 10개월차 · Evaluation + LLMOps
[월별 상세](https://cho-fam.com/docs/curriculum/month-10.html) · 37–40주차 예정

### 11개월차 · Enterprise AI Architecture
[월별 상세](https://cho-fam.com/docs/curriculum/month-11.html) · 41–44주차 예정

### 12개월차 · Research Project + Thesis
[월별 상세](https://cho-fam.com/docs/curriculum/month-12.html) · 45–48주차 예정

---

자료 범위 확인일: 2026-09-29. O’Reilly/Manning 본문 접근은 계정·구독 상태에 따라 달라질 수 있다.
