An invoice anomaly detection method and system based on vector weighting and density clustering

By employing vector weighting and density clustering, the problems of low automation and weak anomaly detection capabilities in invoice management are solved, achieving efficient and accurate invoice anomaly detection, adapting to the characteristics of different industries, and supporting the integration of multiple business systems.

CN120954015BActive Publication Date: 2026-08-04FUJIAN BOSS SOFTWARE
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
FUJIAN BOSS SOFTWARE
Filing Date
2025-07-04
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing technologies for invoice management suffer from low automation, weak anomaly detection capabilities, and insufficient system scalability, making it difficult to achieve large-scale, unsupervised invoice anomaly detection, especially lacking the ability to automatically identify the behavioral patterns of invoicing entities.

Method used

A vector-weighted and density-based clustering method is adopted. The project proportion vector and project semantic vector are extracted and weighted and fused. The UMAP algorithm is used for dimensionality reduction and combined with the HDBSCAN algorithm for clustering to construct clusters. The clusters are then merged through a domain-oriented dictionary. Finally, abnormal invoices are identified based on cosine similarity.

Benefits of technology

It significantly improves the accuracy, efficiency, and adaptability of invoice anomaly detection, can identify hidden behavioral deviations and semantic anomalies in complex invoicing patterns, reduces reliance on manual rules, adapts to the characteristics of different industries, and supports integration of multiple business systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120954015B_ABST
    Figure CN120954015B_ABST
Patent Text Reader

Abstract

The application provides an invoice abnormality detection method and system based on vector weighting and density clustering in the technical field of artificial intelligence and invoice management, which comprises the following steps: S1, obtaining and preprocessing electronic invoices to be detected; S2, extracting a project proportion vector and a project semantic vector from each electronic invoice, and obtaining a fusion vector through weighted fusion; S3, performing dimension reduction and clustering on each fusion vector to construct a plurality of clustering clusters; S4, extracting the invoicing unit name from each electronic invoice in each clustering cluster, extracting keywords from each invoicing unit name, and matching a directional label from a field pointing dictionary through the keywords to merge each clustering cluster; and S5, identifying a first abnormal invoice from each clustering cluster based on cosine similarity, and taking an electronic invoice not belonging to each clustering cluster as a second abnormal invoice. The application has the advantages of greatly improving the accuracy, efficiency and adaptability of invoice abnormality detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of interdisciplinary technology of artificial intelligence and invoice management, and specifically to an invoice anomaly detection method and system based on vector weighting and density clustering. Background Technology

[0002] With the popularization of electronic invoices, electronic document management systems, and big data analytics, more and more enterprises and institutions are beginning to digitally manage and risk-audit invoices, namely, managing large numbers of invoices through classification and anomaly detection. Current technologies for invoice management mainly include the following methods: 1. Utilizing a basic data warehouse for invoice archiving and retrieval; 2. Employing rule-based engine-based invoice review (such as keyword filtering and fixed template matching); 3. Introducing machine learning methods (such as classification models) to identify some abnormal invoices; 4. Introducing natural language processing (NLP) technology to perform semantic analysis on invoice item descriptions, thereby assisting in classification and screening.

[0003] However, overall, existing technologies are still primarily rule-driven, with manual review serving as an important supplement. They cannot truly achieve large-scale, unsupervised, and automated invoice anomaly detection, especially in terms of the ability to automatically identify the behavioral patterns of the invoicing entity itself, which is still in the exploratory stage. The main shortcomings are as follows:

[0004] 1. The classification method is highly subjective and has a low degree of automation: It relies on manually setting classification rules or specific keyword lists, which cannot adapt to the diversity and variability of invoice item descriptions; the actual invoicing behavior patterns of the unit are difficult to cover with simple rules, which can easily lead to classification errors or omissions.

[0005] 2. Weak anomaly detection capability and difficulty in identifying hidden problems: Existing methods are mostly based on static rules (such as blacklists and quota rules) for anomaly screening, lacking analysis of the overall invoicing pattern of the unit; they cannot effectively identify potential risks such as behavioral deviations, abnormal invoicing content, and category mismatches that occur in the unit over time.

[0006] 3. Lack of a unified and efficient data processing mechanism: As the scale of invoice data grows, the efficiency of traditional rule-based matching detection gradually declines; a large amount of low-quality and redundant data increases the system's audit burden and reduces the accuracy of anomaly detection.

[0007] 4. Insufficient system scalability and adaptability: The rule system is updated frequently and has high maintenance costs; it is difficult to adapt to the characteristics of different regions and industries and the differences in invoicing behavior.

[0008] Therefore, how to provide an invoice anomaly detection method and system based on vector weighting and density clustering to improve the accuracy, efficiency and adaptability of invoice anomaly detection has become an urgent technical problem to be solved. Summary of the Invention

[0009] The technical problem to be solved by the present invention is to provide an invoice anomaly detection method and system based on vector weighting and density clustering, so as to improve the accuracy, efficiency and adaptability of invoice anomaly detection.

[0010] In a first aspect, the present invention provides an invoice anomaly detection method based on vector weighting and density clustering, comprising the following steps:

[0011] Step S1: Obtain the electronic invoices to be tested on an annual basis, and preprocess each of the electronic invoices;

[0012] Step S2: Extract the item proportion vector and item semantic vector from each of the preprocessed electronic invoices, and perform weighted fusion on each of the item proportion vectors and item semantic vectors to obtain the fusion vector of the corresponding electronic invoice;

[0013] Step S3: Reduce the dimensionality of each fused vector using the UMAP algorithm to obtain a low-dimensional vector, cluster each low-dimensional vector using the HDBSCAN algorithm to generate a corresponding cluster label for each low-dimensional vector, and construct several clusters based on each cluster label.

[0014] Step S4: Extract the name of the issuing unit from the electronic invoices of each cluster, extract keywords from the name of the issuing unit, match directional tags from a preset domain-oriented dictionary using the keywords, and merge each cluster based on the directional tags.

[0015] Step S5: Identify the first abnormal invoice from each cluster based on cosine similarity, and identify the electronic invoices that do not belong to each cluster as the second abnormal invoices. Output the invoice anomaly detection result based on each of the first abnormal invoices and the second abnormal invoices.

[0016] Furthermore, step S1 specifically includes:

[0017] The electronic invoices to be tested are obtained on an annual basis. Each electronic invoice undergoes preprocessing, including at least invalid character removal, deletion of test item invoices, deletion of red-ink invoices, and screening of invoice volume.

[0018] Furthermore, step S2 specifically includes:

[0019] Extract the item percentage vector from each of the preprocessed electronic invoices:

[0020] w i =α·c i +(1-α)·a i ;

[0021] Among them, wi Represents the project proportion vector of the i-th project; α represents the frequency proportion weight; c i This represents the frequency percentage of the i-th item within the corresponding invoicing unit; (1-α) represents the weight of the amount percentage; a i This represents the percentage of the amount for the i-th item in the corresponding invoicing unit;

[0022] The project semantic vector v is extracted from each of the pre-processed electronic invoices using a pre-trained Qwen3-Embedding-0.6B model. i ;

