An adaptive document chunk retrieval method based on semantic boundary perception and context embedding alignment

By adopting an adaptive document segmentation method based on projection similarity and context awareness, the problems of inaccurate semantic boundary detection and lack of global context in block embedding in existing technologies are solved, and efficient document retrieval performance is improved.

CN123157744APending Publication Date: 2026-11-24AFFILIATED HUSN HOSPITAL OF FUDAN UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611119766.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-27
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing document chunking retrieval methods suffer from insufficient accuracy in semantic boundary detection, lack of document global context awareness in chunk embedding, and disconnect between chunking strategies and retrieval strategies, leading to unstable retrieval performance.

Method used

We employ a method based on projection similarity semantic boundary detection, context-aware block embedding alignment, and query-adaptive retrieval planning. Through the construction of a multi-granularity semantic feature pyramid, a projection similarity block segmentation module, a delayed block segmentation mechanism, and a query-aware adaptive retrieval planner, we achieve end-to-end adaptive document block retrieval.

Benefits of technology

It improves retrieval accuracy, maintains low computational overhead, and demonstrates stable retrieval performance improvement across various retrieval scenarios and datasets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157744A_ABST
    Figure CN123157744A_ABST
Patent Text Reader

Abstract

This invention discloses an adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment. The method includes: constructing a multi-granularity feature pyramid that integrates sentence-level, paragraph-level, and document-level semantic information; detecting semantic boundaries between adjacent text segments to generate semantically complete variable-length document chunks; injecting the complete document context into the chunk embedding vector through a delayed chunking mechanism, and using dual-channel contrast training with intra-sequence negative samples and cross-document hard negative examples to align the semantic representations of different chunks within the same document; modeling the retrieval granularity selection as a Markov decision process and optimizing it through policy gradients; and achieving end-to-end alignment of chunking strategy, embedding representation, and retrieval planning through a two-layer optimization framework. This invention overcomes problems such as fixed-length chunking fragmenting semantic units, independent chunk encoding losing the global document context, and the disconnect between chunking strategies and retrieval requirements, improving retrieval accuracy while maintaining low computational overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of natural language processing, information retrieval, and retrieval enhancement generation technology, specifically to an adaptive document chunking and embedding representation method for large-scale document retrieval, and particularly to an adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment. Background Technology

[0002] With the widespread application of large language models in question-answering systems, knowledge base construction, and intelligent assistants, Retrieval-Augmented Generation (RAG) has become a core technological paradigm for improving the factual accuracy and knowledge coverage of models. The basic workflow of a RAG system is as follows: the document set is pre-segmented into text blocks and encoded into vector indices; when a user query arrives, the most relevant text block is retrieved; and the retrieval results are provided as context to the large language model for answer generation.

[0003] In the RAG system, document chunking strategies directly impact retrieval quality. Existing chunking methods mainly fall into the following categories: First, fixed-length chunking, which divides the text evenly according to a preset number of tokens or characters, achieving a simple but frequent fragmentation of semantic units, resulting in incomplete chunk information retrieved; second, recursive chunking, which uses paragraph marks, periods, and other delimiters for hierarchical segmentation, preserving the text structure to some extent but failing to perceive semantic content; and third, semantic chunking based on embedding similarity, which determines semantic boundaries by calculating the cosine similarity of the embedding vectors of adjacent sentences or paragraphs, improving the semantic coherence of chunking to some extent.

[0004] However, existing semantic segmentation methods still have the following shortcomings: First, cosine similarity as a boundary judgment criterion has inherent limitations. Its absolute value in the embedding space is affected by multiple factors such as the embedding model, text domain, and text length. A single threshold is difficult to adapt to diverse document structures and is prone to boundary blurring or over-segmentation in semantically transitional regions. Second, existing methods encode text blocks independently. Each block cannot perceive the global context of its document during encoding, resulting in semantically related paragraphs within the same document but segmented into different blocks losing their association information, weakening the recall capability of downstream retrieval. Third, the segmentation strategy and retrieval strategy are independent of each other. Once the segmentation is fixed in the preprocessing stage, it is not adjusted and cannot be dynamically optimized according to query type and retrieval feedback. This leads to significant fluctuations in retrieval performance when facing heterogeneous queries with a fixed segmentation strategy.

[0005] Therefore, there is an urgent need for a document chunking retrieval method that can accurately detect document boundaries at the semantic level, preserve the global context of the document in chunk embedding, and adaptively adjust the retrieval strategy based on query feedback. Summary of the Invention

[0006] To address the problems of insufficient semantic boundary detection accuracy, lack of document-level context awareness in block embedding, and disconnect between block segmentation and retrieval strategies in existing document segmentation retrieval methods, this invention proposes an adaptive document segmentation retrieval method based on semantic boundary awareness and context embedding alignment. This method achieves efficient document retrieval based on projection similarity semantic boundary detection, context-aware block embedding alignment, and query adaptive retrieval planning. It can overcome problems such as fixed-length blocks fragmenting semantic units, loss of global document context due to independent block encoding, and disconnect between block segmentation strategies and retrieval requirements, while improving retrieval accuracy and maintaining low computational overhead.

[0007] This invention utilizes a projection similarity block-sharing mechanism to map the embeddings of adjacent text segments to a learned similarity space for semantic boundary determination, overcoming the limitations of fixed threshold cosine similarity. It employs a delayed block-sharing mechanism for comparative training with negative samples within the sequence, enabling block embeddings to retain local specificity while absorbing document-level global semantic context. A query-aware adaptive retrieval planner dynamically selects the retrieval granularity based on the query type. A two-layer optimization framework aligns the block-sharing strategy, embedding representation, and retrieval plan as learnable components end-to-end, allowing each module to collaboratively improve the final retrieval performance. The technical solution of this invention is described in detail below.

[0008] An adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment includes the following sequentially executed steps:

[0009] Step 1: Construction of a Multi-Granularity Semantic Feature Pyramid

[0010] We acquire a document set, a pre-trained embedding model, and a validation query set. We perform three-layer granular encoding at the sentence, paragraph, and document levels for each document. We inject document-level and paragraph-level semantic information into the sentence-level embedding representation through a cross-level attention fusion mechanism to construct a hierarchical semantic feature pyramid.

[0011] Step 2: Semantic Boundary Detection and Adaptive Block Segmentation

