Repository navigation
Prospects: the shortlist learns from each fit verdict and keeps what it learned - #653
Deodat-Lawson wants to merge 5 commits into
Conversation
…hing on the app's built-in embedders E4 found that on Norwegian company texts a Norwegian brief finds 58.5 good companies in 100 checks against 25.0 for an English one, and that with an English brief the relevance-above-zero rule drops 40% and 89% of the good companies in two pools. That was measured with the small local model. Replayed through production's semanticRelevance on the app's two built-in embedding models (packages/llm/src/embeddings/index-registry.ts), the gap is gone: model English Norwegian difference (95%) nomic-embed-text (local) 25.0 58.5 +33.5 (-1.0 to +60.7) gemini-embedding-001 at 768 88.3 88.5 +0.2 (-3.8 to +4.4) text-embedding-3-large at 1536 74.5 69.9 -4.6 (-10.7 to +2.4) With an English brief the zero-score rule keeps 91% to 95% of the good companies on gemini-embedding-001 and 85% to 94% on text-embedding-3-large; with a Norwegian brief it keeps nearly the whole pool and stops filtering. So plan item 3 (translate the brief, or score against both) is not built, and the zero-score rule stays as it is. No product code changes. What is added is the replay that says so, in production-replay/: - vectors.ts, models.ts: cached vectors per embedding model, the models read from the registry the app resolves its embedder from. - record.ts: the one paid step. It sends nothing without record mode and a spend cap, prints its estimate first and never sends a text twice. - brief-language.ts and its test: the three Norwegian pools ranked by semanticRelevance with each brief, 20 seeds, and what the zero-score rule keeps. The test runs where the recordings are; elsewhere it checks the committed result file. - results/production-brief-language.json: one block per model, counts only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…it learned The fit check worked down a fixed ranking, 50 companies in its first round, and every verdict was gone when the run ended. Now: - Rounds of ten. After each round the ranking of everyone not checked yet is redone from the verdicts so far, and the highest ranked go next: LinUCB over the candidates' embeddings (src/distribution/learn.ts), driven by the loop in src/distribution/shortlist.ts. Before any verdict the learner predicts the fixed ranking exactly; its first round is close to that order, not equal to it, because a bonus goes to companies unlike the ones already asked about. Companies matched by shared words (no embedder) are checked in the fixed order and rounds as before. - Verdicts are kept, one row per company and segment (distribution_fit_verdicts): the look at the listing, and what research found, which outranks it. The next run's ranking starts from them and from people's own decisions on the segment's deals (qualified, pursued or won is a yes; Not a fit is a no). The fit check's verdicts are kept under the question they answered: what the segment sells, who buys it and as what, what rules a company out, and where, as the run narrowed them. A rewritten or moved segment starts afresh; people's decisions always count. With no fit check to ask, earlier verdicts still order the list. - A fit check that breaks off part-way no longer leaves a shortlist of only the companies it got through, which with rounds of ten could be two. The places it left open go to the next companies down the ranking, unchecked; a company named outside the area that was never read stays out, as with no fit check. The run's warning now says which happened: nothing was checked, part of the list is unchecked, or only the read ones are on it. - The run sheet's Shortlist step has a Fit check row: how many companies were read and turned away, and how many earlier verdicts the ranking started from. A check that broke off shows as failed, with how far it got. English and Chinese. - A failure in any of this does not stop a run or its fit check. When verdicts cannot be read or kept the run learns from its own verdicts alone; a learner that cannot be built, or cannot rank (a stored embedding that is not a number), hands over to the fixed ranking. The log says which. Measured by replaying the benchmark's seven pools through this code (experiments/company-search/production-replay, 20 seeds, 95% intervals): embedding model today learner found in 100 checks nomic-embed-text (local) 59.2 80.7 +21.5 (+11.9 to +32.1) gemini-embedding-001 at 768 69.7 84.5 +14.9 (+5.1 to +25.2) text-embedding-3-large at 1536 67.0 82.5 +15.5 (+6.5 to +23.4) The first 25 checks are level on every model; the gain comes from about the 50th on. A 25-place shortlist fills in about 33 checks instead of 50 to 53, and most of that is the round size: the fixed order asked ten at a time needs 35 to 42. So a default run ends before the learner's lead has opened; the lead is what a longer search gets. Four of the fourteen pool and model pairs on the app's two built-in models are worse, by 0.2 to 1.7 companies in 100 checks. The replay ranks every company of a pool; with a run's relevance-above-zero rule applied first (--zero-score-rule) today's figures do not move and the three gains are +21.3, +15.9 and +16.1. On one pool judged in full by the real fit check (1,422 companies, the fast route of the committed chat configuration) the fit check agrees with the register on 96.8% of the companies, 3 of 200 verdicts changed when asked again, and the learner behaves as it does on the labels: +48.0 yes's in 100 checks where the fixed ranking is poor, +3.4 where it already finds 92. A second run on companies it has never seen, starting from the first run's kept verdicts, gets 9.6 yes's in its first ten checks against 4.4 starting from nothing where the ranking is poor, and 10.0 against 9.0 where it is good. Migration 20261124154024_distribution_fit_verdicts adds the one table; a changeset (minor, @launchstack/pipelines) describes the change for the package's consumers. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 7bffa279-ab34-4bb3-85ef-3f6ee418968a) |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd33fbaef9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| basis: "research", | ||
| segmentKey: segmentKey(program, run?.options), |
There was a problem hiding this comment.
Scope saved research verdicts to the question actually judged
For runs covering multiple territories or buyer kinds, the research check uses only relationship.territory and [relationship.kind], but this saves its answer under the entire run's segment key. For example, a run targeting Oslo and Bergen can assign a Norwegian company to Oslo (pickTerritory picks the first same-country territory), then research can reject it for being in Bergen—even though Bergen satisfies the full segment. That narrower rejection now replaces the full-segment listing verdict and trains subsequent runs as a negative; saveFitVerdicts also prevents later listing verdicts from correcting it because research takes precedence. Use the full run scope when judging a verdict saved under this key, or keep narrower research answers separate.
Useful? React with 👍 / 👎.
The fit check after research asks a narrower question than the run's look at the listings: would this company buy as the one kind of buyer, in the one area, it was filed under? Its verdict was kept under the run's key all the same. On a segment with several buyer kinds or areas, a no to one of them was then taken for the segment's answer (a company filed under the segment's first area may sit in its second): it replaced the listing's verdict, taught the next run's ranking a no, and a later look at the listing could not correct it. Now the verdict is kept under the question it answers (researchVerdictKey in src/distribution/shortlist.ts): - A yes goes under the run's key. A yes to one kind in one area is a yes to a run that asked for them among others. - A no goes under the narrower question's own key, where only a run that asks that same question reads it. So does a yes to a kind or area the run did not ask for. - A run that asks for one kind in one area has the same key both ways, so nothing changes there. Found by the automated review on the pull request. Tests: four unit tests for the key, and a test against a real database on a segment with two buyer kinds, which fails on the code before this change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…earch's main gained place search (#654), the pipelines tests in CI (#655), the claim check's company profile (#656) and contact details kept out of the fit check (#657). Place search's migration took journal slot 58, which this branch's migration also held. drizzle-kit builds on the snapshot whose name sorts last, and the migration runner requires every journal entry to be later than the one before, so this branch's migration cannot keep its earlier timestamp. drizzle-kit regenerated it after place search's, nothing edited by hand: 20261124154024_distribution_fit_verdicts is now 20261129231658_distribution_fit_verdicts, slot 59. Its SQL is byte-identical and its snapshot now builds on place search's. No deployed database ran the old tag; a local one that did needs its ledger row renamed to the new tag. Everything else merged without a conflict. The changeset names the new migration, and the experiments README says run.ts also runs e1-production now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scheduler (#658) merged with its migration at journal slot 59, where this branch's migration had just been placed. This time the migration keeps its name: 20261129231658_distribution_fit_verdicts is later than the scheduler's 20261129093142, so it moves to slot 60. drizzle-kit regenerated it on main's journal and the SQL came out byte-identical. The result was put back under the existing file name, snapshot id and journal time, as the recipe for a second merge does; the snapshot's contents and its link to the scheduler's snapshot are drizzle-kit's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d3c7e20. Configure here.
| table.companyId, | ||
| table.programId, | ||
| table.resolveKey | ||
| ), |
There was a problem hiding this comment.
Unique key wipes other-segment verdicts
Medium Severity
The unique index on distribution_fit_verdicts is per company and program, not per segmentKey. A research no is stored under the narrower researchVerdictKey, and setWhere only blocks a listing overwrite when the keys match, so a later listing save for the run's key replaces that row. The research finding is then gone for both the run's question and the narrower one, so a later run that actually asks that kind and area does not start from it.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit d3c7e20. Configure here.