[0023] The weighted fusion of the respective item proportion vectors and item semantic vectors yields the fusion vector for the corresponding electronic invoice:

[0024] A = Σ i w i ·v i ;

[0025] Where A represents the fusion vector.

[0026] Furthermore, step S3 specifically includes:

[0027] The dimensionality of each fusion vector is reduced by the UMAP algorithm to obtain a 50-dimensional low-dimensional vector. The low-dimensional vectors are then clustered by the HDBSCAN algorithm to generate corresponding cluster labels[i] for each low-dimensional vector and to construct several clusters based on the cluster labels.

[0028] When labels[i]≥0, it means that the i-th invoice unit is assigned to the cluster numbered labels[i]; when labels[i]=-1, it means that the i-th invoice unit is not assigned to any cluster.

[0029] Furthermore, step S4 specifically includes:

[0030] The names of the issuing units are extracted from the electronic invoices of each cluster. After preprocessing the names of the issuing units by word segmentation and removal of stop words, keywords are extracted by TF-IDF algorithm. The keywords are then used to match directional tags from a preset domain-oriented dictionary. Based on the directional tags, the clusters are merged.

[0031] Step S5 specifically involves:

[0032] The average value of the low-dimensional vectors of each cluster is taken as the category center vector. The cosine similarity between each low-dimensional vector and the category center vector is calculated. Based on the cosine similarity, the first abnormal invoice is identified from each cluster.

[0033] Electronic invoices issued by units that do not belong to any of the aforementioned clusters will be classified as second abnormal invoices.

[0034] Output the invoice anomaly detection results based on each of the first and second abnormal invoices.

[0035] Secondly, the present invention provides an invoice anomaly detection system based on vector weighting and density clustering, comprising the following modules:

[0036] The electronic invoice preprocessing module is used to obtain electronic invoices to be tested on an annual basis and to preprocess each of the electronic invoices.

[0037] The fusion vector generation module is used to extract the item proportion vector and the item semantic vector from each of the preprocessed electronic invoices, and to perform weighted fusion on each of the item proportion vectors and the item semantic vectors to obtain the fusion vector of the corresponding electronic invoice.

[0038] The vector dimensionality reduction and clustering module is used to reduce the dimensionality of each fused vector using the UMAP algorithm to obtain low-dimensional vectors, and to cluster each low-dimensional vector using the HDBSCAN algorithm to generate corresponding cluster labels for each low-dimensional vector, and to construct several clusters based on each cluster label.

[0039] The cluster merging module is used to extract the invoicing unit name from the electronic invoices of each cluster, extract keywords from the invoicing unit name, match directional tags from a preset domain-oriented dictionary using the keywords, and merge each cluster based on the directional tags.

[0040] The detection result output module is used to identify first abnormal invoices from each of the clusters based on cosine similarity, identify electronic invoices that do not belong to each of the clusters as second abnormal invoices, and output invoice anomaly detection results based on each of the first abnormal invoices and the second abnormal invoices.

[0041] Furthermore, the electronic invoice preprocessing module is specifically used for:

[0042] The electronic invoices to be tested are obtained on an annual basis. Each electronic invoice undergoes preprocessing, including at least invalid character removal, deletion of test item invoices, deletion of red-ink invoices, and screening of invoice volume.

[0043] Furthermore, the fusion vector generation module is specifically used for:

[0044] Extract the item percentage vector from each of the preprocessed electronic invoices:

[0045] w i =α·c i +(1-α)·a i;

[0046] Among them, w i Represents the project proportion vector of the i-th project; α represents the frequency proportion weight; c i This represents the frequency percentage of the i-th item within the corresponding invoicing unit; (1-α) represents the weight of the amount percentage; a i This represents the percentage of the amount for the i-th item in the corresponding invoicing unit;

[0047] The project semantic vector v is extracted from each of the pre-processed electronic invoices using a pre-trained Qwen3-Embedding-0.6B model. i ;

[0048] The weighted fusion of the respective item proportion vectors and item semantic vectors yields the fusion vector for the corresponding electronic invoice:

[0049] A = ∑ i w i ·v i ;

[0050] Where A represents the fusion vector.

[0051] Furthermore, the vector dimensionality reduction clustering module is specifically used for:

[0052] The dimensionality of each fusion vector is reduced by the UMAP algorithm to obtain a 50-dimensional low-dimensional vector. The low-dimensional vectors are then clustered by the HDBSCAN algorithm to generate corresponding cluster labels[i] for each low-dimensional vector and to construct several clusters based on the cluster labels.

[0053] When labels[i]≥0, it means that the i-th invoice unit is assigned to the cluster numbered labels[i]; when labels[i]=-1, it means that the i-th invoice unit is not assigned to any cluster.

[0054] Furthermore, the cluster merging module is specifically used for:

[0055] The names of the issuing units are extracted from the electronic invoices of each cluster. After preprocessing the names of the issuing units by word segmentation and removal of stop words, keywords are extracted by TF-IDF algorithm. The keywords are then used to match directional tags from a preset domain-oriented dictionary. Based on the directional tags, the clusters are merged.

[0056] The detection result output module is specifically used for:

[0057] The average value of the low-dimensional vectors of each cluster is taken as the category center vector. The cosine similarity between each low-dimensional vector and the category center vector is calculated. Based on the cosine similarity, the first abnormal invoice is identified from each cluster.

[0058] Electronic invoices issued by units that do not belong to any of the aforementioned clusters will be classified as second abnormal invoices.

[0059] Output the invoice anomaly detection results based on each of the first and second abnormal invoices.

[0060] The advantages of this invention are:

[0061] 1. The process involves acquiring and preprocessing the electronic invoices to be detected. Item proportion vectors and semantic vectors are extracted from each preprocessed electronic invoice. These vectors are then weighted and fused to obtain a fused vector for each electronic invoice. Next, the dimensionality of each fused vector is reduced using the UMAP algorithm to obtain low-dimensional vectors. The HDBSCAN algorithm is then used to cluster these low-dimensional vectors, generating corresponding cluster labels for each vector. Several clusters are constructed based on these labels. The issuing unit name is extracted from the electronic invoices within each cluster, and keywords are extracted from these names. These keywords are then matched with directional tags from a pre-defined domain-oriented dictionary. The clusters are then merged based on these directional tags. Finally, cosine similarity is used to identify first-abnormal invoices from each cluster, and electronic invoices not belonging to any cluster are identified as second-abnormal invoices. The process is then further refined based on the first and second-abnormal invoices. The system outputs invoice anomaly detection results. It extracts the item proportion vector (quantitative feature) and item semantic vector (textual feature) from electronic invoices, weighted and fused to form a fusion vector comprehensively representing the invoice characteristics. UMAP dimensionality reduction combined with HDBSCAN density clustering is then used to obtain clusters. These clusters are then semantically merged using a domain-oriented dictionary. Finally, two types of anomalies in electronic invoices are identified based on intra-cluster similarity (cosine similarity) and outliers, thus replacing manual rules with a data-driven approach. Specifically, it objectively captures complex invoicing patterns through fusion vectors, improving accuracy (identifying hidden behavioral shifts and semantic anomalies); efficiently processes massive amounts of data through dimensionality reduction and density clustering, improving efficiency; and adapts to different industry characteristics through an unsupervised clustering framework and an extensible domain-oriented dictionary. Application scenarios can be expanded simply by updating the domain-oriented dictionary, significantly improving adaptability. Ultimately, this greatly improves the accuracy, efficiency, and adaptability of invoice anomaly detection.