[0012] The adjacent sentence-level embedding vectors (forming adjacent text segment pairs) after cross-level attention fusion are input into the projection similarity segmentation module to calculate the projection similarity score between adjacent segments in the learnable projection space. At the same time, the semantic continuity is evaluated from three dimensions: cosine similarity, Euclidean distance, and weak attention association score using the metric fusion segmentation module. The weighted fusion of projection similarity score and metric fusion score generates a boundary confidence sequence. The semantic boundary position is determined by an adaptive threshold, and the document is segmented into semantically complete and variable-length candidate text blocks.

[0013] Step 3: Context-Enhanced Block Embedding Representation Learning Phase

[0014] A delayed block segmentation mechanism is adopted to encode the continuous text containing multiple candidate text blocks as a whole into the pre-trained embedding model. In the final pooling layer, the block embedding vectors are obtained by segmented pooling according to the block boundaries. The embedding model is post-trained by training with negative samples within the sequence. Other blocks within the same document are used as negative samples within the sequence, and randomly sampled blocks across documents are used as negative samples within the batch. A dual-channel hybrid contrastive loss function is constructed so that the embedding vectors of different blocks within the same document maintain local specificity in the semantic space while sharing the document-level global semantic context.

[0015] Step 4: Query-Aware Adaptive Retrieval Planning Phase

[0016] A query analyzer is built to classify the intent of the input query; the retrieval planner dynamically determines the retrieval granularity configuration based on the query category, performs the retrieval on each granularity channel and performs weighted fusion of the results, with the weight coefficients jointly determined by the query category and the retrieval confidence.

[0017] Step 5: End-to-end two-layer optimization phase

[0018] The parameters of the semantic boundary detector in step two (including the parameters of the PSC projection network and the MFC fusion layer) and the parameters of the embedding model in step three are used as inner-layer learnable variables and optimized on the training document set with the goal of maximizing retrieval performance. The parameters of the retrieval planner in step four are used as outer-layer learnable variables and optimized on the validation query set using the policy gradient method. The inner and outer layers are iterated alternately until the retrieval performance of the semantic boundary detector, the embedding model, and the retrieval planner on the validation query set converges. After optimization, end-to-end document segmentation, embedding indexing, and query retrieval are performed on the target document set.

[0019] In this invention, in step one, the pre-trained embedding model is a text encoder based on the Transformer architecture, including a BERT-like bidirectional encoder or a dense retrieval encoder pre-trained based on contrastive learning; the document set includes at least one of natural language text, technical documents, legal documents, and medical literature.

[0020] In this invention, step one, the cross-level attention fusion mechanism includes: for each sentence-level embedding vector, calculating its attention weights with its corresponding paragraph-level embedding vector and with the document-level global embedding vector; injecting paragraph-level and document-level semantic information into the sentence-level embedding representation using a weighted residual method; the fused sentence-level embedding vector is... ,in Let be the initial embedding vector for the i-th sentence. Embed vectors for the corresponding paragraphs. For document-level global embedding vectors, and These are learnable fusion weight coefficients.

[0021] In this invention, in step two, the projection similarity segmentation module consists of two fully connected network layers connected in series. The first fully connected network layers map the concatenated representation of adjacent sentence-level embedding vectors to a d-dimensional feature space and perform a nonlinear transformation using the GELU activation function. The second fully connected network layers further map the transformed features to a scalar and output the projection similarity score using the Sigmoid activation function. The projection network is trained under supervision using a training document set with labeled semantic boundary positions and binary cross-entropy loss, enabling the projection network to learn to map semantic boundary positions to low similarity regions and non-boundary positions to high similarity regions.

[0022] In this invention, in step two, the metric fusion block module obtains the weak attention association score in the following way: extracting the attention matrix of the intermediate layer of the pre-trained embedding model, calculating the average cross-segment attention weight between tokens corresponding to adjacent text segments, and using the normalized value of the weight as the weak attention association score; a lower cross-segment attention weight indicates that there is a semantic break at that position.

[0023] In this invention, in step two, the adaptive threshold is dynamically calculated based on the degree of drastic local semantic changes in the document: for each document, the mean of its boundary confidence sequence is calculated. and standard deviation Set adaptive threshold , where γ is the sensitivity parameter; positions where the boundary confidence is lower than the adaptive threshold are marked as semantic boundaries.

[0024] In this invention, in step three, the dual-channel hybrid contrast loss function is:

[0025]

[0026] in, This represents the cosine similarity between the query embedding and the block embedding. For temperature coefficient, This represents the set of negative samples within a sequence from the same document. This represents the set of negative samples within a batch from other documents. This is the mixing coefficient used to control the weights of negative samples within the sequence.

[0027] In this invention, step three further introduces a cross-document hard negative example mining mechanism: for each positive example block, the block with the highest cosine similarity but from a different document and unrelated to the query is retrieved in the embedding space, and the retrieved block is added as a hard negative example to the training batch to tighten the decision boundary in the embedding space.

[0028] In this invention, in step four, the query analyzer consists of a query encoder based on a pre-trained language model and a linear classification head, which classifies the input query into factual, inferential, summary, or comparative query categories; the retrieval planner determines the main retrieval granularity, the multi-granularity fusion weight vector, and the number of neighbor blocks for extended retrieval based on the preset retrieval granularity configuration corresponding to the query category.

[0029] In this invention, in step four, the granularity selection action of the retrieval planner is modeled as a Markov decision process, where the state is the query embedding vector and the current retrieval configuration, the action is to select or adjust the retrieval granularity, and the reward is the normalized depreciation cumulative gain or the average reciprocal ranking on the validation query set; the retrieval planner parameters are optimized using the policy gradient method.

[0030] In this invention, in step five, the end-to-end two-layer optimization adopts a phased freezing strategy: the first round of optimization only trains the block module parameters and retrieval planner parameters while freezing the embedding module parameters; the second round of optimization unfreezes the embedding module parameters and fine-tunes them with a learning rate smaller than that of the outer layer; the third and subsequent rounds jointly optimize the three; when the improvement in retrieval performance on the verification query set is lower than the preset convergence threshold after three consecutive rounds of outer layer optimization, the optimization is determined to have converged and the iteration is stopped.

