Search

CN-121981108-A - Intelligent body model type context engineering and visual optimization method, device, equipment and medium

CN121981108ACN 121981108 ACN121981108 ACN 121981108ACN-121981108-A

Abstract

The invention provides an agent paradigm context engineering and visual optimization method, device, equipment and medium, wherein the method comprises the steps of completing prepositive preparation such as software and hardware environment deployment, large model configuration and the like, and instantiating a producer and supervisor dual agent, a context engineering agent and a contribution analysis component; the method comprises the steps of obtaining standard output through double-agent iterative optimization (execution-verification-optimization closed loop), calculating and visualizing contribution degree of input token based on an integrated gradient algorithm, screening key token directional intervention verification, finally setting a real-time monitoring mechanism and setting a quarter iterative period to realize quantization, orientation, visual tuning and service adaptation, and realizing the requirements of quantization, orientation and visual tuning of agents.

Inventors

  • LI NING
  • XIE QI
  • WANG ZHONGLING
  • FAN ZHIYU
  • LI SITONG

Assignees

  • 华福证券有限责任公司

Dates

Publication Date
20260505
Application Date
20251229

Claims (10)

  1. 1. The intelligent body paradigm context engineering and visual optimization method is characterized by comprising the following steps of: S1, deploying a set hardware environment and a set software environment, configuring a target large model based on a transformer architecture and exposing an API interface, wherein the API interface supports input token, embedded layer data output and generation result return; S2, respectively instantiating a producer agent and a supervisor agent, wherein the producer agent is configured with task types, output formats and overtime threshold parameters for executing service tasks in the forward direction; S3, instantiating a context engineering intelligent agent, and configuring a context strategy combination, a paradigm template ID and a redundant filtering threshold parameter, wherein the context strategy combination comprises at least one of persistent memory and a context partition, and the paradigm template ID corresponds to a preset template; S4, instantiating a visual contribution computing component and a visual contribution display component, wherein the visual contribution computing component configures sampling times, computing precision and parallel computing thread number parameters, and calculates the contribution IG value of an input token to an output result based on an integrated gradient algorithm; S5, defining task parameters and generating an initial input text, performing tasks by a producer agent to obtain initial output, and verifying the accuracy and the integrity of the initial output by a supervisor agent based on standard data and a necessary word segment; S6, selecting the last round of optimized input text in the iterative optimization process, determining target output token, and calculating the IG value of each token in the input text to the target output token through a visual contribution calculation component to obtain a contribution calculation result containing the token text, the token ID and the IG value; S7, carrying out visual processing on a contribution degree calculation result through a visual contribution degree display component, screening the front 20% positive contribution token as a key influence token set, carrying out directional intervention on an optimized input text based on the key influence token set, inputting the input text after the intervention into a producer agent to execute tasks, and verifying whether an output result meets a preset standard; S8, recording effective component configuration, parameter setting and intervention schemes in S2 to S7, generating a configuration manual and storing the configuration manual in a knowledge base, instantiating a monitoring vocabulary management tool, adding a key influence token set into the monitoring vocabulary, configuring vocabulary updating frequency and monitoring alarm threshold value, establishing a real-time monitoring mechanism of an input text, and setting a periodic iteration updating period.
  2. 2. The intelligent body normal form context engineering and visual optimization method according to claim 1, wherein the configuration rule of the baseline sample in S1 is that the baseline sample of text type input is a token sequence corresponding to an empty string, the baseline sample of numerical type input is a token value corresponding to the mean value of the data, and the mixed type input is divided according to the data types and adopts text type and numerical type baseline configuration rules respectively.
  3. 3. The intelligent body normal form context engineering and visual optimization method according to claim 1 is characterized in that in S5, the supervisor intelligent body verifies the accuracy and the integrity of initial output based on standard data and the necessary-to-be-filled word segments, wherein SentenceTransformer models are adopted to encode output results and standard data respectively, cosine similarity of the output results and the standard data is calculated, accuracy is judged to be up to standard if the similarity is larger than or equal to an accuracy verification threshold value, integrity verification is achieved by verifying whether the output results contain all the necessary-to-be-filled word segments, and integrity is judged to be up to standard if the missing field occupation ratio is smaller than or equal to a 1-integrity verification threshold value.
  4. 4. The method for optimizing the input text by the intelligent agent paradigm according to claim 1, wherein the method for optimizing the input text by the intelligent agent for optimizing the environment is characterized in that in S5, if a persistent memory strategy is configured, historical contexts are stored through Redis and integrated into the current input text, if a context partitioning strategy is configured, the input text is classified and recombined according to task targets, executing steps, intermediate results and constraint conditions, redundant information in the input text is filtered based on a redundant filtering threshold, and finally, the input text is subjected to format recombination by using a paradigm template.
  5. 5. The intelligent body normal form context engineering and visual optimization method according to claim 1, wherein the specific process of calculating the IG value by the visual contribution calculating component in S6 is as follows: Converting the input text into a token sequence through tokenizer tools of a large model, and acquiring ID and text information of the input token; Generating a baseline token sequence corresponding to the input token sequence based on the baseline sample configured in the S1; sampling m times along a path from the base line token sequence to the input token sequence, wherein m is configured sampling times, and calculating an interpolation input corresponding gradient obtained by each sampling; and calculating the average value of m sampling gradients, calculating the IG value of a single token through a gradient integral formula, and integrating the information of all the tokens to obtain a contribution degree calculation result.
  6. 6. The intelligent body normal form context engineering and visual optimization method according to claim 1, wherein the specific process of the directional intervention in the step S7 is that the position of key influence token in an input text is positioned through a tokenizer tool, fuzzy key token is replaced by a preset accurate expression vocabulary, and after replacement is completed, a post-dry token sequence is reduced to the text through a tokenizer tool, so that the input text with a post-dry state is obtained.
  7. 7. The intelligent body normal form context engineering and visual optimization method according to claim 1, wherein the implementation process of the real-time monitoring mechanism in the step S8 is that whether the token in the input text contains the key token in the monitored vocabulary is detected in real time through a monitoring vocabulary management tool, if the key token is detected, an alarm is triggered, alarm information is output, a manual auditing process or an automatic intervention process can be selectively executed after the alarm is triggered, and the automatic intervention process is that the input text is processed by calling the directional intervention method in the step S7.
  8. 8. The intelligent body paradigm context engineering and visual optimizing device is characterized by comprising: The front-end preparation module is used for deploying a set hardware environment and a set software environment, configuring a target large model based on a transformer architecture and exposing an API interface, wherein the API interface supports input token conversion, embedded layer data output and generation result return; The system comprises a dual-agent instantiation module, a supervisor agent, a counter-verification module and a counter-verification module, wherein the dual-agent instantiation module respectively instantiates a producer agent and the supervisor agent, and the producer agent is configured with task types, output formats and overtime threshold parameters for executing service tasks in the forward direction; The system comprises a context optimization agent instantiation module, a context engineering agent, a configuration strategy combination, a paradigm template ID and a redundancy filtering threshold parameter, wherein the context strategy combination comprises at least one of persistent memory and a context partition, and the paradigm template ID corresponds to a preset template; The contribution analysis component instantiation module is used for instantiating a visual contribution calculation component and a visual contribution display component, wherein the visual contribution calculation component is used for configuring sampling times, calculation precision and parallel calculation thread number parameters, and calculating the contribution IG value of an input token to an output result based on an integrated gradient algorithm; the dual-agent iterative optimization module defines task parameters and generates initial input text, the initial output is obtained by the producer agent executing the task, and the supervisor agent verifies the accuracy and the integrity of the initial output based on standard data and the necessary word segments; The quantization contribution analysis module selects the last round of optimized input text in the iterative optimization process, determines target output token, calculates the IG value of each token in the input text to the target output token through the visual contribution calculation module, and obtains a contribution calculation result containing the token text, token ID and IG value; The directional tuning and effect verification module performs visual processing on the contribution degree calculation result through the visual contribution degree display component, screens the front 20% positive contribution token as a key influence token set, performs directional intervention on the optimized input text based on the key influence token set, inputs the input text after the intervention into a producer agent to execute tasks, and verifies whether the output result meets a preset standard; The system comprises a tuning effect solidification and monitoring module, an instantiation monitoring vocabulary management tool, a real-time monitoring mechanism and a periodic iteration updating period, wherein the tuning effect solidification and monitoring module records effective component configuration, parameter setting and intervention schemes from a dual-agent instantiation module to a directional tuning and effect verification module, generates a configuration manual and stores the configuration manual to a knowledge base, the instantiation monitoring vocabulary management tool adds a key influence token set into a monitoring vocabulary, configures vocabulary updating frequency and monitoring alarm threshold value, establishes a real-time monitoring mechanism of an input text, and the periodic iteration updating period is set.
  9. 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 7 when the program is executed by the processor.
  10. 10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1 to 7.

