← Jonghyun Beik

Grounded lesson notes

Personal project · 2026.10 · solo · Python, Claude via claude -p (JSON schema)

# notes/llm.py (excerpt, unedited lines)
def validate(r: dict, paras: list[dict], book: dict | None = None) -> tuple[dict, int]:
    order = {p["id"]: i for i, p in enumerate(paras)}
    student = {p["id"]: [text_of(t) for t in p["turns"] if t["speaker"] == "student" and not t["echo"]] for p in paras}
    dropped = 0

    def refs(xs):
        nonlocal dropped
        ok = [x for x in xs if x in order]
        dropped += len(xs) - len(ok)
        return ok

    def verbatim(m):
        return any(m["quote"] and m["quote"] in s for s in student.get(m["paragraph"], []))

    mis = [m for m in r["misconceptions"] if verbatim(m)]
    ...
        ev = [x for x in u["evidence"] if x in order or x in events]
        dropped += len(u["evidence"]) - len(ev)
        if not ev:  # a verdict whose evidence was all made up is a guess
            dropped += 1
            continue
notes/llm.py, excerpt. Lines unedited; the docstring and the middle are elided.

A tidy summary erases the evidence

I record physics tutoring sessions (English with Korean mixed in) and generate lesson notes from the transcript. The student's wrong phrasings are the diagnostic evidence, and LLMs tidy speech: if a wrong term is rewritten into the right one, the evidence of the misconception disappears. A summary can also contain things that were never said.

Lessons are recorded with consent. The student is a minor: audio and transcripts are stored locally, and the transcript goes to the model only in a headless call with no saved session.

Four ways to keep the model honest

Prompt asks for sources
The model asserts its own citations; nothing checks them.
JSON schema only
Guarantees the shape, not that a cited paragraph exists or a quote is real.
Schema + code check (chosen)
A deterministic validate() decides what is kept.
Entailment check (NLI or LLM judge)
Would catch a paraphrase the transcript does not support, which the structure check misses. Not built: a judge needs its own labeled set before its verdicts mean anything.

What validate() drops

A citation to a paragraph that does not exist
The claim is dropped.
A student quote that is not a verbatim substring of the transcript
The quote is dropped; wrong phrasings that are real survive untouched.
A judgment whose evidence is all invented
The judgment is dropped.

The model runs headless with zero tools and no saved session. Tokens and list cost are recorded for every note; 86 tests cover the notes pipeline.

What it has not proven

Real use so far: one 51.9-minute lesson (566 paragraphs, 25 chunks, 3 misconception quotes kept, list cost about $0.47) and two meeting notes. Across 6 runs on these recordings, validate() dropped 0 items, so it is a guard that has not had to fire. It has not been tested against planted fabrications, it checks structure only (references, verbatim quotes) and not whether a paraphrase is entailed, and its precision and recall are unmeasured. The next step is a small set of planted errors.

Related: an evaluation design for choosing a speech-to-text engine (29 candidates → 6; metrics include how often a student's wrong term is preserved). The scoring code is written; the comparison has not been run.

Who did what

Solo project. I made the design decisions; Claude Code wrote most of the code.