[Security Solution] Batched Attack Discovery with hierarchical merge#257831
Closed
patrykkopycinski wants to merge 2 commits intoelastic:mainfrom
Closed
[Security Solution] Batched Attack Discovery with hierarchical merge#257831patrykkopycinski wants to merge 2 commits intoelastic:mainfrom
patrykkopycinski wants to merge 2 commits intoelastic:mainfrom
Conversation
Removes the alert count ceiling from Attack Discovery by implementing batch processing with LLM-based hierarchical merge. Large alert sets are split into batches, processed in parallel through the existing AD graph, then consolidated via a dedicated merge LLM pass that identifies and combines related attacks across batches. Key changes: - batch/split.ts: adaptive batch sizing from LLM context window, alert splitting - batch/merge.ts: hierarchical merge with LLM consolidation pass and quality metrics - batch/orchestrator.ts: batch orchestration with concurrency control - batch/types.ts: interfaces, constants, known context windows - invoke_attack_discovery_graph: routing to batched path when alerts exceed batch size Ref: elastic/security-team#16339
Contributor
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
Contributor
Author
|
/ci |
1 similar comment
Contributor
Author
|
/ci |
…known[] Fixes TS2322 error where spreading unknown[] tracers into callbacks parameter expected (BaseCallbackHandler | BaseCallbackHandlerMethodsClass)[].
Contributor
Author
|
/ci |
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
|
5 tasks
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.
Summary
Removes the alert count ceiling from Attack Discovery by implementing batch processing with LLM-based hierarchical merge. This enables Attack Discovery to process arbitrarily large alert sets by splitting them into manageable batches, running the existing AD graph on each batch in parallel, then consolidating discoveries across batches using a dedicated LLM merge pass.
Ref: elastic/security-team#16339 (Task 0B — Remove alert count ceiling)
Architecture
Key Components
batch/split.tsbatch/merge.tsbatch/orchestrator.tsbatch/types.tsinvoke_attack_discovery_graphAdaptive Batch Sizing
Batch size is computed from the LLM connector's context window:
Supports known model lookups (GPT-4o, Claude 3.x, Gemini) with partial matching, explicit context window override, and graceful fallback to default (50).
Hierarchical Merge Strategy
Quality Metrics
Every batched run produces
MergeQualityMetrics:consolidationRatio— how many discoveries were merged (1.0 = none, lower = more consolidation)alertCoverage— ratio of alert IDs preserved after merge (should be 1.0)batchesProcessed/batchesFailed— batch success trackingtotalDurationMs/mergeDurationMs— performance trackingError Handling
Promise.allSettled)Configuration
batchSizemaxBatchesconcurrencyTesting
split.test.ts— batch splitting, adaptive sizing, model lookup, edge casesmerge.test.ts— single/multi-batch merge, metrics, error handling, replacement combiningorchestrator.test.ts— single/multi-batch orchestration, concurrency, failure resilienceTest plan
yarn test:jest ...batch/)Made with Cursor