[0062] 2. By using feature fusion (weighted integration of project percentage vector and project semantic vector), invoice information is captured from multiple dimensions: the project percentage vector, based on frequency and amount percentages, reflects the distribution of financial data; the project semantic vector uses a pre-trained Qwen3-Embedding-0.6B model to extract textual semantic features (such as name or description). This weighted fusion enhances feature expressiveness, avoids bias from single features, and thus improves the accuracy of anomaly detection; by using the HDBSCAN algorithm for density clustering, noise and clusters of different densities can be automatically handled. Combined with UMAP dimensionality reduction, the "curse of dimensionality" problem of high-dimensional data is reduced, ensuring that the model can still stably identify anomalies in complex data (such as variations in invoice amount and semantics), and has stronger robustness (more tolerant to input noise or missing data).

[0063] 3. UMAP dimensionality reduction compresses high-dimensional fused vectors to low-dimensional (50-dimensional), significantly reducing computational complexity and memory overhead. UMAP is particularly suitable for processing sparse or unstructured data (such as invoice text), converges faster than traditional dimensionality reduction methods (such as PCA), and optimizes subsequent clustering steps. Combined with HDBSCAN clustering, its density-based characteristics can efficiently process large-scale datasets (invoices obtained on an annual basis), reducing the need for manual parameter adjustment and improving overall detection speed. Based on TF-IDF, keywords are extracted and matched with domain-oriented dictionaries for clustering and merging. Then, cosine similarity is used to quickly identify anomalies (calculating the similarity between low-dimensional vectors and category center vectors), reducing the reliance on manual review. It is easy to integrate into enterprise financial systems and supports expansion to other fields (such as financial risk control or supply chain management).

[0064] 4. By classifying anomalies into two categories: first-class anomalous invoices (identified within clusters based on cosine similarity) capture subtle anomalies (such as anomalous invoice amounts), while second-class anomalous invoices (invoicing units not belonging to any cluster) detect overall outliers (such as fraudulent units), this hierarchical approach covers a more comprehensive range of anomaly scenarios and improves the interpretability of the results; by incorporating domain knowledge (such as merging clusters of similar industries) through cluster merging (based on keyword-oriented labels), the output becomes more business-meaningful and easier for users to understand audit risks (such as identifying the proportion of fraudulent invoices).

[0065] 5. Preprocessing (removal of invalid characters, deletion of test item invoices, and deletion of red-ink invoices) ensures clean input data, reduces noise interference, and avoids false alarms (such as incorrect detection caused by test data). Invoice volume screening further filters low-value electronic invoices, improving reliability.

[0066] 6. The invoice anomaly detection method based on vector weighting and density clustering significantly improves the accuracy, robustness, and efficiency of invoice anomaly detection. It captures multi-dimensional financial features by weighted fusion of project proportion vectors and semantic vectors. It combines UMAP dimensionality reduction and HDBSCAN density clustering to automatically process noise and identify different density clusters, optimizing the ability to identify subtle and overall anomalies (such as hierarchical first and second abnormal invoices). At the same time, it relies on preprocessing steps (such as invalid data cleaning and invoice volume screening) to improve input quality, and uses domain-oriented dictionaries and keyword matching to enhance business interpretability and practicality. Overall, it shows the advantages of high adaptability, low computational overhead, and comprehensive risk coverage.

[0067] 7. By adopting the unsupervised density clustering method (HDBSCAN), the invoicing units are automatically clustered and classified without relying on industry labels. By introducing project word vector modeling and weighted fusion mechanism, the behavioral characteristics of the invoicing units are accurately characterized, overcoming the subjectivity and limitations of traditional classification methods based on manual rules or static templates, and significantly improving the accuracy of classification and the level of system intelligence.

[0068] 8. By comprehensively utilizing clustering structure and semantic information of unit names, a multi-dimensional anomaly identification mechanism is designed: on the one hand, outlier behavior is identified through "outliers" in HDBSCAN clustering; on the other hand, classification deviation is judged by combining the semantic similarity between unit name vectors and cluster category labels. This can effectively identify abnormal changes, category mismatches or potential violations in the invoice issuance mode of the invoice issuing unit, thereby improving the intelligent capabilities of tax audit and risk monitoring.

[0069] 9. Compared with traditional algorithms such as BIRCH, the HDBSCAN algorithm has the advantages of good adaptability to different density cluster structures and no need to preset the number of clusters, and it exhibits stronger robustness in high-dimensional spaces. By combining vector dimensionality reduction and clustering optimization strategies, it can efficiently process large-scale and diverse electronic invoices and has good scalability and resource control capabilities.

[0070] 10. By adopting a self-learning vector modeling and clustering adaptive mechanism, there is no need to manually preset classification rules or manually maintain industry dictionaries, which greatly reduces deployment and long-term maintenance costs. At the same time, it has good versatility and portability, can be flexibly expanded according to regional and industry characteristics, supports integration between multiple business systems, and is suitable for promotion and application in various invoicing supervision scenarios such as government affairs, education, and medical care. Attached Figure Description

[0071] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0072] Figure 1 This is a flowchart of an invoice anomaly detection method based on vector weighting and density clustering according to the present invention.

[0073] Figure 2 This is a schematic diagram of the structure of an invoice anomaly detection system based on vector weighting and density clustering according to the present invention. Detailed Implementation

[0074] The overall approach of the technical solution in this application is as follows: A weighted fusion of the project proportion vector (quantitative feature) and the project semantic vector (textual feature) of the electronic invoice is formed to comprehensively represent the characteristics of the invoice. UMAP dimensionality reduction combined with HDBSCAN density clustering is then used to obtain clusters. These clusters are then semantically merged using a domain-oriented dictionary. Finally, two types of abnormal electronic invoices are identified based on intra-cluster similarity (cosine similarity) and outliers, thus replacing manual rules with a data-driven approach. Specifically, the fusion vector objectively captures complex invoicing patterns, improving accuracy (identifying hidden behavioral shifts and semantic anomalies); dimensionality reduction and density clustering efficiently process massive amounts of data, improving efficiency; and an unsupervised clustering framework and an extensible domain-oriented dictionary adapt to different industry characteristics, requiring only updates to the domain-oriented dictionary to expand application scenarios, significantly improving adaptability, and thus enhancing the accuracy, efficiency, and adaptability of invoice anomaly detection.

[0075] Please refer to Figures 1 to 2 As shown, a preferred embodiment of the invoice anomaly detection method based on vector weighting and density clustering of the present invention includes the following steps:

