Computer intelligence analysis method and system for context refining and code generation

By employing a saliency-driven context compression and code generation interaction mechanism, the data overload and interaction bottlenecks of large language models in the mobilization and defense fields are resolved, improving the accuracy and efficiency of analysis while reducing computational costs and latency.

CN121833635APending Publication Date: 2026-04-10NO 15 INST OF CHINA ELECTRONICS TECH GRP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-26
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies face the problems of overloaded front-end raw intelligence data and overloaded back-end MCP service interaction in the mobilization and defense fields, resulting in context distraction and interaction bottlenecks in large language models. Existing compression technologies and function call architectures cannot effectively solve these problems.

Method used

We employ saliency-driven context compression technology to refine raw intelligence data and optimize the interaction between the large language model and the backend MCP service through a code generation interaction mechanism. This includes multilayer perceptron extraction of token saliency, dynamic soft token allocation, and code block filtering, which reduces data volume and optimizes tool definitions and results.

Benefits of technology

It effectively reduces the amount of data processed by large language models, lowers computational costs and latency, improves analysis accuracy, and solves the problems of tool definition overload and bloated results, shifting the computational burden to an inexpensive sandbox code execution environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833635A_ABST
    Figure CN121833635A_ABST
Patent Text Reader

Abstract

The invention discloses a computer intelligence analysis method and system for context refining and code generation, and the method comprises the steps: obtaining massive heterogeneous original intelligence data in a computer processor; performing saliency-driven context compression processing on the original intelligence data based on the query instruction to obtain a first compressed context; based on the first compressed context, generating a corresponding code block by adopting a large language model; in the sandbox code executor, calling a back-end MCP service based on an instruction of the code block, receiving a return result of the back-end MCP service, and filtering the return result to obtain a second compressed context; and based on the first compressed context and the second compressed context, adopting a large language model to generate an intelligence data analysis report corresponding to the query instruction. According to the method, input refining is carried out on massive heterogeneous data through a saliency-driven compression technology, interaction between a large language model and a rear-end MCP service is refined based on an interaction mechanism generated by codes, and computer intelligence analysis is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer information processing, and more particularly to a computer intelligence analysis method and system for context refinement and code generation. BACKGROUND

[0002] With the application of intelligent analysis systems in various fields, especially in mobilization and defense fields, a core dilemma is faced: data overload, which occurs in two distinct stages, namely front-end raw intelligence data overload and back-end MCP service interaction overload.

[0003] 1. Front-end bottleneck: raw intelligence data overload In the field of mobilization and intelligence, intelligent agents need to analyze a large amount of multi-source data that is "islanded" (classified by type and owner), "ambiguous" (of varying quality), and "fuzzy". Large language models (LLM) are fundamentally limited by a limited "context window". Providing these massive, unfiltered raw intelligence data directly to the LLM will result in "context distraction", i.e., the model loses its ability to focus on key information in the presence of a large amount of noise. Existing compression techniques, such as uniform allocation of soft tokens, fail to completely solve this problem because they ignore the changes in "information density" between data blocks and treat noise and signal equally.

[0004] 2. Back-end bottleneck: MCP service interaction overload In order for the LLM to perform meaningful analysis (e.g., fuse logistics data or assess readiness status), external tools or proprietary services must be called. In the field of mobilization, in order to integrate with traditional business systems, these services are usually "context protocol services" (MCP), which are designed for large models to call to provide structured context. However, the standard function call architecture in existing technologies introduces two new "interaction overload" bottlenecks when interacting with complex services like MCP: 2.1. Tool definition overload: Existing technologies require the static definition of all available tools in the system prompt words of the LLM. This approach is technically flawed when a MCP connects to a large number of proprietary interfaces.

[0005] Cost and delay: System prompt words containing tool definitions can themselves contain a large number of tokens, which will result in a large token cost and delay in every API call, even if no tools are used in that call.

[0006] Accuracy decline: filling a large number of tool definitions into the context of the LLM will severely degrade its performance, leading to "needle in a haystack" or "middle loss" problems, and the model's ability to select and execute the correct tool will be greatly reduced.

