What the Data for This Category Looks Like
Core data for code security auditing comes from source code repositories, dependency lists, static application security testing (SAST) tool outputs, and public vulnerability databases. Daily produced documents include code audit reports, vulnerability certification documents, repair recommendation documents, and retest records. Data update frequency follows project version iterations or individual audit task progress, with one independent dataset per project or version. Documents are primarily structured text, containing fields such as function names, vulnerability IDs, code snippets, attack path descriptions, and lack a unified fixed format template.
What Constraints These Characteristics Impose on Knowledge Base Retrieval and Recall
Data sources for code security auditing are scattered and have varying formats. This requires the retrieval system to support both structured field matching and unstructured semantic matching. Data updates occur at a high frequency, so real-time index updates must be ensured to avoid retrieving expired vulnerability information or outdated repair solutions. Documents include long text code snippets and professional technical descriptions. Overly long single entries will consume large model context quotas, so the number of single retrieval results must be strictly controlled. Additionally, retrieval results for this category are directly linked to high-risk vulnerability troubleshooting and repair. The accuracy of retrieved results directly impacts business security, so irrelevant results must be strictly filtered.
How to Set Configurations
| Configuration Item | Recommended Setting | Rationale |
|---|---|---|
similarity | 0.75–0.85 | Semantic matching accuracy requirements for code security related content are relatively high; this range can filter low-relevance non-target documents |
limit | Top 8–12 entries | Code audit documents often contain long text code snippets; too many retrieved results will exceed the large model context quota and affect subsequent generation effects |
usingReRank | Enabled | Can perform secondary ranking on initial retrieval results, filter irrelevant code snippets or vulnerability entries, and improve result relevance |
searchMode | Hybrid retrieval | Matches both keywords and semantics, enabling accurate retrieval of documents containing specific vulnerability IDs or dangerous function names |
datasetSearchUsingExtensionQuery | Enabled | Supplements retrieval associated with code context, covering cross-document attack path related information |
Three Common Misconfigurations
- Phenomenon: Knowledge base retrieval takes more than 10 seconds, especially noticeable when using Tesla V100-SXM2-32GB devices. Cause: The
limitparameter was not adjusted, and too many long text code snippets were retrieved, increasing embedding computation time. - Phenomenon: After importing non-code text such as phone numbers, semantic and full-text retrieval cannot match target content, and a large number of irrelevant results are returned. Cause: A reasonable
similaritythreshold was not set, or the threshold was set too low, resulting in retrieval of a large number of irrelevant non-code documents. - Phenomenon: No valid feedback is seen during online retrieval testing after enabling
usingReRank. Cause: The re-ranking configuration was not enabled synchronously during the knowledge base index phase, or the re-ranking model was not bound to the current dataset.
How to Confirm Configurations Are Applied
- Access the knowledge base management page of FastGPT v4.17.0, check the retrieval configuration items for the corresponding dataset, and confirm that the settings for
similarity,limit, andusingReRankmatch the expected configuration. - Upload a single code audit report snippet, perform a retrieval test, and verify that the returned results include matching vulnerability certification or repair recommendation content.
- Adjust the
limitparameter to a smaller value, observe changes in retrieval latency, and confirm that the parameter configuration has taken effect. - Compare retrieval results with and without
usingReRankenabled, and verify the re-ranking function's ability to filter irrelevant results.
The values provided are common starting points and should be validated against samples used in actual deployment scenarios.
Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-10-19.