[0031] In this invention, the method is also applicable to standard document segmentation scenarios without retrieval enhancement: in this scenario, only the modules of steps one and two are used to perform multi-granular semantic feature extraction and semantic boundary detection, outputting semantically complete and variable-length document segmentation results for text summarization, discourse analysis and knowledge graph construction tasks.

[0032] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0033] This invention can overcome problems such as fixed-length block segmentation of semantic units, loss of document global context due to independent block encoding, and the disconnect between block segmentation strategy and retrieval requirements, thereby improving retrieval accuracy while maintaining low computational overhead. Attached Figure Description

[0034] Figure 1 This invention presents a schematic diagram of the overall process of an adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment.

[0035] Figure 2 This diagram illustrates a comparison of boundary detection performance between projection similarity segmentation and traditional cosine similarity semantic segmentation in this invention. The top image shows the boundary blurring problem in semantically transitional regions using the traditional cosine similarity method, while the bottom image shows the clear boundary determination in projection space using the PSC method of this invention.

[0036] Figure 3This diagram illustrates the comparison between delayed block context-aware coding and independent block coding mechanisms in this invention. The top diagram shows that in the traditional independent coding method, each block loses the global document context, while the bottom diagram shows that in delayed block coding, cross-block attention interaction preserves global semantic information.

[0037] Figure 4 This diagram illustrates the performance comparison of the present invention with various document chunking retrieval baseline methods on the MS MARCO, Natural Questions, HotpotQA, TriviaQA, and FEVER datasets. Detailed Implementation

[0038] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the following embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. Any scheme that makes equivalent substitutions or conventional modifications to the embedding model, block parameters, retrieval strategy, loss function, or optimizer under the concept of the present invention should fall within the scope of protection of the present invention.

[0039] This invention provides an adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment, such as... Figure 1 As shown, it includes the following steps:

[0040] Step 1: Multi-granularity semantic feature pyramid construction stage. The system receives a document set, a pre-trained embedding model, a validation query set, and target retrieval configuration parameters. For each document, it performs three levels of granular encoding: sentence-level, paragraph-level, and document-level, constructing a hierarchical semantic feature pyramid from fine-grained to coarse-grained. Sentence-level encoding captures local semantic units, paragraph-level encoding retains medium-granularity structural information, and document-level encoding provides global semantic anchors. Based on this, a cross-level attention fusion mechanism injects high-level semantic information into low-level representations, enabling sentence-level and paragraph-level embeddings to acquire document-level semantic awareness capabilities during the encoding stage.

[0041] Step 2: Semantic Boundary Detection and Adaptive Chunking. The system inputs the adjacent sentence-level embedding vectors enhanced with cross-level attention into the trained Projected Similarity Chunking (PSC) module. This module maps the embedding pairs of adjacent segments to a learnable projection space, calculates the projection similarity score in this space, and determines the semantic boundary position by comparing the score with an adaptive threshold. Simultaneously, a Metric Fusion Chunking (MFC) module is introduced to fuse cosine similarity, Euclidean distance, and weak attention association scores extracted from the intermediate layers of the pre-trained model, forming a multi-dimensional semantic boundary confidence score. The system uses the PSC output as the primary criterion and the MFC output as the secondary criterion, generating the final semantic boundary marker sequence through weighted fusion, thereby segmenting the document into a set of semantically complete, variable-length candidate text blocks.

[0042] Step 3: Context-Enhanced Block Embedding Representation Learning Stage. The system employs a delayed block segmentation mechanism to perform context-aware encoding on the candidate text blocks generated in Step 2. Specifically, the entire document (or a large-scale paragraph of the document) to which each text block belongs is first input into the embedding model for encoding. This allows the model to maintain global attention interaction across blocks during the encoding process, and segmented pooling is only performed at the block boundaries in the final pooling layer, thus obtaining the context-aware embedding vector for each block. Based on this, the system performs post-training on the embedding model through In-Sequence Negative Training (InSeNT): For several blocks from the same document, the positive block matching the query is used as the anchor point, other blocks within the same document are used as in-sequence negative samples, and randomly sampled blocks across documents are used as batch negative samples. A dual-channel hybrid contrastive loss function is constructed, so that the embeddings of different blocks within the same document maintain their own specificity while sharing the document-level semantic context in the semantic space.

[0043] Step 4: Query-Aware Adaptive Retrieval Planning Phase. The system constructs a lightweight query analyzer, classifying input queries into factual, inferential, summary, or comparative query categories. Based on the query category, the retrieval planner dynamically determines the retrieval granularity configuration: for factual queries, it prioritizes retrieving fine-grained sentence-level blocks to improve the probability of exact matches; for inferential queries, it expands the retrieval of preceding and succeeding blocks in the original document while retrieving medium-grained paragraph blocks to preserve the inference chain; for summary queries, it expands the retrieval scope to coarse-grained paragraph blocks to cover a wider range of topical information. The retrieval planner further weights and fuses the retrieval results from each granularity channel, with the weight coefficients jointly determined by the query category and the retrieval confidence level.

[0044] Step 5: End-to-End Two-Layer Optimization Phase. The system uses the block boundary parameters from Step 2 and the embedding model parameters from Step 3 as inner-layer learnable variables, performing inner-layer optimization on the training document set with the goal of maximizing retrieval performance metrics. The retrieval planner parameters from Step 4 are used as outer-layer learnable variables, performing outer-layer optimization on the validation query set using a policy gradient method. In the outer-layer optimization, the granularity selection action of the retrieval planner is modeled as a Markov decision process, using the normalized depreciation cumulative gain or average reciprocal rank on the validation query set as the reward signal, and updating the planner parameters through policy gradient. The inner and outer layers iterate alternately until the retrieval performance of the semantic boundary detector, embedding model, and retrieval planner converges on the validation query set. After optimization, the system utilizes the final semantic boundary detector, context-aware embedding model, and retrieval planner to perform end-to-end document block segmentation, embedding indexing, and query retrieval on the target document set.

[0045] A typical embodiment of the present invention is as follows.