[0007] 2.2. Tool result bloat: When an LLM successfully calls an MCP interface (e.g., queries a back-end database), the service can return a very large, detailed, structured data object. In the prior art, this complete, unfiltered result is fed back directly into the LLM’s context window for its next step of reasoning. This is extremely wasteful. For example, a large JSON result can be returned to the LLM, when the LLM’s next step of reasoning actually only needs a few key fields from the result. This unnecessarily consumes valuable context space and can “blow up” the context window, causing the task to fail.

[0008] Therefore, it is an urgent problem for those skilled in the art to provide a front-end and back-end refining architecture to cooperatively solve the context overload problem of front-end raw data and back-end interaction. SUMMARY

[0009] In view of the above problems, the present application is proposed in order to provide a computer intelligence analysis method and system for context refinement and code generation, which overcomes the above problems or at least partially solves the above problems, by using a saliency-driven compression technique to refine input of massive heterogeneous data, and using an interactive mechanism based on code generation to refine the interaction between a large language model and a back-end MCP service, thereby realizing computer intelligence analysis.

[0010] In order to achieve the above purpose, the present application adopts the following technical solutions: In a first aspect, an embodiment of the present application provides a computer intelligence analysis method for context refinement and code generation, comprising: S1. In a computer processor, obtaining massive heterogeneous raw intelligence data; S2. Based on a query instruction, performing saliency-driven context compression processing on the raw intelligence data to obtain a first compressed context; S3. Based on the first compressed context, using a large language model to generate a corresponding code block; S4. In a sandbox code executor, calling a back-end MCP service based on the instruction of the code block and receiving its return result, and filtering the return result to obtain a second compressed context; S5. Based on the first compressed context and the second compressed context, using the large language model to generate an intelligence data analysis report corresponding to the query instruction.

[0011] Further, the raw intelligence data in step S1 includes sensor data, data in a business database, and open source social media data.

[0012] Further, the step S2 performs the saliency-driven context compression processing, specifically including: S21, using a multi-layer perception (MLP) to extract all tokens in the input data stream; S22, based on the user query instruction, calculating the saliency score of each token; S23, deleting the token corresponding to the saliency score lower than the preset threshold; S24, dividing the remaining token text after deletion into a plurality of fixed-length data blocks, and calculating the information density index of each data block; S25, based on a learnable compression encoder, mapping all data blocks into a corresponding number of soft token vectors, and obtaining a first compressed context after splicing.

[0013] Further, in step S24, the information density index includes: a domain relevance density , and a semantic information amount ; The domain relevance density is expressed by the formula: =

[0014] The semantic information amount is expressed by the formula: =

[0015] wherein, denotes the i-th data block, i denotes the number of occurrences of the keyword in the i-th data block, w denotes the inverse document frequency of the keyword i in the historical intelligence document set, denotes the maximum value of the cumulative TF-IDF value of a single data block in the historical document set; w denotes the data block length, denotes the i-th token, denotes the previous token sequence, t denotes the conditional probability prediction. t Further, in step S25, the determination method of the corresponding number is:

[0016] Further, in step S25, the determination method of the corresponding number is: ​Segment mapping is performed on each data block based on the information density index, different numbers of compressed soft tokens are allocated to each data block, and the corresponding number is obtained by adding up all the soft token numbers.

[0017] Further, step S4 specifically includes: S41, in the sandbox code executor, the code block is subjected to security review and a tool metadata request is initiated to the backend MCP service based on the instructions of the code block; S42, after the backend MCP service receives the request, the query intent is parsed and routed to the corresponding underlying data source to perform an original query; the complete, unrefined original result set is returned to the sandbox code executor; S43, in the sandbox code executor, field screening, condition filtering, aggregation / statistics / ordering and result truncation operations are performed, and a second compressed context is obtained by serializing structured text.

[0018] Further, in step S41, the tool metadata request is initiated to the backend MCP service based on the instructions of the code block, specifically including: Based on each instruction step of the code block, the structured description information of the MCP tool or interface required by the code block is dynamically loaded.