[0076] Step S1: Obtain the electronic invoices to be tested on an annual basis, and preprocess each of the electronic invoices;

[0077] Step S2: Extract the item proportion vector and item semantic vector from each of the preprocessed electronic invoices, and perform weighted fusion on each of the item proportion vectors and item semantic vectors to obtain the fusion vector of the corresponding electronic invoice;

[0078] In large-scale invoicing data, different types of invoicing units often have stable and distinguishable invoicing behavior patterns. In order to accurately capture the semantic features of each invoicing unit and provide structured input for subsequent clustering and anomaly detection, a fusion vector is constructed. The core process includes project proportion modeling, semantic vector extraction, weighted synthesis and nonlinear dimensionality reduction.

[0079] Step S3: Reduce the dimensionality of each fused vector using the UMAP algorithm to obtain a low-dimensional vector, cluster each low-dimensional vector using the HDBSCAN algorithm to generate a corresponding cluster label for each low-dimensional vector, and construct several clusters based on each cluster label.

[0080] Step S4: Extract the name of the issuing unit from the electronic invoices of each cluster, extract keywords from the name of the issuing unit, match directional tags from a preset domain-oriented dictionary using the keywords, and merge each cluster based on the directional tags.

[0081] Step S5: Identify the first abnormal invoice from each cluster based on cosine similarity, and identify the electronic invoices that do not belong to each cluster as the second abnormal invoices. Output the invoice anomaly detection result based on each of the first abnormal invoices and the second abnormal invoices.

[0082] Step S1 specifically involves:

[0083] The electronic invoices to be tested are obtained on an annual basis. Each electronic invoice undergoes preprocessing, including at least the removal of invalid characters, deletion of test item invoices, deletion of red-ink invoices, and screening by invoice volume (e.g., deleting electronic invoices corresponding to invoicing units with an invoice volume of less than 500).

[0084] Step S2 specifically involves:

[0085] Extract the item percentage vector from each of the preprocessed electronic invoices:

[0086] w i =α·c i +(1-α)·a i ;

[0087] Among them, w i The vector represents the proportion of the i-th item; α represents the frequency proportion weight, with a value range of [0, 1]; c i This represents the frequency percentage of the i-th item within the corresponding invoicing unit; (1-α) represents the weight of the amount percentage; a i This represents the percentage of the amount for the i-th item in the corresponding invoicing unit;

[0088] Invoicing entities exhibit significant sector preferences in their actual business operations. For example, medical institutions often involve "Western medicine fees," "registration fees," and "traditional Chinese medicine fees," while educational institutions focus on "tuition fees," "accommodation fees," and "textbook fees." Some invoicing entities may occasionally engage in "cross-industry" invoicing due to special policies or cash flow issues (such as schools issuing a small number of medical items).

[0089] Therefore, simply judging a unit type based on the presence or absence of a certain project may be inaccurate. To address this, we perform deduplication and frequency analysis on all invoicing items for each invoicing unit, calculating the project ratio of each type of project within its total projects. However, project frequency does not fully reflect the actual business intensity. For example, an invoicing unit may frequently issue "water and electricity fees" but with low amounts; this does not necessarily indicate that its main business is related to water and electricity. Therefore, we introduce the project amount ratio, which is the proportion of a particular project's amount within the invoicing unit's total invoicing amount, to measure its "business volume weight." This process ensures that "subjective tendencies" rather than "occasional behaviors" are captured during feature extraction.

[0090] The project semantic vector v is extracted from each of the pre-processed electronic invoices using a pre-trained Qwen3-Embedding-0.6B model. i ;

[0091] To convert unstructured project names into a computable vector form, the Qwen3-Embedding-0.6B model is used to embed each individual project name, extracting a high-dimensional project semantic vector v. i ,like:

[0092] Western medicine cost → [0.2, 0.6...], water and electricity cost → [0.05, -0.1...];

[0093] The Qwen3-Embedding-0.6B model is trained on a large-scale Chinese corpus and can capture the semantic relevance of item names, making the vectors of "registration fee" and "outpatient fee" similar, while being significantly different from "rent fee" or "transportation fee".

[0094] The weighted fusion of the respective item proportion vectors and item semantic vectors yields the fusion vector for the corresponding electronic invoice:

[0095] A = ∑ i w i ·v i ;

[0096] Where A represents the fusion vector.

[0097] Step S3 specifically involves:

[0098] The dimensionality of each fusion vector is reduced by the UMAP algorithm to obtain a 50-dimensional low-dimensional vector. The low-dimensional vectors are then clustered by the HDBSCAN algorithm to generate corresponding cluster labels[i] for each low-dimensional vector and to construct several clusters based on the cluster labels.

[0099] When labels[i]≥0, it means that the i-th invoice unit is assigned to the cluster numbered labels[i]; when labels[i]=-1, it means that the i-th invoice unit is not assigned to any cluster.

[0100] Since the original fused vectors are typically high-dimensional (e.g., 768-dimensional), direct use for clustering is inefficient, computationally expensive, and susceptible to the curse of dimensionality. Therefore, the UMAP (Uniform Manifold Approximation and Projection) algorithm is used to reduce the dimensionality of the fused vectors. UMAP is an advanced nonlinear dimensionality reduction algorithm that can compress the global space while preserving local structure; by reducing the fused vectors to 50 dimensions, it balances clustering efficiency with semantic expressiveness.

[0101] HDBSCAN (Hierarchical Density-Based Spatial Clustering of Applications with Noise) is a hierarchical density-based clustering algorithm with the following advantages: 1. It can automatically determine the number of clusters; 2. It can handle cluster structures of different densities; 3. It can identify "outliers" that cannot be assigned to any cluster based on semantic features. The outliers identified by HDBSCAN are structural outliers at the global level, i.e., units with insufficient density in the entire clustering semantic space.

[0102] Key parameters set for the HDBSCAN algorithm include: 1. Minimum cluster size (min_cluster_size) is set to 50 to avoid excessive fragmentation; 2. The distance metric is set to "cosine distance", which is more suitable for high-dimensional semantic spaces; 3. Minimum number of samples (min_samples) is optimized based on clustering stability.

[0103] Step S4 specifically involves:

[0104] The names of the issuing units are extracted from the electronic invoices of each cluster. After preprocessing the names of the issuing units by word segmentation and removal of stop words, keywords are extracted by TF-IDF (Term Frequency-Inverse Document Frequency) algorithm (i.e., high-weight keywords are extracted from the unit names to reflect the common semantic features of the unit names of this type. To ensure representativeness, the top K keywords with the highest TF-IDF weights in each category are selected, for example, K=5). The keywords are then used to match directional tags from a preset domain-oriented dictionary, and the clusters are merged based on the directional tags.

[0105] Considering that some keywords have clear industry or institution-specific semantics, for example, "hospital," "health center," and "outpatient department" usually point to the "hospital" category; "school," "college," and "university" usually point to the "school" category; and "people's government," "provincial government," and "municipal government" usually point to the "government" category, a domain-specific dictionary is introduced to assist in determining the cluster labels in order to improve the accuracy and semantic uniformity of cluster labels.

[0106] The process of building a domain-oriented dictionary is as follows:

[0107] First, all names of invoice-issuing entities with real invoice records within the past three years are extracted from historical data. The Qwen3-Embedding-0.6B model is used to vectorize the names of invoice-issuing entities. Then, based on the semantic similarity between the names of invoice-issuing entities, the HDBSCAN algorithm is used to perform unsupervised clustering on their vectors, and outlier samples with labels=-1 in the clustering results are removed.

[0108] For each valid cluster, several representative keywords (such as the top K keywords ranked by TF-IDF) are extracted. Then, by calculating the semantic cosine similarity between keywords, keywords with similarity higher than a preset threshold (e.g., 0.7) are used to construct a semantic similarity network. Next, through connected subgraph partitioning (AB similarity > 0.7, BC similarity > 0.7, AC similarity > 0.7, then ABC are grouped together), related keywords are automatically grouped together, thus achieving semantic merging among keywords. For each group of semantically related keywords, a large language model is further invoked for induction and abstraction, extracting its upper-level general category labels, ultimately forming a structured "domain-oriented dictionary," the structure of which is shown below: {

[0109] "Hospital":["Hospital","Traditional Chinese Medicine Hospital","Health Center","Outpatient Department"],

[0110] "school":["school","college","university","middle school"], ......

[0112] }

[0113] In the process of generating cluster labels based on project vector clustering, the keywords extracted from each cluster are matched with the domain-oriented dictionary: if the domain-oriented dictionary is matched and has a clear industry orientation, the corresponding upper-level class name (orientation label) is used as the cluster label first; if no match is found, the keyword with the highest TF-IDF weight is selected as the label and the new category is maintained in the domain-oriented dictionary.

