Conversation
Introduces AutoChunking for automatic splitting of large knowledge documents into context-window-sized chunks, distributed across debate rounds via progressive disclosure. Adds new Chunking namespace (AutoChunker, AutoChunkingOrchestrator, options, plan/record types), model capabilities registry, and DI/appsettings integration. All debate strategies now support round-aware chunk distribution. Includes new configuration options, DI auto-wiring, and a console example. Docs and config updated. No breaking changes; feature is opt-in and backward compatible.
Refactored text splitting to use single-pass, allocation-free span-based scans for headers, sentences, and separators, improving performance and memory usage. Added LRU memoization to TokenCounter. Reused sub-compressor instances in HybridCompressor. Centralized CouncilBuilder defaults. Replaced string.Split substring counting with a custom method in KnowledgeKeeper. Switched to index-based chunk selection in PromptContext. Parallelized model capability queries in AutoChunkingOrchestrator.
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.
Pull Request
Description
v10.2.3 — AutoChunking + Performance Enhancements
This PR delivers two major bodies of work:
1. ✂️ AutoChunking — Progressive Disclosure for Large Documents
When a knowledge document (contract, report, article) exceeds the smallest model's context window, Delibera now automatically splits it into chunks and distributes them across debate rounds via progressive disclosure. Every model receives a complete view of the document by the final round — no more silent context truncation or API errors.
Key additions:
Chunkingnamespace —AutoChunker(3 strategies:SemanticBoundary,FixedSize,SlidingWindow),AutoChunkingOrchestrator,AutoChunkingOptionsModelCapabilitiesrecord +ModelContextWindowRegistry(40+ pre-registered models: Llama, Qwen, DeepSeek, Phi, Mistral, Gemma, GPT, Claude, YandexGPT…)ILLMProvider.GetModelCapabilitiesAsync()— Ollama queries/api/showfornum_ctx; other providers fall back to the registryPromptContextextended withChunkingPlan,AutoChunkingEnabled,MinContextWindow,GetChunkedUserPrompt()StandardDebate,CritiqueDebate,ConsensusDebate) useBuildChunkedPrompt()for round-aware chunk distributionCouncilBuilder.WithOptions()— three configuration paths: fluent API,CouncilOptionssnapshot, inline lambda.CouncilBuilder(CouncilOptions)constructor for one-shot setupIOptions<CouncilOptions>→CouncilBuilderconstructor automaticallyAutoChunkingConfiginCouncilOptionswith fullappsettings.jsonbindingdotnet run -- --autochunking2. ⚡ Performance Enhancements — High Availability & High Performance
Full audit of the hot paths across the entire codebase. 9 fixes applied:
AutoChunker.SplitByHeadersIndexOfin while-loop)ReadOnlySpan<char>scanSemanticCompressor.SplitSentencesIndexOfin while-loop)AutoChunkingOrchestratorTask.WhenAll— parallel queriesAutoChunker.SplitBySeparatorsstring.Split()array allocationsIndexOf+ manual splitKnowledgeKeeperchunk countingcontext.Split("[Source ").Length - 1CountOccurrences()—IndexOfloopPromptContext.GetChunkedUserPrompt.Skip().Take().ToList()LINQ allocationsforloopHybridCompressornew DeduplicationCompressor()etc. on every call_dedup/_semantic/_summarizerfieldsTokenCountermemoizationLinkedList<string>+ batch eviction (64)CouncilBuilder.ApplyOptionsDefaultStrategy,DefaultMaxRounds,DefaultTemperatureAlready-optimized code confirmed correct:
CompressionCache—ArrayPool<T>,stackalloc,ReaderWriterLockSlim, batch evictionSemanticCompressor.CosineSimilarity— SIMDVector<float>hardware accelerationDeduplicationCompressor—CollectionsMarshal.AsSpan(), batch processing (16)TokenCounter.EstimateTokens(ReadOnlySpan<char>)— allocation-freeOllamaProvider—Polly.ResilienceContextPool.SharedDocumentation
CHANGELOG.md— full[10.2.3]sectionREADME.md/README-RU.md— new AutoChunking section (how it works, 3 config paths, appsettings, model registry)src/Delibera.Core/README.md(NuGet) — AutoChunking section + updated appsettings exampleDelibera.Core.csproj— version10.2.2→10.2.3, updatedDescription,PackageTags,PackageReleaseNotesRelated Issues
N/A — feature-driven release.
Type of Change
Checklist
dotnet build --configuration Release)README.md,README-RU.md,CHANGELOG.md, NuGet README)Additional Notes
ILLMProviderimplementations continue to work (defaultGetModelCapabilitiesAsyncreturnsnull).PromptContextis arecordwithwith-expression support.--autochunkingconsole example includes an offline mode that demonstrates chunking plans for 4K/8K/32K/128K context windows without requiring a running Ollama instance.