The invention discloses a large
language model XPath generation method based on hierarchical composite reward
reinforcement learning, and the method specifically comprises the following steps: 1, obtaining
HTML (
Hypertext Markup Language) source codes and page element information of a target webpage, carrying out the data cleaning, and obtaining structured data containing a DOM (
Document Object Model) hierarchical
sequence structure and an element attribute value; performing
data annotation on the structured data after data cleaning to obtain an annotated
data set; 2, selecting a basic model, performing supervision and
fine tuning on the basic model by using the
annotation data set, and taking the basic model subjected to supervision and
fine tuning as a strategy model; constructing a layered composite reward function to perform
reinforcement learning fine tuning, so that the output hierarchy of the strategy model is aligned with the input DOM hierarchy, and obtaining a final model subjected to two-stage fine tuning; and 3, generating a standard
XPath character string, and outputting structured data matched with the input DOM hierarchy to display layer-by-layer construction logic of the standard
XPath character string. According to the method, the stable XPath can be generated, and the
generation process is completely transparent and traceable.