SynaptraDocs

    Examples

    Example: document pipeline

    A pipeline that builds decks or reports from a brief: outline, draft, design. There's no single right answer, so each output is judged against the incumbent's.

    #

    What it registers

    KindNameWhat
    actionoutlineBrief → section outline.
    actiondraft_sectionOutline item → text, with sources.
    actionrenderDraft → deck or PDF.
    scorerwin_vs_incumbent1 if a judge prefers the variant's document to the incumbent's for the same brief, 0.5 for a tie, 0 otherwise.
    datasetbriefs-4040 real briefs with notes on what good looks like.
    runnerrunnerpython build_docs.py --variant {variant} --tier {tier}
    #

    How it's scored

    The metric is win_vs_incumbent, a pairwise win rate (bar 0.55: the challenger must be preferred more often than not, with margin). For every brief, both documents go to the judge twice, in both orders, to cancel position bias; disagreeing orders count as a tie.

    #

    The code

    doc_harness.py
    h = Harness.create("Report builder", metric="win_vs_incumbent", bar=0.55, template="pipeline",
                       url="https://synaptra.my", token=TOKEN)
    
    @h.scorer
    def win_vs_incumbent(challenger: str, incumbent: str, brief: dict) -> float:
        """Judge both orders; a split verdict is a tie."""
        a = judge(PAIRWISE_RUBRIC, first=challenger, second=incumbent, brief=brief)
        b = judge(PAIRWISE_RUBRIC, first=incumbent, second=challenger, brief=brief)
        return {("first", "second"): 1.0, ("second", "first"): 0.0}.get((a, b), 0.5)
    
    rows = []
    for brief in briefs_for("T1"):
        mine, theirs = build(brief, "tighter-outline"), build(brief, INCUMBENT)
        rows.append({"task": brief["id"], "variant": "tighter-outline", "tier": "T1",
                     "metrics": {"win_vs_incumbent": win_vs_incumbent(mine, theirs, brief)},
                     "meta": {"vs": INCUMBENT}})
    h.report(rows, experiment_id=EXP)
    doc_harness.ts
    const h = await Harness.create({ name: "Report builder", metric: "win_vs_incumbent", bar: 0.55,
                                     template: "pipeline", url: "https://synaptra.my", token: TOKEN });
    
    // Judge both orders; a split verdict is a tie.
    async function winVsIncumbent(challenger: string, incumbent: string, brief: Brief): Promise<number> {
      const a = await judge(PAIRWISE_RUBRIC, { first: challenger, second: incumbent, brief });
      const b = await judge(PAIRWISE_RUBRIC, { first: incumbent, second: challenger, brief });
      return a === "first" && b === "second" ? 1 : a === "second" && b === "first" ? 0 : 0.5;
    }
    await h.scorer({ name: "win_vs_incumbent", description: "Judge both orders; a split verdict is a tie." }, winVsIncumbent);
    
    const rows = [];
    for (const brief of briefsFor("T1")) {
      const [mine, theirs] = await Promise.all([build(brief, "tighter-outline"), build(brief, INCUMBENT)]);
      rows.push({ task: brief.id, variant: "tighter-outline", tier: "T1",
                  metrics: { win_vs_incumbent: await winVsIncumbent(mine, theirs, brief) },
                  meta: { vs: INCUMBENT } });
    }
    await h.report(rows, { experimentId: EXP });
    #

    A first experiment

    Python
    e = h.propose(
        "Tighter outlines", "tighter-outline",
        {"T0": {"pass_rate": 1}, "T1": {"mean_win_vs_incumbent": 0.6}},
        hypothesis="Reviewers skim; fewer, sharper sections read better",
    )
    TypeScript
    const e = await h.propose({
      title: "Tighter outlines",
      variant: "tighter-outline",
      hypothesis: "Reviewers skim; fewer, sharper sections read better",
      predictions: { T0: { pass_rate: 1 }, T1: { mean_win_vs_incumbent: 0.6 } },
    });
    POST /api/harnesses/report-builder/experiments
    {"title": "Tighter outlines", "variant": "tighter-outline",
     "hypothesis": "Reviewers skim; fewer, sharper sections read better",
     "predictions": {"T0": {"pass_rate": 1}, "T1": {"mean_win_vs_incumbent": 0.6}}}
    #

    What this won't tell you

    • Whether real readers agree with the judge. Spot-check with people, and record agreement as a note.
    • Absolute quality: a win rate says better than the incumbent, not good.

    Something unclear or missing? Email support@synaptra.my.