The invention discloses an intelligent
data query system and method based on
natural language processing, and relates to the technical field of
natural language processing and
database query. According to the method,
natural language input and
database mode information are received, a historical
query log is combined to construct mode knowledge representation, a query skeleton is generated on the basis, a fine-tuned large
language model is called to generate candidate
SQL statements, error detection and
ambiguity recognition are carried out on the candidate statements, and the query result is obtained. And if necessary, triggering interaction clarification and updating a query result according to
user feedback. And meanwhile, the wrong clauses are locally repaired through a gating mechanism, and the clauses are returned and regenerated when multiple times of repair fails, so that the
correctness of the
query statement is ensured. And finally, after the
SQL is executed in the
database, a result is fed back to the user. Besides, the
system records generation and repair tracks in the operation process, and continuously optimizes the model based on reward shaping, comparative learning and self-game training, so as to improve the generalization ability in different business scenes.