Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(retrieval): bounded-concurrency fact extraction (facts on _m)#291

Closed
jamby77 wants to merge 2 commits into
feature/longmemeval-query-decompositionfrom
feature/longmemeval-facts-concurrency
Closed

feat(retrieval): bounded-concurrency fact extraction (facts on _m)#291
jamby77 wants to merge 2 commits into
feature/longmemeval-query-decompositionfrom
feature/longmemeval-facts-concurrency

Conversation

@jamby77

@jamby77 jamby77 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Part of the LongMemEval recall→QA epic (item 205255004). Stack 7/7 — base feature/longmemeval-query-decomposition.

Addresses KIvanow's note that the facts lever was impractical on _m (~475 sessions/record → ~237k sequential extraction calls). Per-session extraction is independent, so it now runs via a bounded, order-preserving mapWithConcurrency (default 8, LONGMEMEVAL_FACTS_CONCURRENCY); only reconcile stays sequential. Curated facts + chunks are byte-identical to before. 3 tests.

This unblocks a real _m ablation of facts — and is a prerequisite for Phases 7 (graph) / 8 (preference), which extend the facts pipeline.


Note

Low Risk
Changes are confined to the LongMemEval eval harness; reconcile order is unchanged and tests lock concurrency semantics, with only operational risk from higher parallel LLM usage.

Overview
Makes the LongMemEval facts lever practical on large _m haystacks by running per-session LLM extraction in parallel instead of one-by-one, while keeping the chronological reconcile pass sequential so curated facts stay the same.

Adds mapWithConcurrency: order-preserving parallel map with a worker cap; the first failure rejects the run and stops scheduling further callbacks (to avoid extra paid LLM calls). consolidateRecordFacts uses it for all haystack sessions (default concurrency 8, overridable via LONGMEMEVAL_FACTS_CONCURRENCY and factsConcurrency on runEval). Vitest covers ordering, concurrency limits, fail-fast behavior, and one-call-per-session extraction.

Reviewed by Cursor Bugbot for commit fca29ff. Bugbot is set up for automated code reviews on this repo. Configure here.

@jamby77 jamby77 force-pushed the feature/longmemeval-query-decomposition branch from 86a4dc4 to 0429b41 Compare July 3, 2026 06:37
@jamby77 jamby77 force-pushed the feature/longmemeval-facts-concurrency branch from 457eae2 to 20ea924 Compare July 3, 2026 06:37
@jamby77

jamby77 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

Review follow-up pushed (20ea924): mapWithConcurrency had no shared abort flag — when one extraction call rejected, surviving workers kept draining the queue (on _m, up to 7 workers issuing paid calls for hundreds of remaining sessions). Workers now stop dispatching after the first failure; the error still propagates.

The whole stack (#285#296) was re-stacked and force-pushed with these fixes; full suite 206/206 at the top, offline baseline byte-identical.

jamby77 added 2 commits July 3, 2026 10:07
Per-session fact extraction was serial — impractical on _m (~475 sessions per
record => ~237k sequential LLM calls for a full run). Extract sessions in
parallel via a bounded, order-preserving mapWithConcurrency (default 8,
LONGMEMEVAL_FACTS_CONCURRENCY); only the reconcile pass stays sequential.
Curated facts and chunks are unchanged.
mapWithConcurrency had no shared abort flag: when one extraction call
rejected, Promise.all rejected the caller but the surviving workers kept
draining the queue — on longmemeval_m up to 7 workers issuing paid LLM
calls for hundreds of remaining sessions. Set a failed flag in the worker
loop and stop dispatching; the first error still propagates.
@jamby77 jamby77 force-pushed the feature/longmemeval-facts-concurrency branch from 20ea924 to fca29ff Compare July 3, 2026 07:10

@KIvanow KIvanow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented as part of #299 on the library level. Should be closed

@jamby77

jamby77 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Closing per review — superseded by #299 (bounded-concurrency fact extraction now at the library level). Branch kept.

@jamby77 jamby77 closed this Jul 6, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants