Spaces:
Sleeping
Sleeping
File size: 23,802 Bytes
23d418f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | {
"example": "H016",
"overview": [
{
"id": "documents",
"title": "Documents",
"line": "36 public forms and laws"
},
{
"id": "prepare",
"title": "Prepare",
"line": "parse, split by section, link references"
},
{
"id": "evidence",
"title": "Find the evidence",
"line": "three designs: A, B and C"
},
{
"id": "answer",
"title": "Answer & check",
"line": "same model, every quote verified"
},
{
"id": "measure",
"title": "Measure",
"line": "a blind test, paired statistics"
}
],
"chapters": [
{
"id": "documents",
"title": "The documents",
"lead": "Every answer comes from public documents only, so anyone can check it.",
"diagram": {
"kind": "documents",
"boxes": {
"oap": {
"title": "OAP 1",
"sub": "the standard owner's policy"
},
"opcf": {
"title": "30 OPCF forms",
"sub": "endorsements that change the policy"
},
"laws": {
"title": "5 Ontario laws",
"sub": "accident benefits, Insurance Act, ..."
},
"corpus": {
"title": "36 documents",
"sub": "each pinned by its fingerprint"
}
}
},
"steps": [
{
"id": "what",
"point": "Answers come only from 36 public documents.",
"body": "The standard Ontario auto policy, its 30 change forms, and 5 laws they rely on. All are public, so anyone can check an answer.",
"highlight": [
"oap",
"opcf",
"laws"
],
"details": {
"numbers": [
{
"label": "Documents",
"value": "36"
},
{
"label": "PDF forms / laws",
"value": "31 / 5"
}
],
"example": null,
"tried": [],
"files": [
"data/manifest.csv",
"data/CORPUS.md"
]
}
},
{
"id": "pinned",
"point": "Every file is pinned, and nothing is scraped.",
"body": "The regulator's sites block automated downloads. So the files were saved by hand, and each one is checked against its fingerprint (SHA-256).",
"highlight": [
"corpus"
],
"details": {
"numbers": [],
"example": null,
"tried": [],
"files": [
"src/coveragecheck/ingest/download.py"
]
}
},
{
"id": "dates",
"point": "Dates matter: some laws exist in two versions.",
"body": "Accident benefits (SABS) changed on 2026-07-01. The same question can have two answers, one per version. Only 13 of the 36 documents state their dates.",
"highlight": [
"laws"
],
"details": {
"numbers": [
{
"label": "Documents with stated dates",
"value": "13 of 36"
}
],
"example": {
"title": "Two versions of one law",
"body": "SABS 2025: in force 2025-07-01 to 2026-06-30\nSABS 2026: in force from 2026-07-01"
},
"tried": [],
"files": []
}
},
{
"id": "left-out",
"point": "Some documents are left out on purpose.",
"body": "Change forms the regulator does not publish (OPCF 8, 13C, 39) are not here. Questions about them must be declined: a test of honesty.",
"highlight": [
"corpus"
],
"details": {
"numbers": [],
"example": null,
"tried": [
"The rest of the Insurance Act: about insurers in general, only noise",
"The Statutory Conditions regulation: already word for word in OAP 1"
],
"files": []
}
}
]
},
{
"id": "prepare",
"title": "Preparing the documents",
"lead": "Structure is kept, so every passage knows its section and can be cited exactly.",
"diagram": {
"kind": "prepare",
"boxes": {
"docs": {
"title": "36 documents",
"sub": ""
},
"parse": {
"title": "Parse",
"sub": "headings, sections, pages"
},
"sections": {
"title": "591 sections",
"sub": "906 chunks, for B and C"
},
"refs": {
"title": "1,127 cross-references",
"sub": "953 linked to their section"
},
"windows": {
"title": "1,247 windows",
"sub": "fixed size, for A"
},
"index": {
"title": "Search indexes",
"sub": "exact words + meaning"
}
}
},
"steps": [
{
"id": "parse",
"point": "Each document is read with its structure kept.",
"body": "A parser (Docling) turns each PDF into headings, paragraphs, tables and pages. The laws come as Word files whose styles mark each section.",
"highlight": [
"docs",
"parse"
],
"details": {
"numbers": [],
"example": {
"title": "A heading path kept from the structure",
"body": "O. Reg. 34/10: Statutory Accident Benefits Schedule - Effective September 1 2010 (current consolidation) > PART VII GENERAL EXCLUSIONS > Section 31: Circumstances in which certain benefits not payable"
},
"tried": [
"Detecting tables of contents from text alone: it dropped real fill-in lines"
],
"files": [
"src/coveragecheck/ingest/parse.py"
]
}
},
{
"id": "sections",
"point": "B and C split documents by section, never across one.",
"body": "A rule only makes sense under its heading. So every chunk stays inside one section and can be cited by its number.",
"highlight": [
"sections"
],
"details": {
"numbers": [
{
"label": "Sections",
"value": "591"
},
{
"label": "Chunks",
"value": "906"
},
{
"label": "Typical chunk",
"value": "949 characters"
}
],
"example": {
"title": "A chunk (OPCF44R-2026#4:0)",
"body": "OPCF 44R: Family Protection Coverage > LIMIT OF COVERAGE UNDER THIS CHANGE FORM > Section 4\n4. The insurer's maximum liability under this change form, regardless of the number of eligible claimants or insured persons injured or killed or the number of automobiles insured under the Policy, is the amount by which the limit of family protection coverage exceeds the total ..."
},
"tried": [],
"files": [
"src/coveragecheck/ingest/chunk.py"
]
}
},
{
"id": "refs",
"point": "Every cross-reference is linked to the section it names.",
"body": "Policy text often says \"subject to section 268\". Each such reference is found and linked: 85% reach a section in the corpus.",
"highlight": [
"refs"
],
"details": {
"numbers": [
{
"label": "References found",
"value": "1,127"
},
{
"label": "Linked to a section",
"value": "953"
},
{
"label": "Outside the corpus",
"value": "110"
}
],
"example": {
"title": "A linked reference",
"body": "\"Section 268\" in OPCF47-undated#1:0\n-> INSACT-2026#268"
},
"tried": [],
"files": [
"src/coveragecheck/ingest/xref.py"
]
}
},
{
"id": "windows",
"point": "System A gets plain windows, as in a basic tutorial.",
"body": "A cuts each document into 800-character windows and ignores headings. It is the baseline that shows what structure is worth.",
"highlight": [
"windows"
],
"details": {
"numbers": [
{
"label": "Windows",
"value": "1,247"
},
{
"label": "Size / overlap",
"value": "800 / 100 characters"
}
],
"example": {
"title": "A window (OPCF44R-2026~1): it starts mid-sentence",
"body": "relative of the named insured or of his or her spouse, who resides in the same dwelling premises as the named insured; and (d) a relative of the named insured or of his or her spouse, while an occupant of the described automobile, a newly acquired automobile, ..."
},
"tried": [],
"files": []
}
},
{
"id": "index",
"point": "Two search indexes: one for exact words, one for meaning.",
"body": "Keyword search (BM25) finds exact terms like \"OPCF 44R\". Meaning search finds paraphrases like \"my client's son\". B and C use both.",
"highlight": [
"index"
],
"details": {
"numbers": [
{
"label": "Meaning model",
"value": "BAAI/bge-small-en-v1.5"
},
{
"label": "Search time (measured, SPEC 3d)",
"value": "7 to 12 ms"
}
],
"example": null,
"tried": [
"A vector database: the 906 chunks fit in memory"
],
"files": [
"src/coveragecheck/index/hybrid.py"
]
}
}
]
},
{
"id": "evidence",
"title": "Finding the evidence: three designs",
"lead": "The three systems differ only here: how they find the passages the answer will use.",
"diagram": {
"kind": "grid",
"columns": {
"a": {
"title": "System A",
"name": "Naive RAG"
},
"b": {
"title": "System B",
"name": "Structure-aware hybrid RAG"
},
"c": {
"title": "System C",
"name": "Agent (LangGraph)"
}
},
"rows": [
{
"id": "question",
"label": "Question",
"cells": {
"a": {
"title": "Question + policy date",
"sub": ""
},
"b": {
"title": "Question + policy date",
"sub": ""
},
"c": {
"title": "Question + policy date",
"sub": ""
}
}
},
{
"id": "search",
"label": "Search",
"cells": {
"a": {
"title": "Meaning search",
"sub": "top 5 windows"
},
"b": {
"title": "Words + meaning",
"sub": "30 + 30 candidates"
},
"c": {
"title": "Words + meaning",
"sub": "top 20 kept"
}
}
},
{
"id": "date",
"label": "Date filter",
"cells": {
"a": null,
"b": {
"title": "Versions in force",
"sub": "on the policy date"
},
"c": {
"title": "Versions in force",
"sub": "on the policy date"
}
}
},
{
"id": "pick",
"label": "Pick the best",
"cells": {
"a": null,
"b": {
"title": "Reranker",
"sub": "a small model keeps 8"
},
"c": {
"title": "LLM judge",
"sub": "lists the facts needed"
}
}
},
{
"id": "again",
"label": "Search again",
"cells": {
"a": null,
"b": null,
"c": {
"title": "Second search",
"sub": "for any missing fact"
}
}
},
{
"id": "cited",
"label": "Add cited sections",
"cells": {
"a": null,
"b": {
"title": "Cited sections",
"sub": "up to 4 more"
},
"c": {
"title": "Cited sections",
"sub": "up to 4 more"
}
}
}
],
"results": {
"a": {
"accuracy": "42%",
"time": "7 s"
},
"b": {
"accuracy": "61%",
"time": "10 s"
},
"c": {
"accuracy": "84%",
"time": "19 s"
}
}
},
"steps": [
{
"id": "question",
"point": "All three get the same question and policy date.",
"body": "In the chat, a follow-up is first rewritten into a complete question. Then each system answers it exactly as it was tested.",
"highlight": [
"question"
],
"details": {
"numbers": [],
"example": {
"title": "A follow-up, rewritten (live test)",
"body": "\"And what is the most it will pay?\"\n-> \"Under OPCF 44R, what is the most the insurer will pay if the at-fault driver has no insurance at all?\""
},
"tried": [],
"files": [
"src/coveragecheck/web/followup.py"
]
}
},
{
"id": "search",
"point": "A searches by meaning only; B and C also match exact words.",
"body": "Insurance questions mix exact terms (\"OPCF 44R\") with everyday wording. Combining both kinds of search covers each one's blind spot.",
"highlight": [
"search"
],
"details": {
"numbers": [
{
"label": "Passages fused by rank",
"value": "Reciprocal Rank Fusion, k = 60"
}
],
"example": {
"title": "H016: the windows A read",
"body": "OPCF6F-2024~0\nOPCF6C-2024~0\nOAP1-2026~61\nOPCF6B-2024~0\nOPCF27B-2003~1"
},
"tried": [],
"files": [
"src/coveragecheck/retrieve/naive.py",
"src/coveragecheck/index/hybrid.py"
]
}
},
{
"id": "date",
"point": "B and C only search versions in force on the policy date.",
"body": "A policy dated October 2025 must use the 2025 accident benefits, not the 2026 reform. System A is only told the date.",
"highlight": [
"date"
],
"details": {
"numbers": [],
"example": {
"title": "A policy date of 2025-10-01",
"body": "SABS 2025 (in force 2025-07-01 to 2026-06-30): searched\nSABS 2026 (from 2026-07-01): excluded"
},
"tried": [],
"files": []
}
},
{
"id": "pick",
"point": "B reorders the passages; C reads them and lists what the answer needs.",
"body": "B's reranker scores each passage against the question. C's judge, a language model, writes down each fact the answer needs and which passage states it.",
"highlight": [
"pick"
],
"details": {
"numbers": [
{
"label": "B: passages reranked / kept",
"value": "15 / 8"
},
{
"label": "C: facts listed at most",
"value": "5"
}
],
"example": {
"title": "H016: the facts C looked for",
"body": "found: Whether the standard OAP 1 covers a van carrying paying passengers for fares\nmissing: Whether the standard OAP 1 liability covers passengers' luggage damaged in a crash\nfound: What OPCF 6C permits: carrying passengers for compensation or hire\nfound: What OPCF 6C changes for property carried in or upon the automobile\nfound: Which OPCF 6C limits apply to occupant injury and property carried"
},
"tried": [
"Reranking every candidate: worse and slower than the top 15 (tuned on the practice questions)"
],
"files": [
"src/coveragecheck/retrieve/structured.py",
"src/coveragecheck/agent/judge.py"
]
}
},
{
"id": "again",
"point": "Only C searches again when a needed fact is missing.",
"body": "If no passage states a fact, C searches for it and reads the new passages. On questions needing two documents, C is right 72% of the time, B 46%.",
"highlight": [
"again"
],
"details": {
"numbers": [
{
"label": "Second searches on the final test",
"value": "115 of 249 questions"
},
{
"label": "Searches at most",
"value": "3"
}
],
"example": {
"title": "H016: C's second search",
"body": "Liability Coverage limitation property carried in or upon the automobile 3.5.1 Ontario Automobile Policy"
},
"tried": [],
"files": [
"src/coveragecheck/agent/graph.py"
]
}
},
{
"id": "cited",
"point": "B and C also fetch the sections their passages cite.",
"body": "When a passage says \"subject to section 268\", that section is added too. At most 4 passages are added this way.",
"highlight": [
"cited"
],
"details": {
"numbers": [],
"example": null,
"tried": [
"Adding very long sections (over 8,000 characters): measured useless"
],
"files": []
}
}
]
},
{
"id": "answer",
"title": "Answering and checking",
"lead": "The same answer step for all three systems, then every quote is checked.",
"diagram": {
"kind": "answer",
"boxes": {
"passages": {
"title": "The selected passages",
"sub": ""
},
"answer": {
"title": "Answer",
"sub": "Claude Haiku, same prompt for all"
},
"check": {
"title": "Quote check",
"sub": "every quote, word for word"
},
"retry": {
"title": "Retry once",
"sub": "System C only"
},
"reply": {
"title": "Answer with sources",
"sub": "or \"can't determine\""
}
}
},
"steps": [
{
"id": "same",
"point": "All three answer with the same model and instructions.",
"body": "Claude Haiku answers from the passages only and quotes each claim. So any difference comes from what each system found.",
"highlight": [
"passages",
"answer"
],
"details": {
"numbers": [
{
"label": "Model",
"value": "Claude Haiku 5.5"
},
{
"label": "Re-asks after an invalid reply",
"value": "1"
}
],
"example": {
"title": "H016: C's answer",
"body": "(a) A standard OAP 1 does not cover the van while it carries fare-paying passengers. Section 1.8.1 excludes coverage if the automobile is used to carry paying passengers, except for certain Accident Benefits coverage. (b) Under the standard OAP 1, passengers' luggage damaged in a crash is not covered, because section ..."
},
"tried": [
"Gemini: too slow and often unavailable in the benchmark"
],
"files": [
"src/coveragecheck/agent/answer.py"
]
}
},
{
"id": "decline",
"point": "When the documents can't answer, it says so.",
"body": "It replies \"can't determine\" and lists what a broker would need to find out. On the 48 unanswerable test questions, C declined every one.",
"highlight": [
"reply"
],
"details": {
"numbers": [
{
"label": "Correctly declined: A",
"value": "100%"
},
{
"label": "Correctly declined: B",
"value": "98%"
},
{
"label": "Correctly declined: C",
"value": "100%"
}
],
"example": null,
"tried": [],
"files": []
}
},
{
"id": "check",
"point": "Every quote is checked word for word against its source.",
"body": "Numbers and words like \"not\" must match exactly. A quote with one digit changed never passes.",
"highlight": [
"check"
],
"details": {
"numbers": [
{
"label": "Quotes not word for word: A",
"value": "0.7% of 544"
},
{
"label": "Quotes not word for word: B",
"value": "1.1% of 795"
},
{
"label": "Quotes not word for word: C",
"value": "0.0% of 966"
}
],
"example": null,
"tried": [
"A fuzzy match alone: it accepted every quote with one number changed"
],
"files": [
"src/coveragecheck/verify/citations.py"
]
}
},
{
"id": "retry",
"point": "System C checks its own quotes before replying.",
"body": "If a quote fails, C is told why and answers again, once. Quotes that still fail are dropped, and its confidence is lowered.",
"highlight": [
"check",
"retry"
],
"details": {
"numbers": [],
"example": {
"title": "H070: C caught its own quotes",
"body": "OPCF44R-2026#3: fragment 'is excess to amounts that were available to the eligible cla' is not in the cited text\nOPCF44R-2026#3: fragment '(e) the uninsured automobile coverage of a motor vehicle lia' is not in the cited text\n-> answered again; 1 quote dropped"
},
"tried": [],
"files": [
"src/coveragecheck/agent/verify.py"
]
}
}
]
},
{
"id": "measure",
"title": "Measuring honestly",
"lead": "The final test was written blind, after the systems were frozen.",
"diagram": {
"kind": "measure",
"boxes": {
"tuning": {
"title": "Practice questions",
"sub": "23 probes + 63 development"
},
"heldout": {
"title": "Final test",
"sub": "249 blind questions"
},
"grading": {
"title": "Grading",
"sub": "an AI grader, blind"
},
"stats": {
"title": "Statistics",
"sub": "paired, with intervals"
},
"results": {
"title": "Results",
"sub": "A 42% / B 61% / C 84%"
}
}
},
"steps": [
{
"id": "tuning",
"point": "Every setting was tuned on separate practice questions.",
"body": "23 probes and 63 development questions were used to tune. None of them is in the final test.",
"highlight": [
"tuning"
],
"details": {
"numbers": [],
"example": null,
"tried": [],
"files": [
"evals/dev_probes.jsonl",
"evals/questions.jsonl"
]
}
},
{
"id": "heldout",
"point": "The final test was written blind, after the systems were frozen.",
"body": "Separate AI writers saw only the documents, never the systems. Reviewers kept 219, fixed 30 and dropped 11 of 260 questions.",
"highlight": [
"heldout"
],
"details": {
"numbers": [
{
"label": "Single / multi / date / unanswerable",
"value": "65 / 101 / 35 / 48"
}
],
"example": {
"title": "H016",
"body": "A client runs a small airport shuttle with one van and charges each passenger a fare. She asks: (a) does a standard OAP 1 cover the van while it's used this way, and (b) would passengers' luggage damaged in a crash be covered? What changes if OPCF 6C is attached?"
},
"tried": [],
"files": [
"evals/heldout.jsonl",
"evals/heldout_review/"
]
}
},
{
"id": "grading",
"point": "An AI grader marked every answer, blind to the system.",
"body": "Claude Opus compared each answer with the reference answer. No human expert checked the grades: a stated limitation.",
"highlight": [
"grading"
],
"details": {
"numbers": [
{
"label": "Grader",
"value": "llm:claude-opus-5-5:high"
}
],
"example": null,
"tried": [
"Hand grading 747 answers: no time; checking 30 against an expert is the next step"
],
"files": [
"evals/llm_grading/README.md"
]
}
},
{
"id": "stats",
"point": "The systems are compared on the same questions.",
"body": "Counting answers fixed and broken, question by question, is fairer than comparing averages. The main comparisons were declared in advance.",
"highlight": [
"stats"
],
"details": {
"numbers": [
{
"label": "C vs B",
"value": "61 fixed, 4 broken"
}
],
"example": null,
"tried": [],
"files": [
"src/coveragecheck/evals/metrics.py"
]
}
},
{
"id": "results",
"point": "C is right 84% of the time, B 61%, A 42%.",
"body": "C gains most on questions needing two or more documents. Its cost is time: about 19 s per answer against 10 s for B.",
"highlight": [
"results"
],
"details": {
"numbers": [
{
"label": "System A",
"value": "42% correct, 7 s typical time"
},
{
"label": "System B",
"value": "61% correct, 10 s typical time"
},
{
"label": "System C",
"value": "84% correct, 19 s typical time"
}
],
"example": null,
"tried": [],
"files": [
"evals/report_heldout/report.md"
]
}
}
]
}
]
}
|