[0046] First, the system loads a document set, a pre-trained embedding model, a validation query set, and the target retrieval configuration. The document set is represented as a corpus containing several natural language documents, each containing a title, body text, and optional structured metadata. The pre-trained embedding model can be a general-purpose text encoder based on the Transformer architecture, such as a BERT-like bidirectional encoder, or a dense retrieval encoder pre-trained based on contrastive learning. The validation query set contains several natural language queries and their corresponding relevance-annotated documents or paragraphs. The system also receives retrieval configuration parameters, including the target top-k retrieval count, the maximum block length threshold, and the minimum block length threshold. In a preferred implementation, the maximum block length is set to 512 tokens, the minimum block length is set to 64 tokens, and the top-k retrieval count is set to 10 or 20.

[0047] Secondly, the system constructs a multi-granularity semantic feature pyramid for each document. Specifically, the system first segments the document using sentences as the basic unit, and independently encodes each sentence using a pre-trained embedding model to obtain a sequence of sentence-level embedding vectors. Subsequently, the system merges adjacent sentences according to natural paragraph boundaries and encodes each paragraph as a whole to obtain a paragraph-level embedding vector. Finally, the system encodes the complete document (when the document length exceeds the maximum input length of the embedding model, representative paragraphs from the beginning, middle, and end are concatenated) to obtain a document-level global embedding vector. These three layers of embedding constitute a hierarchical semantic feature pyramid from local to global.

[0048] In a preferred embodiment, the system further enhances the low-level feature representation through a cross-level attention fusion mechanism. Specifically, for each sentence-level embedding vector, the system calculates its attention weights with its corresponding paragraph-level embedding vector and with the document-level global embedding vector, injecting paragraph-level and document-level semantic information into the sentence-level representation in a weighted residual manner. The fused sentence-level embedding vector can be represented as:

[0049]

[0050] in, This represents the initial embedding vector for the i-th sentence. This represents the embedding vector of the paragraph to which the sentence belongs. Represents a document-level global embedding vector. and Here, the fusion weights are learnable, and `Attention` represents the scaled dot product attention function. After cross-level attention fusion, the sentence-level embedding vectors gain semantic awareness capabilities at the paragraph and document levels while preserving local semantic details, providing a richer information foundation for subsequent semantic boundary detection.

[0051] Then, the system performs semantic boundary detection and adaptive segmentation. The core components of this stage are the Projection Similarity Segmentation (PSC) module and the Metric Fusion Segmentation (MFC) module.

[0052] The working mechanism of the PSC module is as follows. For adjacent sentence-level embedding vectors after cross-level attention fusion... and The system concatenates the segments and inputs the concatenated vectors into a learnable projection network. This projection network consists of two fully connected layers, with the middle layer using the GELU activation function, and the output layer mapping the concatenated vectors to a d-dimensional projection space. In the projection space, the system calculates the projection similarity score between adjacent segments:

[0053]

[0054] in, , , , These are the learnable parameters of the projection network. It is the Sigmoid activation function. This represents a vector concatenation operation. Projective similarity score. The value range is [0,1]. The higher the score, the more semantically continuous the adjacent segments are, and the less likely they are to be semantic boundaries.

[0055] The training process of the projection network is as follows. The system uses a training document set labeled with semantic boundary positions to supervise the training of the PSC module. For each adjacent segment pair (i.e., adjacent sentence-level embedding vectors after cross-level attention fusion), if the position is a semantic boundary, it is assigned a label 0; otherwise, it is assigned a label 1. The training loss uses binary cross-entropy loss.

[0056]

[0057] in, The boundary labels are defined as follows. By optimizing the projection network parameters on the loss function described above, the PSC module learns to map semantic boundary locations to low-similarity regions and non-boundary locations to high-similarity regions in the projection space.

[0058] Compared to directly using cosine similarity for boundary determination in the original embedding space, the key advantage of the PSC module is that the projection network can learn a feature subspace that is discriminative for semantic boundary determination, rather than relying on global geometric structures in the original representation space of the embedding model that may not be suitable for boundary detection. In a preferred implementation, the projection dimension d is set to 128 or 256, and the projection network is pre-trained on large-scale document corpora such as PubMed or MS MARCO.

[0059] The MFC module, acting as an auxiliary judge for the PSC module, independently evaluates the semantic continuity of adjacent segments from multiple metric dimensions. Specifically, the MFC module calculates the following metrics between adjacent segment embeddings: (1) cosine similarity; (2) the normalized reciprocal of the Euclidean distance; and (3) the weak attention association score. The weak attention association score is obtained by extracting the attention matrix from the intermediate layers (preferably layers 8 to 12) of the pre-trained embedding model and calculating the average attention weight between corresponding tokens of adjacent segments. A lower cross-segment attention weight means that the model pays less attention to cross-segment information interaction during encoding, suggesting a possible semantic break at that position. After standardization, the above three metrics are merged into the MFC comprehensive score through a lightweight linear fusion layer.

[0060] The system uses PSC scores. Main criterion, MFC composite score To assist in the judgment, the final boundary confidence score is generated through weighted fusion:

[0061]

[0062] in, To achieve the fusion weights, a preferred implementation sets them to 0.7. The system then considers the boundary confidence sequence. , ,..., The system searches for local minima and marks locations with confidence scores below an adaptive threshold τ as semantic boundaries. The adaptive threshold τ is not a globally fixed value but is dynamically calculated based on the drastic local semantic changes within the document. Specifically, for each document, the system calculates the mean of its boundary confidence score sequence. and standard deviation ,set up γ is a sensitivity parameter, preferably set between 0.5 and 1.0.

[0063] Through the semantic boundary detection process described above, the document is segmented into a set of semantically complete, variable-length candidate text blocks. The system simultaneously calculates two block quality metrics: Boundary Clarity and Chunk Stickiness. Boundary Clarity measures the steepness of the decrease in confidence at semantic boundary locations, while Chunk Stickiness measures the average semantic similarity between sentences within the same block. These two metrics are used to monitor block quality and trigger re-blocking when necessary. For a comparison of the performance of PSC boundary detection with the traditional cosine similarity method, see [link to relevant documentation]. Figure 2 .

[0064] Subsequently, the system performs context-enhanced block embedding representation learning. This stage employs two core techniques: delayed chunking and in-sequence negative sample training (InSeNT).

[0065] The core idea of ​​deferred chunking is to postpone the chunking operation from before to after encoding. The traditional chunking-encoding process involves first dividing the document into chunks, then independently inputting each chunk into the embedding model for encoding. In this approach, each chunk can only focus on its own tokens during encoding, failing to access the document's context outside the chunk. Deferred chunking reverses this process: the entire document (or a large section of the document, such as a continuous text segment containing several adjacent chunks) is first input into the embedding model. This allows the model's self-attention mechanism to cover the global context across chunks during encoding, only performing segmented pooling of the token-level representations at the final pooling layer according to predetermined chunk boundaries, resulting in the embedding vector for each chunk.

[0066] Formally, for a document, suppose it is segmented into K blocks after semantic boundary detection, with each block containing a certain number of tokens. Under the delayed segmentation mechanism, the system inputs the entire continuous text containing these K blocks into the embedding model to obtain the final hidden representation of all tokens. Then, for the k-th block, the system uses mean pooling to obtain the block embedding vector from the hidden representation of its contained tokens. Since the hidden representations of these tokens are generated through global self-attention interactions, therefore It contains semantic association information between this block and other blocks in the same document.

[0067] In a preferred implementation, when the complete document exceeds the maximum input length of the embedding model, the system employs a sliding window strategy: centered on the current target block, it takes its predecessor and successor blocks to form an overlapping window containing context, inputs the entire text within this window into the embedding model, and pools only the token representation of the target block. The window size is preferably set to 3 to 5 times the token length of the target block to ensure sufficient context coverage.

[0068] After obtaining the context-aware block embedding vectors, the system uses InSeNT to compare and train the embedding model, further enhancing the context alignment capability of the block embeddings. The training data for InSeNT is constructed as follows: for each training query q and its associated document d, the system marks the blocks in document d that semantically match query q as positive block e. + Other blocks in document d are labeled as in-sequence negative samples; randomly sampled blocks from other documents are labeled as batch negative samples. The training loss function is a dual-channel mixed contrastive loss.

[0069]

[0070] in This represents the cosine similarity between the query embedding and the block embedding. For temperature coefficient, This represents the set of negative samples within a sequence from the same document. This represents the set of negative samples within a batch from other documents. This is a mixing coefficient used to control the weights of negative samples within the sequence. In a preferred implementation, Set to 0.1, temperature coefficient Set it to 0.07.

[0071] The key role of negative samples within a sequence is that they force the model to learn to distinguish the semantic differences between different blocks within the same document, preventing the model from relying solely on document-level topic features while ignoring block-level specificity. Simultaneously, since negative samples within a sequence share the document-level context with positive blocks, the model must learn to extract block-specific semantic features within this shared context, thereby improving the discriminative power of block embeddings without sacrificing context awareness.

[0072] In a preferred embodiment, the system further introduces a cross-document hard negative example mining mechanism. For each positive example block, the system retrieves blocks in the embedding space with the highest cosine similarity but from different documents and irrelevant to the query, and adds these high-scoring blocks as hard negative examples to the training batch. Hard negative examples are located near positive example blocks in the embedding space but are semantically unrelated, providing more refined training signals for decision boundaries. For a comparison of the mechanisms of delayed block context-aware encoding and independent block encoding, see [link to documentation]. Figure 3 .

[0073] Next, the system executes query-aware adaptive retrieval planning. The system first constructs a lightweight query analyzer, which consists of a query encoder based on a pre-trained language model and a linear classification head. The query encoder encodes the input query into a fixed-length query embedding vector, and the linear classification head maps this embedding to a probability distribution of four query intent categories: factual, inferential, summary, and comparative. The classification head is fine-tuned on a manually annotated query intent classification dataset.

[0074] The retrieval planner dynamically determines the retrieval configuration based on the query category. Suppose the analyzer determines the query to be category c; the corresponding retrieval configuration is a triple:

[0075]

[0076] in, Indicate category The corresponding main search granularity (optional values ​​are sentence level, paragraph level, or document level). This represents the multi-granularity fusion weight vector. This indicates the number of neighboring blocks retrieved in the extended search.

[0077] The parameters of the retrieval planner are optimized using the policy gradient method. The system models the retrieval granularity selection action as a Markov decision process: the state is the query embedding vector and the current retrieval configuration, the action is selecting or adjusting the retrieval granularity, and the reward is the normalized depreciation cumulative gain (nDCG) or mean reciprocal rank (MRR) of the retrieval result on the validation query set. The policy gradient is estimated as follows:

[0078]

[0079] in, The parameter is The retrieval planner strategy network, This indicates the action of selecting the retrieval granularity. Indicates in the query Take action The subsequent retrieval performance reward. The system updates the planner parameters through policy gradient iteration, enabling it to learn to select the optimal retrieval granularity configuration for different types of queries.

[0080] Finally, the system performs end-to-end two-layer optimization, jointly aligning the chunking, embedding, and retrieval modules. The entire system contains three sets of learnable parameters: chunking module parameters. (Including PSC projection network parameters and MFC fusion layer parameters), embedded module parameters (Including embedded model parameters and InSeNT training weights), and retrieval planner parameters. .

[0081] The goal of the inner optimization is to minimize the weighted combination of the contrastive loss for embedding retrieval on the training document set and the block boundary classification loss, given a fixed retrieval planner parameter:

[0082]

[0083] in, This refers to the InSeNT dual-channel hybrid contrast loss mentioned above. , This refers to the PSC boundary classification loss mentioned above. , This is the balance coefficient.

[0084] The goal of outer optimization is to maximize retrieval performance metrics on the validation query set by updating the retrieval planner parameters through policy gradients. The outer gradient update direction is:

[0085]

[0086] Where ε is the outer learning rate.

[0087] The inner and outer layers are executed iteratively, alternating between each round of outer layer optimization. After each round of outer layer optimization, the system evaluates the retrieval performance on the validation query set. When the improvement in validation performance after three consecutive rounds of outer layer optimization is less than a preset convergence threshold, the system determines that the optimization has converged and stops iterating.

[0088] In a preferred embodiment, to reduce the computational overhead of two-layer optimization, the system employs a phased freezing strategy: in the first round of optimization, only training is performed. and And freezing Unfreeze in the second round of optimization It is fine-tuned with a small learning rate; in the third and subsequent rounds, the three are jointly optimized.

[0089] After completing the two-layer optimization, the system uses the finally converged module parameters to perform end-to-end processing on the target document set: First, the document is segmented into context-aware text blocks using a semantic boundary detector. Then, each block is encoded into a context-aligned embedding vector and a vector index is built using an embedding model trained with InSeNT. Finally, when a query arrives, the retrieval planner adaptively selects the retrieval granularity and performs a search on the index, returning a sorted list of relevant text blocks. The retrieval results can be directly used as context input to the downstream large language model for answer generation.

[0090] Example 1: Performance Comparison of General Domain Document Retrieval

[0091] 1. Evaluation Indicators and Experimental Setup Instructions

[0092] This embodiment is used to verify the retrieval performance of the present invention in a general domain document retrieval scenario. Evaluation metrics include normalized lossy cumulative gain (nDCG@5 and nDCG@10), mean reciprocal rank (MRR), and top K hit rate (Hits@1, Hits@5, and Hits@10). Comparison methods include the following document chunking retrieval baselines: fixed-size chunking (chunk size set to 256 tokens), recursive chunking (separator hierarchy: paragraph → period → comma), semantic similarity chunking (using a cosine similarity threshold of 0.5 for boundary judgment), paragraph group chunking, original projective similarity chunking (PSC-only, without MFC assistance or late chunking enhancement), original delayed chunking encoding (using fixed-size chunking, without PSC semantic boundary detection), and the complete method of the present invention.

[0093] Experiments were conducted on five publicly available benchmark datasets: MS MARCO, Natural Questions (NQ), HotpotQA, TriviaQA, and FEVER. The embedding model's base encoder employed two mainstream dense retrieval encoders: GTE-base and BGE-base. Training was performed on the MS MARCO training document set after contrastive learning. All methods used the HNSW indexing structure to control for variable differences during the indexing phase. Retrieval performance was evaluated using standard evaluation scripts for each dataset.

[0094] 1. Comparison of experimental data

[0095] Table 1: Comparison of retrieval performance of various methods on the MS MARCO Dev set (embedding model is GTE-base).

[0096]

[0097] Table 2: Comparison of MRR and nDCG@10 for each method on the Natural Questions, HotpotQA, TriviaQA and FEVER datasets (embedding model is BGE-base).

[0098]

[0099] 3. Experimental Conclusions

[0100] As shown in Table 1, on the MS MARCO dataset, the complete method of this invention achieves an MRR of 41.72%, which is significantly improved compared to fixed-length blocks (36.15%), recursive blocks (37.83%), semantic similarity blocks (38.46%), and paragraph group blocks (39.28%), with improvements ranging from 2.44 to 5.57 percentage points. Compared to PSC-only (39.64%) and Late Chunking-only (39.91%), which use only a single technique, the complete method of this invention improves by 2.08 and 1.81 percentage points, respectively, indicating that the synergistic effect of semantic boundary detection and context embedding alignment is better than using them independently.

[0101] As shown in Table 2, the complete method of this invention achieves an nDCG@10 ratio of 52.83% in Natural Questions, 68.57% in HotpotQA, 74.19% in TriviaQA, and 89.34% in FEVER, all higher than all compared methods. In particular, on the HotpotQA dataset, which requires multi-hop inference, this invention achieves a 3.92 percentage point improvement compared to semantic similarity segmentation, indicating that context-aware embedding plays a crucial role in preserving cross-block information associations in the inference chain.

[0102] The experimental results above demonstrate that this invention, through the synergistic effect of PSC semantic boundary detection, delayed block context-aware coding, and InSeNT embedding alignment, achieves stable and consistent retrieval performance improvements across various retrieval scenarios and datasets. For a comparison of retrieval performance on different datasets, please refer to [link to relevant documentation]. Figure 4 .

[0103] Example 2: Generalization Performance Verification of Multi-Domain Document Retrieval

[0104] 1. Evaluation Indicators and Experimental Setup Instructions

[0105] This embodiment is used to verify the generalized retrieval capability of the present invention on document sets across different knowledge domains. The experiment uses the UltraDomain benchmark dataset, selecting six domains with high knowledge density: biology, mathematics, physics, medicine, law, and agriculture. Each domain contains approximately 500 to 1500 professional documents and related queries. The evaluation metrics are nDCG@5 and Hits@5. The embedding model uniformly uses GTE-base as the basic encoder.

[0106] The comparison method adds two adaptive methods, Dynamic Token-size Chunking and Content Density Adaptive Chunking, which were identified as the best balance between efficiency and effectiveness in the system comparison study (see Systematic Investigation, 2025), to the comparison method based on Example 1.

[0107] 2. Comparison of Experimental Data

[0108] Table 3: nDCG@5 comparison of various methods on the UltraDomain six-domain dataset (embedding model is GTE-base).

[0109]

[0110] 3. Experimental Conclusions

[0111] As shown in Table 3, the complete method of this invention achieves an average nDCG@5 of 0.487 across the six domains, representing a 6.10% improvement compared to paragraph group segmentation (0.459), a 3.18% improvement compared to dynamic token segmentation (0.472), and a 4.06% improvement compared to content density adaptive segmentation (0.468). The standard deviation across all domains is 0.021, lower than all the comparison methods (the standard deviation for paragraph group segmentation is 0.034, and the standard deviation for semantic similarity segmentation is 0.042), indicating that this invention maintains stable segmentation quality and retrieval performance under different document structures and domain terminology features.

[0112] It is worth noting that this invention demonstrates the most significant advantages in the highly structured fields of law and medicine (containing chapters, clause numbers, definition lists, etc.), achieving nDCG@5 scores of 0.503 and 0.497, respectively. This is because the PSC module can learn to utilize the structured arrangement patterns of documents in these fields to assist in boundary determination, while semantic segmentation relying solely on cosine similarity struggles to capture such structured semantic boundaries.

[0113] Example 3: Ablation Experiment and Module Contribution Analysis

[0114] 1. Evaluation Indicators and Experimental Setup Instructions

[0115] This embodiment is used to quantify the independent contributions of each technical module of the present invention. Ablation experiments were conducted on two representative datasets, MS MARCO and HotpotQA, with nDCG@10 as the primary evaluation metric. The ablation experiments included the following six configurations: the complete method, removing the PSC module and retaining only MFC for boundary detection, removing the MFC module and retaining only PSC for boundary detection, removing the Late Chunking mechanism (falling back to independent block encoding), removing InSeNT contrastive training (using only Late Chunking without contrastive fine-tuning), and removing the retrieval planner (falling back to a fixed paragraph-level retrieval granularity).