[0019] In a second aspect, an embodiment of the present application provides a computer intelligence analysis system for context refinement and code generation, comprising: A data access layer for obtaining massive heterogeneous original intelligence data; A front-end refinement module coupled to the data access layer for receiving the original intelligence data and performing a saliency-driven context compression process based on a query instruction to generate and output a first compressed context; A backend refinement module including a large language model and a sandbox code executor; The large language model is configured to generate a corresponding code block based on the first compressed context and send it to the sandbox code executor, and is further configured to generate an intelligence data analysis report corresponding to the query instruction based on the first compressed context and a second compressed context. The sandbox code executor is configured to call a backend MCP service based on the instructions of the code block and receive its returned results, and is further configured to filter the returned results to obtain the second compressed context and return the second compressed context to the large language model.

[0020] Further, the data access layer is communicatively connected with sensors, business databases and open source social media for obtaining sensor data, data in business databases and open source social media data.

[0021] Via the technical solution, compared with the prior art, the application provides a computer intelligence analysis method and system for context refinement and code generation, which has the following beneficial effects: In the front-end compression part, the application greatly reduces the amount of original intelligence data that the LLM needs to process through the significance-driven context compression, thereby reducing the computing cost, memory usage and delay, and alleviating the "context attention dispersion" by improving the signal-to-noise ratio, and improving the accuracy of analysis.

[0022] In the back-end refinement part, the application solves the problem of tool definition overload by using the code tool solution. No matter how many interfaces the underlying MCP service exposes, the token overhead of the system prompt word remains constant. The problem of tool result bloating is also solved by using the generated code for data filtering.

[0023] The application transfers the computing burden of data processing from the expensive and limited LLM context window to the cheap and efficient sandbox code execution environment, which enables the LLM to process data sources from the MCP that would otherwise "blow up" its context window. BRIEF DESCRIPTION OF DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only a part of the embodiments of the application, and for those skilled in the art, other drawings can be obtained without creative labor on the basis of the provided drawings.

[0025] Figure 1 A flow chart of a computer intelligence analysis method for context refinement and code generation provided in an embodiment of the application; Figure 2 A structure diagram of a computer intelligence analysis system for context refinement and code generation provided in an embodiment of the application. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, not all. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.

[0027] The embodiments of the application disclose a computer intelligence analysis method for context refinement and code generation, as shown in Figure 1 , which includes: S1, in a computer processor, obtain massive heterogeneous raw intelligence data; S2, based on the query instruction, perform a saliency-driven context compression process on the raw intelligence data to obtain a first compressed context; S3, based on the first compressed context, generate a corresponding code block using a large language model; S4, in a sandbox code executor, call a backend MCP service based on the instructions of the code block and receive its return results, and filter the return results to obtain a second compressed context; S5, based on the first compressed context and the second compressed context, generate an intelligence data analysis report corresponding to the query instruction using the large language model.

[0028] In this embodiment, the user initiates a query instruction through an interface, which is compressed through the front end, and then calls the MCP through the code to refine the back end, and finally generates an analysis report based on the query instruction. In this embodiment, the analyst is monitoring the mobilization exercise of the "4th war zone" and needs to understand the delay of 155mm howitzer ammunition supply.

[0029] This embodiment is based on a saliency-aware context compression engine that receives massive, multi-source raw intelligence data (e.g., sensor feeds, logistics reports, open source intelligence). It applies a hybrid compression process that: calculates the saliency score of tokens relative to user queries; performs hierarchical dynamic pruning to remove low-saliency, redundant tokens; and based on the intrinsic information density of the remaining data blocks, dynamically allocates compressed "soft tokens" to high-signal regions. The output of this engine is a refined, high-signal "compressed intelligence context".

[0030] This embodiment also receives instructions from LLM based on a code-generated MCP interaction executor to overcome the two bottlenecks of tool definition overload and call result bloat in the background art. The specific operation includes: Solve "tool definition overload": Do not statically define all MCP interfaces in the system prompt words. Instead, LLM is given the ability to call a single code executor. When LLM needs to call an MCP service, a code block (e.g., a Python script) is generated. This code block uses standard programming language constructs (e.g., import or mcp.load_tools(...)) to dynamically load the MCP interface definitions it needs in that particular step on demand. Minimize the overhead of system prompts.

[0031] Solve "tool result bloat": The generated code block is sent to a sandbox execution environment for execution.

[0032] (a) The code block invokes the MCP service; e.g. mcp.call('get_logistics_data').

[0033] (b) The MCP service returns the full, unfiltered, voluminous result to the sandboxed execution environment.