[0114] Since there may be clusters with different initial labels (labels[i](1,2,3,4...) but the same category (such as "1: Hospital", "2: Hospital", "3: School"), the clusters are merged based on the directional labels.

[0115] Examples of invoicing entities, items, and categories are as follows:

[0116]

[0117] Step S5 specifically involves:

[0118] The average value of the low-dimensional vectors of each cluster is taken as the category center vector. The cosine similarity between each low-dimensional vector and the category center vector is calculated. Based on the cosine similarity, the first abnormal invoice is identified from each cluster.

[0119] Considering that some invoicing entities, although grouped into a cluster by the clustering algorithm, may have significantly different semantic features from the cluster as a whole—for example, a "XX Primary School" might be mistakenly clustered into the "Hospital" category, or a "Street Office" might be mistakenly classified into the "School" category—an intra-cluster semantic consistency judgment mechanism is introduced to identify these locally semantically misaligned invoicing entities. In practice, it also supports semantic similarity judgment based on the invoicing entity name and category label using a large language model. A prompt message is constructed: "You are an experienced entity category determination assistant. Please determine whether entity A belongs to category B. A direct yes or no response is provided without further explanation." This further improves the accuracy of semantic judgment. An example of an abnormal entity is a health center classified under a town government department, whose invoicing items are completely different from those of similar hospitals.

[0120] Electronic invoices issued by units that do not belong to any of the aforementioned clusters will be classified as second abnormal invoices.

[0121] Output the invoice anomaly detection results based on each of the first and second abnormal invoices.

[0122] A preferred embodiment of the invoice anomaly detection system based on vector weighting and density clustering of the present invention includes the following modules:

[0123] The electronic invoice preprocessing module is used to obtain electronic invoices to be tested on an annual basis and to preprocess each of the electronic invoices.

[0124] The fusion vector generation module is used to extract the item proportion vector and the item semantic vector from each of the preprocessed electronic invoices, and to perform weighted fusion on each of the item proportion vectors and the item semantic vectors to obtain the fusion vector of the corresponding electronic invoice.

[0125] In large-scale invoicing data, different types of invoicing units often have stable and distinguishable invoicing behavior patterns. In order to accurately capture the semantic features of each invoicing unit and provide structured input for subsequent clustering and anomaly detection, a fusion vector is constructed. The core process includes project proportion modeling, semantic vector extraction, weighted synthesis and nonlinear dimensionality reduction.

[0126] The vector dimensionality reduction and clustering module is used to reduce the dimensionality of each fused vector using the UMAP algorithm to obtain low-dimensional vectors, and to cluster each low-dimensional vector using the HDBSCAN algorithm to generate corresponding cluster labels for each low-dimensional vector, and to construct several clusters based on each cluster label.

[0127] The cluster merging module is used to extract the invoicing unit name from the electronic invoices of each cluster, extract keywords from the invoicing unit name, match directional tags from a preset domain-oriented dictionary using the keywords, and merge each cluster based on the directional tags.

[0128] The detection result output module is used to identify first abnormal invoices from each of the clusters based on cosine similarity, identify electronic invoices that do not belong to each of the clusters as second abnormal invoices, and output invoice anomaly detection results based on each of the first abnormal invoices and the second abnormal invoices.

[0129] The electronic invoice preprocessing module is specifically used for:

[0130] The electronic invoices to be tested are obtained on an annual basis. Each electronic invoice undergoes preprocessing, including at least the removal of invalid characters, deletion of test item invoices, deletion of red-ink invoices, and screening by invoice volume (e.g., deleting electronic invoices corresponding to invoicing units with an invoice volume of less than 500).

[0131] The fusion vector generation module is specifically used for:

[0132] Extract the item percentage vector from each of the preprocessed electronic invoices:

[0133] w i =α·c i +(1-α)·a i ;

[0134] Among them, w i The vector represents the proportion of the i-th item; α represents the frequency proportion weight, with a value range of [0, 1]; c i This represents the frequency percentage of the i-th item within the corresponding invoicing unit; (1-α) represents the weight of the amount percentage; a i This represents the percentage of the amount for the i-th item in the corresponding invoicing unit;

[0135] Invoicing entities exhibit significant sector preferences in their actual business operations. For example, medical institutions often involve "Western medicine fees," "registration fees," and "traditional Chinese medicine fees," while educational institutions focus on "tuition fees," "accommodation fees," and "textbook fees." Some invoicing entities may occasionally engage in "cross-industry" invoicing due to special policies or cash flow issues (such as schools issuing a small number of medical items).

[0136] Therefore, simply judging a unit type based on the presence or absence of a certain project may be inaccurate. To address this, we perform deduplication and frequency analysis on all invoicing items for each invoicing unit, calculating the project ratio of each type of project within its total projects. However, project frequency does not fully reflect the actual business intensity. For example, an invoicing unit may frequently issue "water and electricity fees" but with low amounts; this does not necessarily indicate that its main business is related to water and electricity. Therefore, we introduce the project amount ratio, which is the proportion of a particular project's amount within the invoicing unit's total invoicing amount, to measure its "business volume weight." This process ensures that "subjective tendencies" rather than "occasional behaviors" are captured during feature extraction.

[0137] The project semantic vector v is extracted from each of the pre-processed electronic invoices using a pre-trained Qwen3-Embedding-0.6B model. i ;

[0138] To convert unstructured project names into a computable vector form, the Qwen3-Embedding-0.6B model is used to embed each individual project name, extracting a high-dimensional project semantic vector v. i ,like:

[0139] Western medicine cost → [0.2, 0.6...], water and electricity cost → [0.05, -0.1...];

[0140] The Qwen3-Embedding-0.6B model is trained on a large-scale Chinese corpus and can capture the semantic relevance of item names, making the vectors of "registration fee" and "outpatient fee" similar, while being significantly different from "rent fee" or "transportation fee".

[0141] The weighted fusion of the respective item proportion vectors and item semantic vectors yields the fusion vector for the corresponding electronic invoice:

[0142] A = Σ i w i ·v i ;

[0143] Where A represents the fusion vector.

[0144] The vector dimension reduction clustering module is specifically used for:

[0145] The dimensionality of each fusion vector is reduced by the UMAP algorithm to obtain a 50-dimensional low-dimensional vector. The low-dimensional vectors are then clustered by the HDBSCAN algorithm to generate corresponding cluster labels[i] for each low-dimensional vector and to construct several clusters based on the cluster labels.

[0146] When labels[i]≥0, it means that the i-th invoice unit is assigned to the cluster numbered labels[i]; when labels[i]=-1, it means that the i-th invoice unit is not assigned to any cluster.

[0147] Since the original fused vectors are typically high-dimensional (e.g., 768-dimensional), direct use for clustering is inefficient, computationally expensive, and susceptible to the curse of dimensionality. Therefore, the UMAP (Uniform Manifold Approximation and Projection) algorithm is used to reduce the dimensionality of the fused vectors. UMAP is an advanced nonlinear dimensionality reduction algorithm that can compress the global space while preserving local structure; by reducing the fused vectors to 50 dimensions, it balances clustering efficiency with semantic expressiveness.

[0148] HDBSCAN (Hierarchical Density-Based Spatial Clustering of Applications with Noise) is a hierarchical density-based clustering algorithm with the following advantages: 1. It can automatically determine the number of clusters; 2. It can handle cluster structures of different densities; 3. It can identify "outliers" that cannot be assigned to any cluster based on semantic features. The outliers identified by HDBSCAN are structural outliers at the global level, i.e., units with insufficient density in the entire clustering semantic space.

[0149] Key parameters set for the HDBSCAN algorithm include: 1. Minimum cluster size (min_cluster_size) is set to 50 to avoid excessive fragmentation; 2. The distance metric is set to "cosine distance", which is more suitable for high-dimensional semantic spaces; 3. Minimum number of samples (min_samples) is optimized based on clustering stability.

[0150] The cluster merging module is specifically used for:

[0151] The names of the issuing units are extracted from the electronic invoices of each cluster. After preprocessing the names of the issuing units by word segmentation and removal of stop words, keywords are extracted by TF-IDF (Term Frequency-Inverse Document Frequency) algorithm (i.e., high-weight keywords are extracted from the unit names to reflect the common semantic features of the unit names of this type. To ensure representativeness, the top K keywords with the highest TF-IDF weights in each category are selected, for example, K=5). The keywords are then used to match directional tags from a preset domain-oriented dictionary, and the clusters are merged based on the directional tags.

[0152] Considering that some keywords have clear industry or institution-specific semantics, for example, "hospital," "health center," and "outpatient department" usually point to the "hospital" category; "school," "college," and "university" usually point to the "school" category; and "people's government," "provincial government," and "municipal government" usually point to the "government" category, a domain-specific dictionary is introduced to assist in determining the cluster labels in order to improve the accuracy and semantic uniformity of cluster labels.

[0153] The process of building a domain-oriented dictionary is as follows:

[0154] First, all names of invoice-issuing entities with real invoice records within the past three years are extracted from historical data. The Qwen3-Embedding-0.6B model is used to vectorize the names of invoice-issuing entities. Then, based on the semantic similarity between the names of invoice-issuing entities, the HDBSCAN algorithm is used to perform unsupervised clustering on their vectors, and outlier samples with labels=-1 in the clustering results are removed.

[0155] For each valid cluster, several representative keywords (such as the top K keywords ranked by TF-IDF) are extracted. Then, by calculating the semantic cosine similarity between keywords, keywords with similarity higher than a preset threshold (e.g., 0.7) are used to construct a semantic similarity network. Next, through connected subgraph partitioning (AB similarity > 0.7, BC similarity > 0.7, AC similarity > 0.7, then ABC are grouped together), related keywords are automatically grouped together, thus achieving semantic merging among keywords. For each group of semantically related keywords, a large language model is further invoked for induction and abstraction, extracting its upper-level general category labels, ultimately forming a structured "domain-oriented dictionary," the structure of which is shown below: {

[0156] "Hospital":["Hospital","Traditional Chinese Medicine Hospital","Health Center","Outpatient Department"],

[0157] "school":["school","college","university","middle school"], ......

[0159] }

[0160] In the process of generating cluster labels based on project vector clustering, the keywords extracted from each cluster are matched with the domain-oriented dictionary: if the domain-oriented dictionary is matched and has a clear industry orientation, the corresponding upper-level class name (orientation label) is used as the cluster label first; if no match is found, the keyword with the highest TF-IDF weight is selected as the label and the new category is maintained in the domain-oriented dictionary.

[0161] Since there may be clusters with different initial labels (labels[i](1,2,3,4...) but the same category (such as "1: Hospital", "2: Hospital", "3: School"), the clusters are merged based on the directional labels.

[0162] Examples of invoicing entities, items, and categories are as follows:

[0163]

[0164] The detection result output module is specifically used for:

[0165] The average value of the low-dimensional vectors of each cluster is taken as the category center vector. The cosine similarity between each low-dimensional vector and the category center vector is calculated. Based on the cosine similarity, the first abnormal invoice is identified from each cluster.

[0166] Considering that some invoicing entities, although grouped into a cluster by the clustering algorithm, may have significantly different semantic features from the cluster as a whole—for example, a "XX Primary School" might be mistakenly clustered into the "Hospital" category, or a "Street Office" might be mistakenly classified into the "School" category—an intra-cluster semantic consistency judgment mechanism is introduced to identify these locally semantically misaligned invoicing entities. In practice, it also supports semantic similarity judgment based on the invoicing entity name and category label using a large language model. A prompt message is constructed: "You are an experienced entity category determination assistant. Please determine whether entity A belongs to category B. A direct yes or no response is provided without further explanation." This further improves the accuracy of semantic judgment. An example of an abnormal entity is a health center classified under a town government department, whose invoicing items are completely different from those of similar hospitals.

[0167] Electronic invoices issued by units that do not belong to any of the aforementioned clusters will be classified as second abnormal invoices.

[0168] Output the invoice anomaly detection results based on each of the first and second abnormal invoices.

[0169] In summary, the advantages of this invention are:

[0170] 1. The process involves acquiring and preprocessing the electronic invoices to be detected. Item proportion vectors and semantic vectors are extracted from each preprocessed electronic invoice. These vectors are then weighted and fused to obtain a fused vector for each electronic invoice. Next, the dimensionality of each fused vector is reduced using the UMAP algorithm to obtain low-dimensional vectors. The HDBSCAN algorithm is then used to cluster these low-dimensional vectors, generating corresponding cluster labels for each vector. Several clusters are constructed based on these labels. The issuing unit name is extracted from the electronic invoices within each cluster, and keywords are extracted from these names. These keywords are then matched with directional tags from a pre-defined domain-oriented dictionary. The clusters are then merged based on these directional tags. Finally, cosine similarity is used to identify first-abnormal invoices from each cluster, and electronic invoices not belonging to any cluster are identified as second-abnormal invoices. The process is then further refined based on the first and second-abnormal invoices. The system outputs invoice anomaly detection results. It extracts the item proportion vector (quantitative feature) and item semantic vector (textual feature) from electronic invoices, weighted and fused to form a fusion vector comprehensively representing the invoice characteristics. UMAP dimensionality reduction combined with HDBSCAN density clustering is then used to obtain clusters. These clusters are then semantically merged using a domain-oriented dictionary. Finally, two types of anomalies in electronic invoices are identified based on intra-cluster similarity (cosine similarity) and outliers, thus replacing manual rules with a data-driven approach. Specifically, it objectively captures complex invoicing patterns through fusion vectors, improving accuracy (identifying hidden behavioral shifts and semantic anomalies); efficiently processes massive amounts of data through dimensionality reduction and density clustering, improving efficiency; and adapts to different industry characteristics through an unsupervised clustering framework and an extensible domain-oriented dictionary. Application scenarios can be expanded simply by updating the domain-oriented dictionary, significantly improving adaptability. Ultimately, this greatly improves the accuracy, efficiency, and adaptability of invoice anomaly detection.

[0171] 2. By using feature fusion (weighted integration of project percentage vector and project semantic vector), invoice information is captured from multiple dimensions: the project percentage vector, based on frequency and amount percentages, reflects the distribution of financial data; the project semantic vector uses a pre-trained Qwen3-Embedding-0.6B model to extract textual semantic features (such as name or description). This weighted fusion enhances feature expressiveness, avoids bias from single features, and thus improves the accuracy of anomaly detection; by using the HDBSCAN algorithm for density clustering, noise and clusters of different densities can be automatically handled. Combined with UMAP dimensionality reduction, the "curse of dimensionality" problem of high-dimensional data is reduced, ensuring that the model can still stably identify anomalies in complex data (such as variations in invoice amount and semantics), and has stronger robustness (more tolerant to input noise or missing data).

[0172] 3. UMAP dimensionality reduction compresses high-dimensional fused vectors to low-dimensional (50-dimensional), significantly reducing computational complexity and memory overhead. UMAP is particularly suitable for processing sparse or unstructured data (such as invoice text), converges faster than traditional dimensionality reduction methods (such as PCA), and optimizes subsequent clustering steps. Combined with HDBSCAN clustering, its density-based characteristics can efficiently process large-scale datasets (invoices obtained on an annual basis), reducing the need for manual parameter adjustment and improving overall detection speed. Based on TF-IDF, keywords are extracted and matched with domain-oriented dictionaries for clustering and merging. Then, cosine similarity is used to quickly identify anomalies (calculating the similarity between low-dimensional vectors and category center vectors), reducing the reliance on manual review. It is easy to integrate into enterprise financial systems and supports expansion to other fields (such as financial risk control or supply chain management).

[0173] 4. By classifying anomalies into two categories: first-class anomalous invoices (identified within clusters based on cosine similarity) capture subtle anomalies (such as anomalous invoice amounts), while second-class anomalous invoices (invoicing units not belonging to any cluster) detect overall outliers (such as fraudulent units), this hierarchical approach covers a more comprehensive range of anomaly scenarios and improves the interpretability of the results; by incorporating domain knowledge (such as merging clusters of similar industries) through cluster merging (based on keyword-oriented labels), the output becomes more business-meaningful and easier for users to understand audit risks (such as identifying the proportion of fraudulent invoices).

[0174] 5. Preprocessing (removal of invalid characters, deletion of test item invoices, and deletion of red-ink invoices) ensures clean input data, reduces noise interference, and avoids false alarms (such as incorrect detection caused by test data). Invoice volume screening further filters low-value electronic invoices, improving reliability.

[0175] 6. The invoice anomaly detection method based on vector weighting and density clustering significantly improves the accuracy, robustness, and efficiency of invoice anomaly detection. It captures multi-dimensional financial features by weighted fusion of project proportion vectors and semantic vectors. It combines UMAP dimensionality reduction and HDBSCAN density clustering to automatically process noise and identify different density clusters, optimizing the ability to identify subtle and overall anomalies (such as hierarchical first and second abnormal invoices). At the same time, it relies on preprocessing steps (such as invalid data cleaning and invoice volume screening) to improve input quality, and uses domain-oriented dictionaries and keyword matching to enhance business interpretability and practicality. Overall, it shows the advantages of high adaptability, low computational overhead, and comprehensive risk coverage.

[0176] 7. By adopting the unsupervised density clustering method (HDBSCAN), the invoicing units are automatically clustered and classified without relying on industry labels. By introducing project word vector modeling and weighted fusion mechanism, the behavioral characteristics of the invoicing units are accurately characterized, overcoming the subjectivity and limitations of traditional classification methods based on manual rules or static templates, and significantly improving the accuracy of classification and the level of system intelligence.

[0177] 8. By comprehensively utilizing clustering structure and semantic information of unit names, a multi-dimensional anomaly identification mechanism is designed: on the one hand, outlier behavior is identified through "outliers" in HDBSCAN clustering; on the other hand, classification deviation is judged by combining the semantic similarity between unit name vectors and cluster category labels. This can effectively identify abnormal changes, category mismatches or potential violations in the invoice issuance mode of the invoice issuing unit, thereby improving the intelligent capabilities of tax audit and risk monitoring.

[0178] 9. Compared with traditional algorithms such as BIRCH, the HDBSCAN algorithm has the advantages of good adaptability to different density cluster structures and no need to preset the number of clusters, and it exhibits stronger robustness in high-dimensional spaces. By combining vector dimensionality reduction and clustering optimization strategies, it can efficiently process large-scale and diverse electronic invoices and has good scalability and resource control capabilities.

[0179] 10. By adopting a self-learning vector modeling and clustering adaptive mechanism, there is no need to manually preset classification rules or manually maintain industry dictionaries, which greatly reduces deployment and long-term maintenance costs. At the same time, it has good versatility and portability, can be flexibly expanded according to regional and industry characteristics, supports integration between multiple business systems, and is suitable for promotion and application in various invoicing supervision scenarios such as government affairs, education, and medical care.

[0180] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. An invoice anomaly detection method based on vector weighting and density clustering, characterized in that: Includes the following steps: Step S1: Obtain the electronic invoices to be tested on an annual basis, and preprocess each of the electronic invoices; Step S2: Extract the item proportion vector and item semantic vector from each of the preprocessed electronic invoices, and perform weighted fusion on each of the item proportion vectors and item semantic vectors to obtain the fusion vector of the corresponding electronic invoice; Step S3: Reduce the dimensionality of each fused vector using the UMAP algorithm to obtain a low-dimensional vector, cluster each low-dimensional vector using the HDBSCAN algorithm to generate a corresponding cluster label for each low-dimensional vector, and construct several clusters based on each cluster label. Step S4: Extract the name of the issuing unit from the electronic invoices of each cluster, extract keywords from the name of the issuing unit, match directional tags from a preset domain-oriented dictionary using the keywords, and merge each cluster based on the directional tags. Step S5: Identify the first abnormal invoice from each cluster based on cosine similarity, and identify the electronic invoices that do not belong to each cluster as the second abnormal invoices. Output the invoice anomaly detection result based on each of the first abnormal invoices and the second abnormal invoices. Step S2 specifically involves: Extract the item percentage vector from each of the preprocessed electronic invoices: ; in, This represents the project percentage vector for the i-th project; Indicates the frequency percentage weight; This represents the frequency percentage of the i-th item within the corresponding invoicing unit; Indicates the weight of the amount; This represents the percentage of the amount for the i-th item in the corresponding invoicing unit; The project semantic vectors are extracted from each of the pre-processed electronic invoices using a pre-trained Qwen3-Embedding-0.6B model. ; The weighted fusion of the respective item proportion vectors and item semantic vectors yields the fusion vector for the corresponding electronic invoice: ; in, This represents the fusion vector.

2. The invoice anomaly detection method based on vector weighting and density clustering as described in claim 1, characterized in that: Step S1 specifically involves: The electronic invoices to be tested are obtained on an annual basis. Each electronic invoice undergoes preprocessing, including at least invalid character removal, deletion of test item invoices, deletion of red-ink invoices, and screening of invoice volume.

3. The invoice anomaly detection method based on vector weighting and density clustering as described in claim 1, characterized in that: Step S3 specifically involves: The dimensionality of each fusion vector is reduced by the UMAP algorithm to obtain a 50-dimensional low-dimensional vector. The low-dimensional vectors are then clustered by the HDBSCAN algorithm to generate corresponding cluster labels[j] for each low-dimensional vector and to construct several clusters based on the cluster labels. When labels[j]≥0, it means that the j-th invoicing unit is assigned to the cluster numbered labels[j]; when labels[j]=-1, it means that the j-th invoicing unit is not assigned to any cluster.

4. The invoice anomaly detection method based on vector weighting and density clustering as described in claim 1, characterized in that: Step S4 specifically involves: The names of the issuing units are extracted from the electronic invoices of each cluster. After preprocessing the names of the issuing units by word segmentation and removal of stop words, keywords are extracted by TF-IDF algorithm. The keywords are then used to match directional tags from a preset domain-oriented dictionary. Based on the directional tags, the clusters are merged. Step S5 specifically involves: The average value of the low-dimensional vectors of each cluster is taken as the category center vector. The cosine similarity between each low-dimensional vector and the category center vector is calculated. Based on the cosine similarity, the first abnormal invoice is identified from each cluster. Electronic invoices that do not belong to the invoicing units of the aforementioned clusters will be classified as second abnormal invoices. Output the invoice anomaly detection results based on each of the first and second abnormal invoices.

5. An invoice anomaly detection system based on vector weighting and density clustering, characterized in that: Includes the following modules: The electronic invoice preprocessing module is used to obtain electronic invoices to be tested on an annual basis and to preprocess each of the electronic invoices. The fusion vector generation module is used to extract the item proportion vector and the item semantic vector from each of the preprocessed electronic invoices, and to perform weighted fusion on each of the item proportion vectors and the item semantic vectors to obtain the fusion vector of the corresponding electronic invoice. The vector dimensionality reduction and clustering module is used to reduce the dimensionality of each fused vector using the UMAP algorithm to obtain low-dimensional vectors, and to cluster each low-dimensional vector using the HDBSCAN algorithm to generate corresponding cluster labels for each low-dimensional vector, and to construct several clusters based on each cluster label. The cluster merging module is used to extract the invoicing unit name from the electronic invoices of each cluster, extract keywords from the invoicing unit name, match directional tags from a preset domain-oriented dictionary using the keywords, and merge each cluster based on the directional tags. The detection result output module is used to identify the first abnormal invoice from each of the clusters based on cosine similarity, identify electronic invoices that do not belong to each of the clusters as the second abnormal invoices, and output the invoice anomaly detection result based on each of the first abnormal invoices and the second abnormal invoices. The fusion vector generation module is specifically used for: Extract the item percentage vector from each of the preprocessed electronic invoices: ; in, This represents the project percentage vector for the i-th project; Indicates the frequency percentage weight; This represents the frequency percentage of the i-th item within the corresponding invoicing unit; Indicates the weight of the amount; This represents the percentage of the amount for the i-th item in the corresponding invoicing unit; The project semantic vectors are extracted from each of the pre-processed electronic invoices using a pre-trained Qwen3-Embedding-0.6B model. ; The weighted fusion of the respective item proportion vectors and item semantic vectors yields the fusion vector for the corresponding electronic invoice: ; in, This represents the fusion vector.

6. The invoice anomaly detection system based on vector weighting and density clustering as described in claim 5, characterized in that: The electronic invoice preprocessing module is specifically used for: The electronic invoices to be tested are obtained on an annual basis. Each electronic invoice undergoes preprocessing, including at least invalid character removal, deletion of test item invoices, deletion of red-ink invoices, and screening of invoice volume.

7. The invoice anomaly detection system based on vector weighting and density clustering as described in claim 5, characterized in that: The vector dimension reduction clustering module is specifically used for: The dimensionality of each fusion vector is reduced by the UMAP algorithm to obtain a 50-dimensional low-dimensional vector. The low-dimensional vectors are then clustered by the HDBSCAN algorithm to generate corresponding cluster labels[j] for each low-dimensional vector and to construct several clusters based on the cluster labels. When labels[j]≥0, it means that the j-th invoicing unit is assigned to the cluster numbered labels[j]; when labels[j]=-1, it means that the j-th invoicing unit is not assigned to any cluster.

8. The invoice anomaly detection system based on vector weighting and density clustering as described in claim 5, characterized in that: The cluster merging module is specifically used for: The names of the issuing units are extracted from the electronic invoices of each cluster. After preprocessing the names of the issuing units by word segmentation and removal of stop words, keywords are extracted by TF-IDF algorithm. The keywords are then used to match directional tags from a preset domain-oriented dictionary. Based on the directional tags, the clusters are merged. The detection result output module is specifically used for: The average value of the low-dimensional vectors of each cluster is taken as the category center vector. The cosine similarity between each low-dimensional vector and the category center vector is calculated. Based on the cosine similarity, the first abnormal invoice is identified from each cluster. Electronic invoices that do not belong to the invoicing units of the aforementioned clusters will be classified as second abnormal invoices. Output the invoice anomaly detection results based on each of the first and second abnormal invoices.