Repository navigation
The parsing bench measures what a parse does downstream: search hits cited to their page, and decision quotes found in the file - #300
Merged
Merged
Conversation
…cited to their page, and decision quotes found in the file Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…is never served, and a stalled ingest stops the run Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…the run, and run --artifacts takes only an empty directory Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…directory itself, and the judge always checks the namespace Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e check guards an artifacts directory Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…asons read in order Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…poll Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… a second httpx import Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
dp-downstream
branch
from
November 6, 2026 19:44
706a1c6 to
a28ef77
Compare
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #289
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
The document-parsing bench measures what a parse does downstream:
knowledge.searchrecall with the hit cited by its page, and how often decision extraction finds its quotes in the parsed text.Why
The parsing bench (#289) scores a parse against gold labels. What Loom needs from a parse is what it does after ingest: whether a search hit holds the answer and cites the page it is on, and whether decision extraction can ground its quotes in the text. Two parses with the same text recall can differ there (one block over many pages cites nothing; a table flattened into words loses its rows).
Design
python -m bench.docparse run --artifacts DIRwrites each file's artifact beside the normalized parse;artifacts PARSES.jsonl --out DIRturns another parser's normalized parses into contract artifacts (blocks with their pages and section paths, tables as typed tables), so any parser can be compared.downstream NAME=DIR ...serves each system's artifacts from a stub extractor (the contract'sGET /v1/capabilitiesandPOST /v1/extract, by file name) to a running Loom whoseLOOM_DOCUMENT_EXTRACTOR_URLpoints at it, ingests the corpus into one namespace per system throughknowledge.uploadandknowledge.ingest(partial files too), and asks the same queries of each.uri_prefix), since a parse decides what its chunks hold and cite, not how documents rank against each other. Found at k: a top-k hit holds 70% of the answer's words; cited: that hit's locator holds the answer's page and spans no more than the answer does plus one page (a table row: within the table's pages, a page or two). The report is recall at 1 and 5, found and cited, per category and overall, each system paired with the first with a 95% bootstrap interval (files resampled).run --artifactsandartifacts --outrefuse a directory that already holds artifacts, so a failed parse leaves none from an earlier run; a query of a file whose ingest this run did not finish is not found, so an earlier run's revision still serving it scores nothing; a token the stub refuses stops the run at the next status poll; either stop cancels the system's open jobs, so none reaches the stub once it serves another system.--decisions Nmines N PDF documents withdecision_extract.extract_documentin a dry run, in this process, counting at the point extraction grounds a claim's quotes in the parsed text: the share of claims kept is the quote-match rate, and the share of kept quotes that are a run of the gold text says how often the parse's text is the document's. It needs the server's settings and a real LLM, so it runs only when asked.Scope and risk
bench/docparse/(downstream.py,run.py,__main__.py),bench/test_docparse.py,bench/README.md. Bench only; nothing underserver/changes. The stub binds 127.0.0.1, answers only the token the server sends, and serves only a corpus file's name from its directory.--decisionsspends LLM tokens (about $1 for 12 documents and three systems).Compatibility, rollout and rollback
Tests
pytest bench/test_docparse.py: a normalized parse becomes an artifact that passesparse_artifact, with its headings opening sections, its table blocks and typed tables, and an incomplete parse's failed units; the stub refuses a missing or wrong token on either route and a name with a path, and serves a system's artifact by file name;run --artifactsandartifacts --outrefuse a directory that already holds artifacts; ingest stops on a refused token or at its deadline after polling, and cancels only its open jobs; downstream refuses two systems that share a namespace, an empty token and more decision documents than it has; the query set holds paragraphs and table rows with their pages; a hit is found when it holds the answer and cited only on the right page, a table row within its table's pages, and another system's copy of the document is not a hit; decision counts come from where extraction grounds a claim's quotes, the rejected options' quotes included, and a document this run did not ingest is not mined (unread); the report pairs each system with the first.One run end to end against a local Loom (fake embedder, no LLM), 212 queries, the reference extractor before and after the PDF layout and OCR changes and a layout-model baseline:
Each search is scoped to its document and to its system's own namespace (
namespace_scope: this), and a hit from another namespace does not count. Scanned pages go from 0 to 1.00 cited at 5. Table rows over many pages cite less often than a page's flattened text did (0.80 against 1.00 at 5):knowledge.searchfolds the row blocks of one section, so a row deep in a long table can fall out of the top five. That is the search's, not the parse's.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. I ran the harness end to end against a local server and checked the judge against hand-picked hits.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code