[0034] (c) Key step: The sandboxed environment continues to execute the remainder of the code block generated by the LLM. This portion of the code acts as a "programmable data sieve". It performs local data processing, filtering, aggregation or transformation on the voluminous result within the sandbox (i.e. outside the LLM's context window).

[0035] (d) Only this code-refined, minimized, high-value result is returned and injected back into the LLM's context window for further reasoning.

[0036] The implementation steps of the embodiment are described in detail as follows: According to step S1, massive heterogeneous raw intelligence data is acquired, including sensor data, data in business databases, and open-source social media data.

[0037] Among them, the sensor refers to a hardware or software probe deployed in physical or network space that can automatically collect environmental, state, or behavior data. In this embodiment, it includes monitoring equipment such as radar, infrared imager, electronic reconnaissance equipment, sonar, and unmanned aerial vehicle payload. It has the characteristics of strong real-time, large data volume, and high degree of structuring; usually with accurate spatiotemporal tags; may contain sensitive or classified information, and needs to be encrypted for transmission and access control.

[0038] The business database refers to the structured or semi-structured database relied on by the organization's internal information system to support daily operation and management, reflecting real business processes and resource states; including ammunition inventory system, vehicle scheduling platform, maintenance work order library, combat command log, task allocation table, action timeline, personnel roster, post configuration, and training records. It is highly structured, with strong data authority, representing "official facts"; the update frequency varies from low frequency (such as daily synchronization) to high frequency (such as real-time transactions); usually strictly controlled by permissions, and needs to be accessed securely through API or ETL pipeline.

[0039] Open-source social media refers to publicly accessible internet social platforms, news websites, forums, video sites, and other public information sources, whose content is generated by users or published by institutions. It is highly unstructured, including text, images, and videos; semantic noise is large, containing false information, emotional expression, and advertising; language is diverse, with dialects mixed, requiring multilingual NLP processing; updates are extremely fast (seconds), but credibility needs cross-validation; usually accessed through public APIs, web crawlers, or third-party data service providers (such as Brandwatch, CrowdTangle).

[0040] After that, the saliency-driven context compression process is performed according to step S2.

[0041] This embodiment adopts a lightweight prediction module to calculate the saliency or importance score of each data token according to the query instruction.

[0042] The process of calculating the saliency score is performed by a specially designed lightweight saliency prediction module. The process specifically includes the following structure and data processing logic: Module structure: An efficient two-layer multilayer perceptron (Two-layer MLP) embedded after the embedding layer of the LLM. To minimize computational overhead, the parameter quantity of this module is extremely small.

[0043] Data processing flow: Feature extraction: For each token (Token) in the input data stream , extract its hidden state vector after preliminary encoding .

[0044] Forward calculation: Input vector to MLP for linear transformation and nonlinear activation.

[0045] The calculation formula is represented as:

[0046] Where W and b are the learnable weights and biases of the module, and GELU is the activation function. Score generation: output a scalar , representing the information density and importance of the token in the current context.

[0047] To ensure the accuracy of the prediction, the module uses gradient-based feature attribution techniques for pre-training or fine-tuning. The system calculates the gradient norm of the model's final output relative to the input embedding ( The lightweight saliency prediction module is optimized by minimizing the ranking loss between the predicted score and the true label. This allows the module to learn to distinguish between "key intelligence entities" (such as unit numbers and coordinates) and "redundant background words," thereby quickly identifying high-value tokens without performing full reasoning. Next, saliency-driven token pruning is performed. All tokens with low saliency scores are removed based on a dynamic threshold. This resolves the problem of raw data overload.

[0048] Subsequently, soft tokens are dynamically allocated. For the remaining highly saliency data blocks, more compressed soft tokens are dynamically allocated to regions with denser information based on their calculated information density. Here, information density is a term derived from an IDF dictionary of commonly used terms in the mobilization domain.

[0049] The process consists of two sub-steps: density index calculation and quota mapping.

[0050] The Information Density Index (IDS) is calculated as follows: First, the pruned text is divided into fixed-length data blocks (e.g., each block contains L=64 original text tokens). For the first... i Data blocks Calculate a normalized mixed information density index (Value range: 0-1). It is formed by weighted fusion of features from two dimensions: Dimension 1: Domain Relevance Density .

[0051] This embodiment preloads a mobilization intelligence-specific dictionary, containing terms such as "155mm grenade," "MSR supply line," and "readiness level," and stores their pre-calculated inverse document frequency (IDF) values. For data blocks... Calculate the sum of TF-IDF for all domain keywords contained therein, and then normalize it.

[0052] The calculation formula is: =

[0053] in, Indicates the first i One data block, Keywords w In the i The number of times it appears in each data block Keywords w Inverse document frequency in a historical intelligence document collection Max_Global_TFIDF represents the maximum value of the cumulative TF-IDF of a single data block in the historical document set.

[0054] In the system initialization phase, the massive historical mobilization documents are scanned. The TF-IDF sum of all sliding windows with length L is calculated, and the 99th percentile value is taken as Max_Global_TFIDF.

[0055] The purpose is to ensure that data blocks containing key entities (such as unit numbers, equipment models) obtain high scores, preventing key information from being excessively compressed.

[0056] Dimension two: semantic information amount ).