Summary
Measured
The benchmark's pools replayed through the production code path (
pipelines/experiments/company-search/production-replay), 20 seeds, 95% intervals.Good companies found in 100 fit checks, seven pools, today's fixed ranking against the learner:
nomic-embed-text(the benchmark's local model)gemini-embedding-001at 768text-embedding-3-largeat 1536Good companies found in 100 checks by today's ranking, three Norwegian pools, English brief against Norwegian brief:
nomic-embed-textgemini-embedding-001at 768text-embedding-3-largeat 1536Related
Builds on #648 (the replayable company-search benchmark). These are items 3 and 4 of that work's plan, as two commits in that order: the measurement first (experiments only), then the product change. A third commit fixes the finding of the automated review on this PR (see Notes). Two merge commits bring in
main(#654 to #658). Place search (#654) and the scheduler (#658) each added a migration first, so this PR's migration was regenerated after theirs (see Notes).Checklist
pnpm checkpasses (lint + typecheck): on this headpnpm typecheckpasses for all workspace packages and eslint passes on the 33 files this PR changes againstmain. On the first merge (d20d311ac) the wholepnpm linthad 0 errors and 26 warnings, none of them in those files; the second merge only brought inmain's schedulerpnpm --filter @launchstack/web testpasses: CI'scheckjob on this head decides this box. Run locally the way CI runs it, with no key variable set, on the first merge: 782 of 789 suites and 10,931 tests pass and 6 suites skip. One suite,__tests__/server/vector-retriever.test.ts, timed out at 7.7 s while the machine was loaded and passed 3 of 3 runs on its own in about 90 ms; it is not touched here. After the second merge the 36 suites it can reach pass (378 tests: Prospects, distribution, Inngest, scheduler, model scope, catalogues).changeset/prospects-shortlist-learns.md, minor,@launchstack/pipelines)COMPANY_SEARCH_REPLAY_SEEDS, described in the folder's READMEdocs/manual-testing-guide.md, the experiments READMEs)Testing
Run locally on this head unless it says otherwise:
@launchstack/pipelinestests, as CI's new step runs them (CI: run the pipelines tests, which no job ran #655, with a scratch database): 99 files and 1,330 tests pass. 17 tests skip, all for want of the benchmark's recordings: 10 are this PR's replay tests, 6 are place search's sweep checks and 1 is from Company search experiments: a replayable benchmark for smarter Prospects search #648.fillShortlistandsemanticRelevanceand assert the effect beside today's ranking. The recordings hold public contact details of real people and are never committed, so these tests skip with a message anywhere else.results/production-*.json) are reproduced byte for byte by nine full-seed replays.enrichCandidate, research's no on a segment with two buyer kinds, a moved area starts afresh), plus adapter and catalogue tests for the new row in both languages. The one for two buyer kinds fails without the review fix.drizzle-kit check, the journal check, both drift probes (no diff),check-no-pushandcheck-schema-boundarypass. The engine set alone builds a database with no dangling foreign keys; both sets apply to an empty database, a second run is a no-op, and the result matches a schema pushed from TypeScript line for line (4,995 lines).In the browser:
Notes for reviewers
distribution_fit_verdictskeeps one row per company and segment: name, listing text, verdict and the model's reason, for companies turned away as well. It is deleted with the workspace or the segment. Migration20261129231658_distribution_fit_verdicts.20261129231658_distribution_fit_verdictsat slot 60, after both; before the first merge it was20261124154024_distribution_fit_verdicts. Its SQL is unchanged byte for byte. No deployed database ran the old name. A local one that did has a ledger row to rename, with the same checksum:UPDATE _launchstack_web_migrations SET tag = '20261129231658_distribution_fit_verdicts' WHERE tag = '20261124154024_distribution_fit_verdicts'.segmentKey: offering, categories, constraints, buyer kinds and area, as the run narrowed them). Any edit to those, a typo fix included, starts them afresh.researchVerdictKey), so on a segment with several kinds or areas a no to one of them is not taken for the segment's answer. This is the third commit, from the automated review's finding; a database test on a segment with two buyer kinds fails without it.apps/web/__tests__/middleware/request-body-after-middleware.test.tsis timing-fragile onmainand is not touched here. Two database tests timed out once in a loaded local run and passed on their own:__tests__/server/vector-retriever.test.tsand the Scenarios store tests. Neither is touched here.🤖 Generated with Claude Code