The application discloses an iterative chart
code generation method and device based on a chart and a code error correction
large model, and relates to the technical field of chart
code generation. The method comprises the following steps: based on a code error classification
system, using a multi-
modal large model to perform data variation according to an original chart code pair, and constructing an
original data set; based on the code error classification
system and a line-level
Levenshtein distance algorithm, adding correction prompt information according to the
original data set, and constructing a training
data set; based on an LLaMA-Factory fine-tuning framework and a GRPO training strategy, performing two-stage training on a code error correction
large model according to the training
data set, and obtaining an optimized code error correction large model; and based on the optimized code error correction large model and a chart
code generation large model, performing iterative code generation according to a target reference chart, and obtaining target generated code. The application is a chart-based high-precision, interpretable and iterative chart code generation method.