[0057] The average self-information amount of the data block is calculated using a standard lightweight causal language model (such as nanoVLM).

[0058] The calculation formula is: =

[0059] Where, represents the length of the data block, represents the t th token, represents the previous t token sequence, represents the conditional probability prediction.

[0060] The purpose is to capture the intrinsic complexity of the text. Logically complex, information-rich, and difficult to predict sentences (such as complex causal analysis) will produce high entropy values, requiring more tokens to carry semantics; while simple formatted text (such as repeated table headers) has lower entropy.

[0061] Final index synthesis: = . +(1- ).Norm( ) Where, is an adjustable weight, for example, take 0.6, preferentially focusing on domain relevance.

[0062] Regarding quota mapping: After calculating , segment mapping is performed to determine the number of soft tokens allocated to the data block . By default, each data block (64 original tokens) is compressed to at least 1 soft token and at most 8 soft tokens.

[0063] The specific mapping rules are shown in Table 1 below: Table 1: Segmentation mapping rules based on information density indicators

[0064] Determining the number of soft tokens After that, the embodiment uses a learnable compression encoder, such as a small Transformer Encoder or a Pooling layer, to map the feature vectors of the original data block into continuous soft token vectors. These vectors are then spliced to form the refined context, i.e. the first compressed context, which is finally input to the LLM.

[0065] After that, the large language model is used to generate the corresponding code block according to step S3.

[0066] This code block is configured to perform a multi-step sequence. The generation process is: 1. Intent analysis and parameter extraction.

[0067] Input: The LLM receives the first compressed context from the front end (containing key entities such as "xx theater" and "155mm ammunition") and the user's specific query instructions.

[0068] Inference: The LLM first analyzes the "information gap" between the query requirements and the current context.

[0069] Judgment: "I have static operational command summaries, but lack real-time inventory data." Decision: "Must call external MCP service to obtain real-time data." Parameter mapping: The LLM extracts key parameters for API calls from the compressed context (e.g. mapping "17th Field Artillery Brigade" to unit_id='17FAB', and mapping "within 48 hours" to a timestamp parameter).

[0070] 2. Dynamic tool discovery and definition loading.

[0071] Core mechanism to solve "definition overload": The LLM's system prompt words do not contain complete JSON definitions of hundreds of MCP tools. Instead, the LLM is implanted with a meta-cognition instruction: "use mcp.load() or mcp.search() to find the required tool".

[0072] Generation logic: If the LLM is unsure of the tool name, it will first generate the code print(mcp.search("logistics")) to "ask" the environment.

[0073] If the LLM infers the tool name based on naming conventions, it will generate on-demand loading instructions.

[0074] For example, the generated code lines: Python # Dynamically load domain-specific toolkits to avoid polluting the context. logistics = mcp.load_tool_set("defense_logistics_v2") 3. Construct the "data filtering" logic.

[0075] LLM does not just generate requests to "get data", but generates complete logic to "process data".

[0076] Predicting data format: Based on domain knowledge, LLM predicts that the data returned by MCP may be massive (e.g., "querying ammunition for the entire theater will return tens of thousands of records").

[0077] Inject filtering logic: LLM writes conditional statements (If / Else) and loops in the code to explicitly instruct the sandbox environment how to process this raw data.