[0116] 2. Comparison of Experimental Data

[0117] Table 4: Comparison of nDCG@10 configurations for ablation experiments on MS MARCO and HotpotQA.

[0118]

[0119] 3. Experimental Conclusions

[0120] As shown in Table 4, removing any module leads to a decrease in retrieval performance, verifying the independent contribution of each module. On MS MARCO, removing PSC resulted in a 1.64 percentage point decrease in nDCG@10 (41.72%→40.08%), removing LateChunking resulted in a 2.17 percentage point decrease (41.72%→39.55%), removing InSeNT resulted in a 1.83 percentage point decrease (41.72%→39.89%), and removing the retrieval planner resulted in a 0.76 percentage point decrease (41.72%→40.96%). The contributions of the four modules are additive. When all four modules are missing simultaneously (i.e., degenerating into MFC boundary detection + independent block encoding + fixed-granularity retrieval), nDCG@10 drops to 36.84%, a cumulative decrease of 4.88 percentage points.

[0121] The trend on HotpotQA is consistent with that of MS MARCO. Late Chunking and PSC are the two largest contributing single modules, which aligns with the task characteristics of HotpotQA, which requires cross-block reasoning—semantically accurate chunking and context-aware embedding are particularly critical for multi-hop reasoning. The retrieval planner contributes more to HotpotQA (0.92 percentage points) than MS MARCO (0.76 percentage points), indicating that query-adaptive retrieval granularity selection is more valuable in complex reasoning tasks.

[0122] Example 4: End-to-End Computation Efficiency Analysis

[0123] 1. Evaluation Indicators and Experimental Setup Instructions

[0124] This embodiment verifies whether the present invention still maintains its end-to-end efficiency advantage after incorporating the entire process of chunking, embedding alignment, and retrieval planning into the total computational cost. Evaluation metrics include relative computational cost, retrieval latency, and index storage overhead. Relative computational cost is normalized to the total computational cost of a fixed-length chunking baseline (without context enhancement or adaptive retrieval); a lower value indicates lower end-to-end overhead. Experiments were conducted on the full MS MARCO document set, using the GTE-base embedding model, with a total of approximately 8.8 million documents.

[0125] 2. Comparison of Experimental Data

[0126] Table 5: Joint comparison of end-to-end computational cost and retrieval performance.

[0127]

[0128] 3. Experimental Conclusions

[0129] As shown in Table 5, the relative computational cost of the complete method of this invention is 1.142 times, slightly higher than the 1.000 times cost of the fixed-length block baseline, but significantly lower than the high-cost scheme (approximately 4.85 times) that uses a large language model for boundary detection block by block. Regarding retrieval latency, the average retrieval latency of this invention is 42.8 milliseconds, an increase of 7.6 milliseconds compared to the 35.2 milliseconds of the fixed-length block. This increase mainly comes from the query classification of the retrieval planner and the overhead of multi-granularity fusion retrieval. In terms of index storage, since the number of blocks generated by semantic blocks is generally less than that of fixed-length blocks (this invention merges semantically coherent adjacent text, reducing redundant blocks), the index storage is 0.913 times that of the baseline.

[0130] In summary, this invention achieves a 13.8% to 27.6% improvement in nDCG@10 performance (depending on the dataset) with a 14.2% increase in computational cost. This efficiency-performance ratio is significantly better than traditional improvement methods such as increasing the size of the embedding model or increasing the retrieval depth. In solutions that upgrade the embedding model from GTE-base to GTE-large, the computational cost increases by approximately 2.1 times, while the nDCG@10 improvement typically does not exceed 5%, demonstrating the clear cost-effectiveness advantage of this invention.

[0131] Example 5: General Document Chunking Extension in Non-RAG Scenarios

[0132] 1. Evaluation Indicators and Experimental Setup Instructions

[0133] This embodiment is used to verify the scalability of the present invention in a general document chunking scenario without retrieval enhancement. Unlike the previous embodiments, this embodiment does not use a query-chunk retrieval process, but instead independently applies the semantic boundary detection and context-aware chunking modules of the present invention to a general document paragraph segmentation task. The evaluation metrics are the chunk boundary F1 score (compared with manually annotated semantic boundaries) and the chunk cohesion score.

[0134] Experiments were conducted on the PubMedQA full-text document set and the WikiSection document set. Both datasets provide manually annotated semantic paragraph boundaries as evaluation benchmarks. Comparison methods included fixed-length chunking, recursive chunking, semantic similarity chunking, and the original PSC method (without MFC assistance or cross-level attention fusion).

[0135] 2. Comparison of Experimental Data

[0136] Table 6: Comparison of F1 scores for block boundaries on PubMedQA and WikiSection.

[0137]

[0138] 3. Experimental Conclusions

[0139] As shown in Table 6, in the general document segmentation task, the PSC+MFC joint boundary detection mechanism of this invention achieves a boundary F1 score of 0.847 on PubMedQA and 0.819 on WikiSection, which are improvements of 0.093 and 0.087 respectively compared to semantic similarity segmentation, and improvements of 0.034 and 0.041 respectively compared to the original PSC method. After adding cross-level attention fusion, the boundary F1 score is further improved to 0.861 and 0.833, proving that the multi-granularity semantic feature pyramid has an independent positive contribution to the boundary detection accuracy.

[0140] The above results demonstrate that the semantic boundary detection core mechanism of this invention does not rely on downstream retrieval processes and can be applied as a general document segmentation method to various natural language processing tasks such as text summarization, discourse analysis, and knowledge graph construction. In practical applications, when there is no retrieval requirement or only structural segmentation of documents is needed, the modules in steps one and two can be used independently to complete high-quality semantic segmentation.

Claims

