This invention relates to a large
language model reasoning method based on relational constraints and path guidance. The method receives an input question through a large
language model and generates a set of relational constraints semantically related to the input question by combining preset prompts. Using a
knowledge graph as the retrieval object, multi-hop relation retrieval is performed iteratively based on the generated set of relational constraints. After each hop, the
semantic similarity between candidate relations and the input question and relational constraints is calculated, constructing a constrained multi-hop relation space. The multi-hop relation space is combined with the input question, and an interpretable relational path is generated through the large
language model. Based on the generated relational path, corresponding candidate subgraphs are retrieved from the
knowledge graph. Through hop-by-hop entity filtering and
pruning operations, the relational path is instantiated into an entity-level reasoning path. The obtained reasoning path is combined with the input question, and an accurate and interpretable answer is generated through the large language model.