[0078] Synthesized code structure: Call: raw_data = logistics.query(...) — to retrieve "dirty" data.

[0079] Cleaning: Write Python list comprehensions or loops to keep only entries that meet the user's query criteria (such as status == 'DELAYED').

[0080] Aggregation: Write logic to summarize data (such as calculating totals or grouping by location) instead of keeping details.

[0081] Return summary — Outputs only the refined "net" data.

[0082] 4. Code self-correction and encapsulation.

[0083] Syntax checking: The LLM performs an internal "pre-run" to ensure that the generated Python code conforms to the syntax restrictions of the sandbox environment (e.g., it does not use dangerous functions such as disabled os.system).

[0084] Error handling: LLMs typically wrap try-except blocks so that when the MCP service times out or returns a null value, it can return a readable error message to the main system instead of causing a crash.

[0085] 5. Final output generation.

[0086] The LLM encapsulates the above logic in a standard Markdown code block and sends it to the sandbox executor.

[0087] After that, the code block is sent to the sandbox code executor to start executing the code (steps A and B). It sends a call to the backend MCP service.

[0088] The MCP returns the bulky, unfiltered result (e.g., full_result JSON) to the sandbox executor. This bulky result does not go into the LLM's context window.

[0089] The executor continues executing the rest of the code block (step C). It executes the filtering logic on the bulky result in the local sandbox environment.

[0090] The code block finishes execution and returns a variable containing only the refined result (e.g., the filtered_names list), i.e., the second compressed context.

[0091] Only this small, refined result is injected back into the LLM's context window.

[0092] The LLM receives this refined result and generates the final analysis report.

[0093] In this embodiment, first, a "saliency-aware context compression engine" performs "input refinement" on the massive raw intelligence data, creating a high-signal "first compressed context" through dynamic token pruning or dynamic soft token allocation. Second, a large language model (LLM) generates a "code block" based on this context. This code block performs "interactive refinement" in a sandbox executor to call a proprietary "context protocol service" (MCP). The code block receives the bulky, unfiltered response from the MCP in the sandbox, filters and processes it locally, and returns only the refined, minimized result as a "second compressed context" to the LLM. This method cooperatively solves the problems of front-end raw data overload and back-end LLM-service interaction bottlenecks, especially "tool definition overload" and "tool result bloat."

[0094] Based on the same inventive concept, the embodiments of the present application also provide a computer intelligence analysis system for context refinement and code generation, referring to Figure 2 as shown, comprising: a data access layer (105) for obtaining massive heterogeneous raw intelligence data; A front-end refining module (110) coupled to the data access layer (105) for receiving the raw intelligence data and performing a saliency-driven context compression process based on a query instruction to generate and output a first compressed context; A back-end refining module (140) including a large language model (122) and a sandbox code executor (125); The large language model (122) is configured to generate a corresponding code block based on the first compressed context and send it to the sandbox code executor (125), and further configured to generate an intelligence data analysis report corresponding to the query instruction based on the first compressed context and a second compressed context. The sandbox code executor (125) is configured to call a back-end MCP service (130) based on the instruction of the code block and receive a return result thereof, and further configured to filter the return result to obtain the second compressed context and return the second compressed context to the large language model (122).

[0095] In this embodiment, the data access layer (105) receives massive and heterogeneous raw intelligence data from various sources, such as sensor data, business databases, and open source social media.

[0096] The front-end refining module (110) is a "saliency-aware context compression engine". It receives raw data (105) and user queries (102). It performs saliency-driven compression and outputs a refined, high-signal "compressed intelligence context".

[0097] The back-end MCP service (130) is a "context protocol service" (MCP). It is a series of proprietary and controlled services that expose multiple function interfaces for intelligence analysis.

[0098] The back-end refining module (140) is an "interactive refinement" module. The LLM (122) does not directly call the back-end MCP service (130), but generates a code block and sends it to the executor (125). The executor (125) calls the MCP (130). The back-end MCP service (130) returns a large, unfiltered result to the executor (125). The executor (125) filters the result locally and returns only the refined result to the LLM (122). The LLM (122) generates a final analysis report to the user based on the refined result and the original compressed intelligence context (115).

[0099] This embodiment shows that the user initiates an instruction through the interface (102), which is compressed by the front-end (110) and refined by the back-end through code calling MCP (125 / 130) to generate a complete path of the final report.

[0100] Scenario Background: An analyst is monitoring a mobilization exercise in "4th War Zone" and needs to understand the delay in 155mm howitzer ammunition resupply.

[0101] User Interface (102) of this embodiment: A natural language chat window and a sidebar "Context Pane" are provided. The sidebar displays the currently loaded document (e.g., "4th War Zone Operation Order.pdf", 200 pages long).

[0102] User Instruction: "Based on the current operation order, analyze the 155mm ammunition supply status of all artillery brigades in the 4th War Zone. Find all batches with a delay of more than 48 hours and determine which transportation node caused the congestion." Front-end refinement module (110), original input: "xx war zone operation order.pdf" (about 150000 Token). Direct input to LLM will exceed the context window or cause distraction.

[0103] Significance compression (SACCE execution): The system identifies the keywords in the user query: "xx war zone", "artillery brigade", "155mm", "supply", "transportation node".

[0104] Significance pruning: The system scans the PDF and retains paragraphs containing the above entities and their logical relationships (such as membership, supply route definition), and prunes irrelevant chapters such as "communication protocols" and "background descriptions".

[0105] Soft token allocation: High-density coding is performed on the key "supply route table".

[0106] Output (first compressed context 115): Compressed operation order summary (about 3000 Token), containing explicit unit codes (such as "17th Field Artillery Brigade") and scheduled supply route codes (such as "Warehouse A").

[0107] Back-end refinement module of this embodiment, including large language model and sandbox code executor.

[0108] LLM input in this embodiment: compressed operation order + user instruction.

[0109] LLM inference: Think: I need to check the real-time logistics data. I know the unit code is "17th Field Artillery Brigade" and the material is "155mm ammunition". I need to call the logistics query tool in MCP.

[0110] Tool strategy: The logistics data may be very large, I cannot pull back all the data. I must write code to filter the data with "delay > 48 hours" on the server side.

[0111] Code Generation: LLM generates a Python code block to call the MCP service and filter information.

[0112] Code runs in a sandboxed code executor secure environment.

[0113] MCP Call: logistics_tool.query_shipments makes a request to the backend database, retrieving all relevant DLMS records. Assume 50,000 JSON records are returned (approximately 5 MB of data).

[0114] Local Filtering: The Python script iterates through these 50,000 records in sandboxed memory. It finds that only 350 records meet the condition "delay > 48 hours," and most of them are stuck at "Node: Main Supply Point Warehouse A."

[0115] Return Result: The code function returns the following refined JSON object (only approximately 100 tokens): { "MSR-A": { "count": 2500, "reason_inference": "High concentration of delayed shipments" }, "Railhead-Bravo": { "count": 500 } } The returned LLM input is: Compressed operational orders (provided context: Warehouse A is a mountain road).

[0116] Code Execution Result (provided fact: Warehouse A has 2500 rounds of ammunition stuck).

[0117] Generated Analysis Report: XX Theater 155mm Ammunition Supply Bottleneck Analysis Report Core Findings: Despite operational orders indicating that the 17th Field Artillery Brigade should be prioritized for supplies, a significant supply chain disruption is currently being monitored.

[0118] Detailed Data: Main Bottleneck: Warehouse A (MSR-A).

[0119] Stuck Quantity: 2500 rounds of 155mm shrapnel (approximately 40% of total requests).

[0120] Delay Duration: All stranded batches have been in transit for over 48 hours.

[0121] Attribution Analysis: In context, Warehouse A is located on a mountainous stretch of road. The large amount of ammunition stranded at this node can indicate that the node's transit capacity has been saturated, or is affected by the weather / enemy situation shown in recent sensor data (the system can suggest further querying of sensor data for verification).

[0122] Recommendation: Immediately enable alternate route to Warehouse B (refer to Operational Orders Appendix C).

[0123] The various embodiments described in this specification are presented by way of example, and in the interest of brevity and clarity are not intended to be exhaustive. The various embodiments described in this specification can be combined in any suitable manner. Various embodiments of the systems disclosed herein can be implemented or used in conjunction with the methods disclosed herein. The various embodiments described in this specification are directed to various implementations of the features, aspects and / or concepts disclosed herein. Numerous specific details are set forth herein in order to provide a thorough understanding of the implementations. However, in some instances, well-known methods, procedures, components and circuits have not been described in detail in order to avoid unnecessarily obscuring aspects of the implementations. Therefore, the various embodiments described in this specification are not intended to be exhaustive or to be limited to the precise forms disclosed. Persons skilled in the relevant art will recognize that many modifications and variations are possible in light of the above teachings.

[0124] The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A computer intelligence analysis method for context refinement and code generation, characterized in that, The method comprises the following steps: S1, in a computer processor, obtaining massive heterogeneous original intelligence data; S2, based on the query instruction, performing a saliency-driven context compression process on the original intelligence data to obtain a first compressed context; S3, based on the first compressed context, using a large language model to generate a corresponding code block; S4, in a sandbox code executor, based on the instructions of the code block, calling a backend MCP service and receiving its return result, filtering the return result to obtain a second compressed context; S5, based on the first compressed context and the second compressed context, using the large language model to generate an intelligence data analysis report corresponding to the query instruction.

2. The method of claim 1, wherein, The original intelligence data in step S1 includes sensor data, data in a business database, and open source social media data.

3. The method of claim 1, wherein, The saliency-driven context compression process in step S2 specifically includes: S21, using a multi-layer perception (MLP) to extract all tokens in the input data stream; S22, based on the user query instruction, calculating the saliency score of each token; S23, deleting tokens corresponding to saliency scores below a preset threshold; S24, dividing the remaining token text after deletion into multiple fixed-length data blocks, and calculating the information density index of each data block; S25, based on a learnable compression encoder, mapping all data blocks into a corresponding number of soft token vectors, and concatenating them to obtain a first compressed context.

4. The method of claim 3, wherein, In step S24, the information density index includes: field relevance density and semantic information amount ; the field relevance density is expressed by the formula: = The semantic information amount is expressed by a formula as follows: = wherein, denotes the i th data block, denotes the number of times w the keyword i occurs in the th data block, w denotes the inverse document frequency of the keyword in the collection of historical intelligence documents; denotes the data block length, denotes the t th token, denotes the t 1 token sequence, denotes the conditional probability prediction.

5. The method of claim 3, wherein, In step S25, the determination method of the corresponding number is: Based on the information density index, segmenting and mapping each data block, assigning different numbers of compressed soft tokens to each data block, and adding up all the numbers of soft tokens to obtain the corresponding number.

6. The method of claim 1, wherein, Step S4 specifically includes: S41, in the sandbox code executor, performing a security review on the code block and initiating a tool metadata request to the backend MCP service based on the instructions of the code block; S42, after receiving the request, the backend MCP service parses the query intent and routes it to the corresponding underlying data source to perform an original query; returns the complete and unrefined original result set to the sandbox code executor; S43, in the sandbox code executor, performing field filtering, condition filtering, aggregation / statistics / ordering, and result truncation operations, and serializing the structured text to obtain a second compressed context.

7. The method of claim 6, wherein, In step S41, based on the instructions of the code block, the tool metadata request is initiated to the backend MCP service, specifically including: Based on each instruction step of the code block, dynamically loading the structured description information of the required MCP tool or interface.

8. A computer intelligence analysis system for context refinement and code generation, characterized by, The method comprises the following steps: A data access layer is used to obtain massive heterogeneous original intelligence data; A front-end refinement module is coupled to the data access layer and is used to receive the original intelligence data and perform a saliency-driven context compression process based on a query instruction to generate and output a first compressed context; A backend refinement module includes a large language model and a sandbox code executor; The large language model is used to generate a corresponding code block based on the first compressed context and send it to the sandbox code executor; Also used for generating an intelligence data analysis report corresponding to the query instruction based on the first compression context and the second compression context; The sandbox code executor is configured to call a backend MCP service based on the instructions of the code block and receive a return result thereof, filter the return result to obtain the second compression context, and return the second compression context to the large language model.

9. The system of claim 8, wherein, The data access layer is in communication connection with a sensor, a business database, and an open source social media, and is configured to obtain sensor data, data in the business database, and open source social media data.