1. An adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment, characterized in that, The following steps are executed consecutively: Step 1: Construction of a Multi-Granularity Semantic Feature Pyramid We acquire a document set, a pre-trained embedding model, and a validation query set. We perform three-layer granular encoding at the sentence, paragraph, and document levels for each document. We inject document-level and paragraph-level semantic information into the sentence-level embedding representation through a cross-level attention fusion mechanism to construct a hierarchical semantic feature pyramid. Step 2: Semantic Boundary Detection and Adaptive Block Segmentation The adjacent text segments enhanced by cross-level attention are embedded into the vector input projection similarity segmentation module, and the projection similarity score between adjacent segments is calculated in the learnable projection space; the semantic continuity is evaluated from three dimensions: cosine similarity, Euclidean distance and weak attention association score using the metric fusion segmentation module. The weighted fusion projection similarity score and the metric fusion score generate a boundary confidence sequence. The semantic boundary position is determined by an adaptive threshold, and the document is segmented into semantically complete and variable-length candidate text blocks. Step 3: Context-Enhanced Block Embedding Representation Learning Phase A delayed block segmentation mechanism is adopted to encode the continuous text containing multiple candidate text blocks as a whole into the pre-trained embedding model. In the final pooling layer, the block embedding vectors are obtained by segmented pooling according to the block boundaries. The embedding model is post-trained by training with negative samples within the sequence. Other blocks within the same document are used as negative samples within the sequence, and randomly sampled blocks across documents are used as negative samples within the batch. A dual-channel hybrid contrastive loss function is constructed so that the embedding vectors of different blocks within the same document maintain local specificity in the semantic space while sharing the document-level global semantic context. Step 4: Query-Aware Adaptive Retrieval Planning Phase A query analyzer is built to classify the intent of the input query; the retrieval planner dynamically determines the retrieval granularity configuration based on the query category, performs the retrieval on each granularity channel and performs weighted fusion of the results, with the weight coefficients jointly determined by the query category and the retrieval confidence. Step 5: End-to-end two-layer optimization phase The semantic boundary detector parameters from step two and the embedding model parameters from step three are used as inner learnable variables. They are optimized on the training document set with the goal of maximizing retrieval performance. The semantic boundary detector parameters include the parameters of the projection similarity block module projection network and the metric fusion block module fusion layer. The retrieval planner parameters from step four are used as outer learnable variables and optimized on the validation query set using the policy gradient method. The inner and outer layers are iterated alternately until the retrieval performance of the semantic boundary detector, embedding model, and retrieval planner on the validation query set converges. After optimization, end-to-end document chunking, embedding indexing, and query retrieval are performed on the target document set.

2. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 1, characterized in that, In step one, the cross-level attention fusion mechanism includes: for each sentence-level embedding vector, calculating its attention weights with its corresponding paragraph-level embedding vector and with the document-level global embedding vector, and injecting paragraph-level and document-level semantic information into the sentence-level embedding representation in a weighted residual manner to obtain the fused sentence-level embedding vector.

3. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 1, characterized in that, In step two, the projection similarity segmentation module consists of two fully connected network layers connected in series. The first fully connected network layer maps the concatenated representation of adjacent sentence-level embedding vectors to a d-dimensional feature space and performs a nonlinear transformation using the GELU activation function. The second fully connected network layer further maps the transformed features to a scalar and outputs the projection similarity score using the Sigmoid activation function. The projection network is trained under supervision using a training document set with labeled semantic boundary positions and binary cross-entropy loss, enabling the projection network to learn to map semantic boundary positions to low similarity regions and non-boundary positions to high similarity regions.

4. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 1, characterized in that, In step two, the metric fusion block module obtains the weak attention association score in the following way: extract the attention matrix of the intermediate layer of the pre-trained embedding model, calculate the average cross-segment attention weight between corresponding tokens of adjacent text segments, and use the normalized value of the weight as the weak attention association score; the metric fusion block module standardizes the three metrics of cosine similarity between adjacent segment embeddings, the normalized reciprocal of Euclidean distance, and the weak attention association score, and then merges them into a comprehensive metric fusion score through a lightweight linear fusion layer.

5. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 4, characterized in that, In step two, the projection similarity score is used as the main criterion and the metric fusion comprehensive score is used as the auxiliary criterion. The final boundary confidence is generated through weighted fusion. The adaptive threshold is dynamically calculated based on the degree of drastic local semantic changes in the document: for each document, the mean of its boundary confidence sequence is calculated. and standard deviation Set adaptive threshold Where γ is the sensitivity parameter; Locations with a boundary confidence level below an adaptive threshold are marked as semantic boundaries.

6. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 1, characterized in that, In step three, the dual-channel hybrid contrast loss function is: ; in, Indicates query embedding With block embedding Cosine similarity between them For temperature coefficient, This represents the set of negative samples within a sequence from the same document. This represents the set of negative samples within a batch from other documents. This is the mixing coefficient used to control the weights of negative samples within the sequence.

7. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 6, characterized in that, In step three, a cross-document hard negative example mining mechanism is further introduced: for each positive example block, the block with the highest cosine similarity but from a different document and unrelated to the query is retrieved in the embedding space, and the retrieved block is added as a hard negative example to the training batch to tighten the decision boundary in the embedding space.

8. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 1, characterized in that, In step four, the query analyzer consists of a query encoder based on a pre-trained language model and a linear classification head, which classifies the input query into factual, inferential, summary, or comparative query categories. The retrieval planner determines the main retrieval granularity, the multi-granularity fusion weight vector, and the number of neighbor blocks for extended retrieval based on the preset retrieval granularity configuration corresponding to the query category. The granularity selection action of the retrieval planner is modeled as a Markov decision process, where the state is the query embedding vector and the current retrieval configuration, the action is to select or adjust the retrieval granularity, and the reward is the normalized depreciation cumulative gain or the average reciprocal ranking on the validation query set. The retrieval planner parameters are optimized using the policy gradient method.

9. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 1, characterized in that, In step five, the semantic boundary detector parameters include the projection network parameters of the projection similarity block module and the fusion layer parameters of the metric fusion block module, and the embedding model parameters include the embedding model parameters and the training weights for in-sequence negative sample contrast training.

10. The adaptive document chunking retrieval method based on semantic boundary awareness and context embedding alignment according to claim 1, characterized in that, In step five, the end-to-end two-layer optimization adopts a phased freezing strategy: the first round of optimization only trains the block module parameters and retrieval planner parameters while freezing the embedding module parameters; the second round of optimization unfreezes the embedding module parameters and fine-tunes them with a learning rate smaller than that of the outer layer; the third and subsequent rounds optimize all three together; when the improvement in retrieval performance on the verification query set is lower than the preset convergence threshold after three consecutive rounds of outer layer optimization, the optimization is determined to have converged and the iteration is stopped.