Description

Intelligent body model type context engineering and visual optimization method, device, equipment and medium Technical Field The invention relates to the technical field of artificial intelligence, in particular to an intelligent body paradigm context engineering and visual optimization method, device, equipment and medium. Background The intelligent agent is a software system or application which takes a large model as a core reasoning engine and integrates sensing, planning, decision making and executing capabilities, and is mainly divided into a single intelligent agent and a plurality of intelligent agents. The multi-agent system consists of a plurality of agents with certain autonomous capability, and solves the complex problem that the single agent is difficult to deal with through cooperative cooperation. In the financial industry, multi-agent collaboration has become a mainstream trend. The developer can build the multi-agent system by means of the single agents which have been tested and validated in the specific task, and the method can not only improve the development efficiency, but also enhance the reliability of the system. Currently, most successful landing multi-intelligent systems employ orchestration agents or semi-structured orchestration modes to compromise the reliability and flexibility of the system. Currently, on the premise of not changing basic large model parameters (i.e. no parameter tuning), tuning methods mainly adopted for constructing an intelligent Agent (AI Agent) comprise Prompt engineering optimization, RAG (retrieval enhancement generation), workflow structure optimization and the like. However, these parameter-free tuning methods have significant drawbacks, particularly in the following two aspects: Firstly, the task planning of the long chain has defects. On one hand, the task disassembling capability is insufficient, complex tasks such as building project management and the like are difficult to be effectively disassembled into executable subtasks, on the other hand, the problem of long-term memory deficiency exists, and when the task which lasts for a plurality of hours or even days is processed, the context information is easy to forget, so that the continuity of task processing is lost. Secondly, the data deviation is difficult to realize quantitative tuning. Firstly, the problem of inconsistent distribution exists, the distribution of the pre-training data and the distribution of the fine-tuning track are not matched, and therefore the system performance is unstable, secondly, the problem of illusion exists, an intelligent agent based on a Large Language Model (LLM) can generate inaccurate or fictional information, and the problem can seriously influence the reliability of decision-making in high-risk scenes such as medical treatment, finance and the like. In conclusion, the existing parameter-free tuning method cannot meet the tuning requirements of an intelligent agent in the aspects of quantization, orientation and visualization. Disclosure of Invention The technical problem to be solved by the invention is to provide an intelligent body normal form context engineering and visual optimization method, device, equipment and medium, so that the intelligent body can be upgraded from 'executable' to 'accurate, reliable and interpretable', and the intelligent body normal form context engineering and visual optimization method, device, equipment and medium are particularly suitable for the intelligent body landing with quantized requirements, high risk and complex scene on optimization effect. In a first aspect, the present invention provides an agent paradigm context engineering and visual tuning method, comprising the steps of: S1, deploying a set hardware environment and a set software environment, configuring a target large model based on a transformer architecture and exposing an API interface, wherein the API interface supports input token, embedded layer data output and generation result return; S2, respectively instantiating a producer agent and a supervisor agent, wherein the producer agent is configured with task types, output formats and overtime threshold parameters for executing service tasks in the forward direction; S3, instantiating a context engineering intelligent agent, and configuring a context strategy combination, a paradigm template ID and a redundant filtering threshold parameter, wherein the context strategy combination comprises at least one of persistent memory and a context partition, and the paradigm template ID corresponds to a preset template; S4, instantiating a visual contribution computing component and a visual contribution display component, wherein the visual contribution computing component configures sampling times, computing precision and parallel computing thread number parameters, and calculates the contribution IG value of an input token to an output result based on an integrated gradient algorithm; S5, defining task paramete