-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Problem
ReduceSynthesis and GroupSynthesis concatenate all input artifacts into a single prompt string with no token/size limit:
artifacts_text = "\n\n---\n\n".join(f"### {a.label}\n{a.content}" for a in sorted_inputs)For large corpora (hundreds or thousands of artifacts), this will exceed context windows and cause hard failures with no useful error message.
Impact
- O(total_input_size) memory and token usage
- Silent failures when prompt exceeds model context window
- Affects both
ReduceSynthesis(all inputs → 1 output) andGroupSynthesis(per-group concatenation)
Suggested approach
- Add an optional
max_tokensorcontext_budgetparameter (likeCoreSynthesishas) - Truncate or chunk inputs when they'd exceed the limit
- Log a warning when truncation occurs
- Consider automatic chunking with recursive reduce for very large input sets
Scope
This is a scale optimization — the current implementation works correctly for typical pipeline sizes (dozens of artifacts). It only becomes a problem with large corpora.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels