Small language model-augmented synthesis for application programming interface threat detection

arXiv:2405.11258 · cs.CR · Submitted 2024-05-18 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: Security Radio. Generated commentary on the latest security and cryptography papers.

Nadia: We're looking at the paper: "Small language model-augmented synthesis for application programming interface threat detection".

Paper summary: Nadia: So to wrap up this paper, "Small language model-augmented synthesis for application programming interface threat detection," they successfully synthesized semantically meaningful API requests that keep the structural integrity of the requests while still introducing useful variability.

Elias: That variability is key because it allows the downstream anomaly detection module to learn more robust patterns from a smaller initial dataset. They did this by building a RoBERTa-based architecture to generate these samples, which are then used to train an anomaly detector on the extended set.

Priya: What does that mean in plain terms for someone listening? It means you can take those limited API samples and use AI to create slightly different versions of them that still look like real API calls but might represent different ways a threat could manifest, making your detection system tougher.

Nadia: Right, so the implication is that this technique provides a practical way to augment security datasets when large amounts of labeled data are unavailable or too hard to get. It shows how leveraging models like RoBERTa for synthesis can directly improve security performance on real traffic data.

Elias: The authors also noted that they found their custom model generated high-quality augmentations more efficiently than the larger RoBERTa Base model, even though they were trained on significantly smaller, domain-specific datasets.

Priya: That efficiency is a practical win because generating data can be computationally expensive. If you can do it faster with a smaller model, that makes the whole process more feasible for many teams.

Nadia: And while they showed strong performance gains, they also highlighted that improving coverage for less common attack patterns and balancing attack categories are things they need to work on in future research. That’s the honest assessment of the current state of this specific approach.

Conclusion: Nadia: So this paper is about using a smaller language model to help create synthetic API requests so we can better find threats in real web traffic datasets, right?

Elias: Yeah, it's titled "Small language model-augmented synthesis for application programming interface threat detection," and the authors are Udi Aharon and his team.

Priya: It’s interesting that they focus on making the requests semantically meaningful while keeping their structure intact.

Nadia: Exactly. They used RoBERTa to generate these synthetic samples, which then help train an anomaly detection module on a smaller set of real data.

Elias: And the big numbers they showed are pretty solid—a four point ninety-four percent increase on one dataset and over twenty point one percent on another.

Priya: But we have to look closely at what those numbers actually mean for the real world, especially regarding false alarms.

Nadia: That’s right, the results show that this augmentation mainly helps a classifier reduce false positives rather than just making it more sensitive overall on some datasets.

Elias: The authors did mention they found their custom model generated these high-quality samples quite efficiently compared to using the full RoBERTa Base model.

Priya: Efficiency is important because generating data takes time, so being able to do it faster with a smaller model makes the whole process more practical for security teams.

Nadia: True. The authors also flagged some areas they still need to improve, like making sure they cover more diverse attack patterns and balancing different types of threats during training.

Elias: Yeah, they pointed out that while the approach is stable across different settings when you tweak the confidence level, there’s definitely room for more coverage in their next steps.

Priya: So what this means for us right now is that we can use this technique to boost our detection performance without needing massive amounts of perfectly labeled data upfront.

Nadia: It suggests a way to get better results by augmenting the training data intelligently, not just by throwing more raw traffic at a model and hoping for the best.

Elias: And it shows that even smaller, task-specific language models can be very effective when they are fine-tuned for security semantics.

Priya: We'll need to keep an eye on how they handle those class imbalances in their next iteration, because that’s where a lot of real-world problems live.

Department of Computer and Software Engineering, Ariel University · Department of Industrial Engineering & Management, Ariel University · Ariel Cyber Innovation Center, Ariel University · Data Science and Artificial Intelligence Research Center, Ariel University

cs.CR

Submitted: 2024-05-18

Updated: 2026-12-01

Comments: 21 pages, 4 figures, 18 tables

Journal ref: Udi Aharon, Revital Marbel, Ran Dubin, Amit Dvir, Chen Hajaj, Engineering Applications of Artificial Intelligence, Volume 189, Part 1, 2027

DOI: 10.1016/j.engappai.2026.116850

Code: https://github.com/ArielCyber/GAN-API

License: http://creativecommons.org/licenses/by-nc-nd/4.0/

Importance score: 83/100

The gist: RoBERTa-Augmented Synthesis for Detecting Malicious API Requests introduces a GAN-inspired learning framework that extends limited API traffic datasets through targeted…

Key concepts

RoBERTa
RoBERTa is a powerful Transformer-based language model architecture used here because it excels at understanding the context and meaning within API requests. It serves as the backbone for generating synthetic data that mimics real, complex API calls.
GAN-inspired Learning Framework
The system uses a Generative Adversarial Network (GAN) concept where one part generates fake API requests, and another part tries to distinguish them from real ones. This adversarial process allows the model to create highly realistic synthetic data that is useful for training the final detector.
Data Augmentation Strategy
This involves a three-stage process: input masking, a generator network, and a discriminator network. The masking identifies tokens to replace based on frequency or semantic distance, while the generator creates new requests guided by these constraints to expand the original dataset.

Terminology

Summary

RoBERTa-Augmented Synthesis for Detecting Malicious API Requests introduces a GAN-inspired learning framework that extends limited API traffic datasets through targeted, domain-aware synthesis to enhance anomaly detection on public HTTP traffic datasets. p. 1

Where the paper says it

To address this, we introduce a GAN-inspired learning framework that extends limited API traffic datasets through targeted, domain-aware synthesis. Drawing on techniques from Natural Language Processing (NLP), our approach leverages Transformer-based architectures, particularly RoBERTa, to enhance the contextual representation of API requests and generate realistic synthetic samples aligned with security-specific semantics.

<ref:2405.11258#pg2>. It achieves up to a 4. p. 1
Where the paper says it

In addition, we apply our augmented data to various anomaly detection models to evaluate its impact on classification performance. Our method achieves up to a 4.

94% increase in F1 score on CSIC 2010 and up to 21. p. 1
Where the paper says it

Our method achieves up to a 4. 94% increase in F1 score on CSIC 2010 and up to 21.

10% on ATRDF 2023. p. 1
Where the paper says it

Drawing on techniques from Natural Language Processing (NLP), our approach leverages Transformer-based architectures, particularly RoBERTa, to enhance the contextual representation of API requests and generate realistic synthetic samples aligned with security-specific semantics. We evaluate our framework on two benchmark datasets, CSIC 2010 and ATRDF 2023, and compare it with a previous data augmentation technique to assess the importance of domain-specific synthesis.

<ref:2405.11258#pg3>

Framework Design

The proposed framework utilizes Transformers, specifically RoBERTa, to enhance the contextual representation of API requests and generate realistic synthetic samples aligned with security-specific semantics.<ref:2405.11258#pg6,Transformer architecture is the backbone of various state-of-the-art (SOTA) language models>. p. 5

Where the paper says it

The layered design of Transformers further enables the model to capture higher-level patterns across longer spans of text, which is particularly effective for modeling structured API requests. Transformer architecture is the backbone of various state-of-the-art (SOTA) language models, including BERT and RoBERTa Wolf, Debut, Sanh, Chaumond, Delangue, Moi, Cistac, Rault, Louf, Funtowicz et al.

The system comprises two main modules: a datastore generator designed to augment sparse datasets by synthesizing realistic API requests, and a downstream anomaly detection module trained on the extended dataset. p. 5
Where the paper says it

Among the various NLP tasks supported by MLM, the fill-mask task allows a language model to infer and predict the masked token in a sentence using the surrounding context Kesgin and Amasyali (2023). The proposed framework (depicted in Figure 1) comprises two modules: a datastore generator designed to augment sparse datasets by synthesizing realistic API requests, and a downstream anomaly detection module trained on the extended dataset that includes both original and generated samples.

<ref:2405.11258#pg6,The proposed framework (depicted in Figure 1) comprises two modules>. p. 5
Where the paper says it

Among the various NLP tasks supported by MLM, the fill-mask task allows a language model to infer and predict the masked token in a sentence using the surrounding context Kesgin and Amasyali (2023). The proposed framework (depicted in Figure 1) comprises two modules: a datastore generator designed to augment sparse datasets by synthesizing realistic API requests, and a downstream anomaly detection module trained on the extended dataset that includes both original and generated samples.

The first module leverages a RoBERTa-based architecture to generate realistic API requests from limited data, using token masking guided by structural and semantic constraints. p. 5
Where the paper says it

The proposed framework (depicted in Figure 1) comprises two modules: a datastore generator designed to augment sparse datasets by synthesizing realistic API requests, and a downstream anomaly detection module trained on the extended dataset that includes both original and generated samples. The first module leverages a RoBERTa-based architecture to generate realistic API requests from limited data, using token masking guided by structural and semantic constraints.

<ref:2405.11258#pg7>

Data Augmentation Strategy

The datastore generator process consists of three sequential stages: Input Masking, Generator Network, and Discriminator Network.<ref:2405.11258#pg7>. The input masking step involves identifying tokens suitable for replacement based on frequency and semantic distance criteria. p. 5

Where the paper says it

The process consists of three sequential stages: Input Masking, Generator Network, and Discriminator Network. First, the input masking step identifies tokens suitable for replacement based on frequency and semantic distance criteria.

<ref:2405.11258#pg7>. This includes identifying reserved tokens using a z-score derived from a predefined confidence level to establish a frequency threshold. p. 9
Where the paper says it

73, derived from the specified confidence level, to calculate a frequency threshold for each dataset. For CSIC 2010, the threshold was set at 6,177.

<ref:2405.11258#pg7>

Model Training Signal

The generator is based on a Masked Language Modeling (MLM) built on the RoBERTa architecture.<ref:2405.11258#pg7,The proposed generator, as shown in Figure 1, step 1. p. 5

Where the paper says it

Token Masking Once the outlier token within an API request has been identified, we replace it with the < 𝑀𝐴𝑆𝐾 > token and feed the modified request into RoBERTa to predict the masked word, as shown in Figure 1, step 1. Generator The proposed generator, as shown in Figure 1, step 1.

2, is based on a MLM built on the RoBERTa architecture>. p. 5
Where the paper says it

Generator The proposed generator, as shown in Figure 1, step 1. 2, is based on a MLM built on the RoBERTa architecture.

The generator uses the final hidden state corresponding to the. p. 6
Where the paper says it

(2019), with an additional linear layer to produce a probability distribution over the vocabulary for each masked token. The generator uses the final hidden state corresponding to the < 𝑀𝐴𝑆𝐾 > token and uses the Softmax function to compute token probabilities across the vocabulary, following standard language modeling practices.

<ref:2405.11258#pg7,uses the final hidden state corresponding to the Mask token and uses the Softmax function to compute token probabilities across the vocabulary>. p. 6
Where the paper says it

(2019), with an additional linear layer to produce a probability distribution over the vocabulary for each masked token. The generator uses the final hidden state corresponding to the < 𝑀𝐴𝑆𝐾 > token and uses the Softmax function to compute token probabilities across the vocabulary, following standard language modeling practices.

The loss function used to train the generator is CrossEntropy loss Ho and Wookey (2019). p. 6
Where the paper says it

The generator uses the final hidden state corresponding to the < 𝑀𝐴𝑆𝐾 > token and uses the Softmax function to compute token probabilities across the vocabulary, following standard language modeling practices. The loss function used to train the generator is CrossEntropy loss Ho and Wookey (2019), which is well-suited for masked word prediction.

<ref:2405.11258#pg7,The loss function used to train the generator is CrossEntropy loss Ho and Wookey (2019)>

Performance Evaluation

The framework was evaluated on two benchmark datasets, CSIC 2010 and ATRDF 2023.<ref:2405.11258#pg8,We evaluate our framework on two benchmark datasets, CSIC 2010 and ATRDF 2023>. p. 1

Where the paper says it

Drawing on techniques from Natural Language Processing (NLP), our approach leverages Transformer-based architectures, particularly RoBERTa, to enhance the contextual representation of API requests and generate realistic synthetic samples aligned with security-specific semantics. We evaluate our framework on two benchmark datasets, CSIC 2010 and ATRDF 2023, and compare it with a previous data augmentation technique to assess the importance of domain-specific synthesis.

The custom-trained RoBERTa generator achieved the highest scores across all three text similarity metrics on both datasets. p. 9
Where the paper says it

(2024) framework in terms of the semantic and structural quality of the generated API requests, and (2) to assess whether higher-quality augmentation contributes to improved anomaly detection performance. As shown in Table 4, the custom-trained RoBERTa generator achieved the highest scores across all three text similarity metrics on both datasets, with a few exceptions.

<ref:2405.11258#pg11>. The most notable improvement was observed in VLADEN, which initially performed significantly lower than the other models, particularly on ATRDF. p. 9
Where the paper says it

51% in MoverScore, though BLEU was slightly lower by -0. The difference is more pronounced on ATRDF 2023, where the custom model achieved a BERTScore improvement of +11.

<ref:2405.11258#pg12>

Comparative Analysis

The custom model outperformed GLASS-FODD by +5.74% in BERTScore and +2. p. 7

Where the paper says it

Figure 2: Example of a structured HTTP API request extracted from the ATRDF 2023 dataset, showing the method indicating the operation performed, the path identifying the requested resource, and the headers providing metadata such as content type, client identity, and session details. Evaluation Metrics To evaluate the quality of data augmentation in the generative stage, we use three complementary text generation evaluation metrics: BiLingual Evaluation Understudy (BLEU) Papineni, Roukos, Ward and Zhu (2002), BERTScore Zhang, Kishore, Wu, Weinberger and Artzi (2019), and MoverScore Zhao, Peyrard, Liu, Gao, Meyer and Eger (2019).

34% in MoverScore on CSIC 2010. p. 1
Where the paper says it

Drawing on techniques from Natural Language Processing (NLP), our approach leverages Transformer-based architectures, particularly RoBERTa, to enhance the contextual representation of API requests and generate realistic synthetic samples aligned with security-specific semantics. We evaluate our framework on two benchmark datasets, CSIC 2010 and ATRDF 2023, and compare it with a previous data augmentation technique to assess the importance of domain-specific synthesis.

<ref:2405.11258#pg11>. The custom model reached an MCC of 91. p. 9
Where the paper says it

This setup allows us to isolate the contribution of the synthetic data to the final classification outcome. On the CSIC 2010 dataset, the custom RoBERTa model achieves an MCC of 95.

06% (+19.53%) and an F1 score of 91. p. 1
Where the paper says it

Our method achieves up to a 4. 94% increase in F1 score on CSIC 2010 and up to 21.

24% (+21.10%) on ATRDF 2023. p. 1
Where the paper says it

Drawing on techniques from Natural Language Processing (NLP), our approach leverages Transformer-based architectures, particularly RoBERTa, to enhance the contextual representation of API requests and generate realistic synthetic samples aligned with security-specific semantics. We evaluate our framework on two benchmark datasets, CSIC 2010 and ATRDF 2023, and compare it with a previous data augmentation technique to assess the importance of domain-specific synthesis.

<ref:2405.11258#pg8>. This demonstrates that augmentation mainly improves the classifier’s ability to reduce false positives rather than increase detection sensitivity on ATRDF 2023. p. 9
Where the paper says it

Recall remains consistently high across all models at 99. 97%, indicating that augmentation mainly improves the classifier’s ability to reduce false positives rather than increase detection sensitivity.

<ref:2405.11258#pg8>

Conclusion and Future Work

The framework successfully synthesizes semantically meaningful API requests that preserve structural integrity while introducing useful variability.<ref:2405.11258#pg13>. Future work should explore generating multiple diverse augmentations per request to improve coverage for less common attack patterns. p. 1

Where the paper says it

Existing datasets often do not provide sufficient coverage of the diverse API structures, parameter formats, and usage patterns encountered in real-world scenarios. As a result, models trained on these datasets often struggle to generalize and may fail to detect less common or emerging attack vectors.

p. 1
Where the paper says it

Existing datasets often do not provide sufficient coverage of the diverse API structures, parameter formats, and usage patterns encountered in real-world scenarios. As a result, models trained on these datasets often struggle to generalize and may fail to detect less common or emerging attack vectors.

<ref:2405.11258#pg13>. Additionally, this study did not explicitly balance attack categories during training, suggesting future research should investigate class-aware augmentation strategies.<ref:2405.11258#pg13>. The custom model generated high-quality augmentations more efficiently than the larger RoBERTa-Base model despite being trained on significantly smaller, domain-specific datasets. p. 8
Where the paper says it

We compare this model to the pre-trained RoBERTa-Base model to evaluate the impact of domain-specific language modeling. The evaluation involves measuring lexical similarity and semantic alignment with the original inputs to gauge the quality of the generated API requests.

<ref:2405.11258#pg10>. The results suggest that further improvements can be achieved by selecting an appropriate confidence level for the specific use case. p. 6
Where the paper says it

To support this classification, we introduce an OOD score, derived from the probability vector produced by the linear layer. While OOD detection typically refers to identifying inputs that diverge from the training distribution Ren, Liu, Fertig, Snoek, Poplin, Depristo, Dillon and Lakshminarayanan (2019), in our case, we use the OOD score as an internal signal to assess the confidence of the discriminator’s prediction.

<ref:2405.11258#pg6>. The framework is robust to changes in the confidence level used for token filtering, although small adjustments to this parameter can yield additional performance gains. p. 8
Where the paper says it

Furthermore, we apply our method to SOTA HTTP anomaly detection techniques to evaluate its potential for enhancing more advanced classifiers. Finally, to assess the sensitivity of our generative process to the reserved token filtering mechanism, we conducted an ablation study focused on the confidence level parameter used to derive the frequency threshold.

<ref:2405.11258#pg10>. The data generation times were faster for the custom model compared to RoBERTa-Base. p. 8
Where the paper says it

Each experiment was repeated five times, and we report the average score across all evaluation metrics. The custom-trained RoBERTa model was configured with 6 transformer layers, 12 attention heads, a hidden size of 768, and a vocabulary size of 52,000.

<ref:2405.11258#pg10>

Ablation Study Insights

The ablation study showed that F1 score gains on CSIC 2010 rose from +0.729% at a confidence level of 97% to +1. p. 5

Where the paper says it

There are several possible ways to define a threshold, including rulebased cutoffs, empirical tuning, or iterative adjustment of 𝑧-score values to find an optimal standard deviation Zhou, Zhang, Liu, Shi, Wang and Yu (2021). In our work, we adopt a statistically grounded method by deriving the 𝑧- score directly from a predefined confidence level Simundic et al.

00% at the default confidence level of 99. p. 5
Where the paper says it

There are several possible ways to define a threshold, including rulebased cutoffs, empirical tuning, or iterative adjustment of 𝑧-score values to find an optimal standard deviation Zhou, Zhang, Liu, Shi, Wang and Yu (2021). In our work, we adopt a statistically grounded method by deriving the 𝑧- score directly from a predefined confidence level Simundic et al.

p. 5
Where the paper says it

There are several possible ways to define a threshold, including rulebased cutoffs, empirical tuning, or iterative adjustment of 𝑧-score values to find an optimal standard deviation Zhou, Zhang, Liu, Shi, Wang and Yu (2021). In our work, we adopt a statistically grounded method by deriving the 𝑧- score directly from a predefined confidence level Simundic et al.

99%.<ref:2405.11258#pg6,CSIC 2010 shows modest and steady improvements, with F1 score gains rising from +0. p. 9
Where the paper says it

In comparison, the RoBERTa-Base model shows a larger relative improvement in F1 score (+4. 94%), while GLASS-FODD sees only a modest increase (+0.

729% at 97% to +0.760% at 99.5%, and reaching +1.00% at our default confidence level of 99. p. 5
Where the paper says it

There are several possible ways to define a threshold, including rulebased cutoffs, empirical tuning, or iterative adjustment of 𝑧-score values to find an optimal standard deviation Zhou, Zhang, Liu, Shi, Wang and Yu (2021). In our work, we adopt a statistically grounded method by deriving the 𝑧- score directly from a predefined confidence level Simundic et al.

p. 5
Where the paper says it

There are several possible ways to define a threshold, including rulebased cutoffs, empirical tuning, or iterative adjustment of 𝑧-score values to find an optimal standard deviation Zhou, Zhang, Liu, Shi, Wang and Yu (2021). In our work, we adopt a statistically grounded method by deriving the 𝑧- score directly from a predefined confidence level Simundic et al.

99%>. The ATRDF 2023 dataset showed a peak improvement of +21. p. 9
Where the paper says it

51% in MoverScore, though BLEU was slightly lower by -0. The difference is more pronounced on ATRDF 2023, where the custom model achieved a BERTScore improvement of +11.

p. 9
Where the paper says it

51% in MoverScore, though BLEU was slightly lower by -0. The difference is more pronounced on ATRDF 2023, where the custom model achieved a BERTScore improvement of +11.

173% at a confidence level of 99%, followed by a slight decline to +21. p. 5
Where the paper says it

There are several possible ways to define a threshold, including rulebased cutoffs, empirical tuning, or iterative adjustment of 𝑧-score values to find an optimal standard deviation Zhou, Zhang, Liu, Shi, Wang and Yu (2021). In our work, we adopt a statistically grounded method by deriving the 𝑧- score directly from a predefined confidence level Simundic et al.

p. 5
Where the paper says it

There are several possible ways to define a threshold, including rulebased cutoffs, empirical tuning, or iterative adjustment of 𝑧-score values to find an optimal standard deviation Zhou, Zhang, Liu, Shi, Wang and Yu (2021). In our work, we adopt a statistically grounded method by deriving the 𝑧- score directly from a predefined confidence level Simundic et al.

138% at 99.5% and +21.10% at 99.99%.<ref:2405.11258#pg6>. The study confirmed that our approach remains stable and effective across different settings. p. 9
Where the paper says it

10%), with the most substantial improvement observed in Precision (+38. Recall remains consistently high across all models at 99.

<ref:2405.11258#pg6>

SOTA Comparison

When applied to three SOTA HTTP anomaly detection methods, the inclusion of generated samples led to improved performance across all methods and datasets.<ref:2405.11258#pg12>. For Sec2vec, consistent gains were observed across all metrics. p. 9

Where the paper says it

Overall, the inclusion of generated samples led to improved performance across all methods and datasets. For Sec2vec, we observed consistent gains across all metrics, particularly in precision, with a smaller but stable increase in F1 score and MCC.

<ref:2405.11258#pg13>. The most significant gains were seen in VLADEN on ATRDF with an increase of +26. p. 9
Where the paper says it

Overall, the inclusion of generated samples led to improved performance across all methods and datasets. For Sec2vec, we observed consistent gains across all metrics, particularly in precision, with a smaller but stable increase in F1 score and MCC.

18% in F1 score and +45. p. 1
Where the paper says it

Our method achieves up to a 4. 94% increase in F1 score on CSIC 2010 and up to 21.

92% in Precision. p. 8
Where the paper says it

country=’;SELECT%20*%20FROM %20shippers%20– ’;SELECT * FROM shippers – Appends raw SQL code into a query parameter to manipulate backend queries and extract database records. For the anomaly detection task, we use four classification metrics: Precision, Recall, F1 Score, and Matthews Correlation Coefficient (MCC).

<ref:2405.11258#pg13>. This indicates that the augmented samples contribute useful variation that reinforces the model’s ability to distinguish subtle patterns in request structure. p. 9
Where the paper says it

For Sec2vec, we observed consistent gains across all metrics, particularly in precision, with a smaller but stable increase in F1 score and MCC. This suggests that the augmented samples contribute useful variation that reinforces the model’s ability to distinguish subtle patterns in request structure.

<ref:2405.11258#pg13>. The custom-trained RoBERTa GAN-inspired variant consistently boosted precision and F1 scores when integrated into these architectures. p. 9
Where the paper says it

(2023), SWAF Jemal, Haddar, Cheikhrouhou and Mahfoudhi (2022), and VLADEN Jagat, Sisodia and Singh (2024). In this evaluation, we used only the custom-trained RoBERTa variant as the GAN architecture for generating augmented samples.

<ref:2405.11258#pg13>

Evaluation Metrics

The quality of data augmentation in the generative stage was evaluated using three complementary text generation evaluation metrics: BLEU, BERTScore, and MoverScore.<ref:2405.11258#pg7> BLEU measures surface-level similarity by computing n-gram overlap between generated and reference sequences. p. 7

Where the paper says it

Evaluation Metrics To evaluate the quality of data augmentation in the generative stage, we use three complementary text generation evaluation metrics: BiLingual Evaluation Understudy (BLEU) Papineni, Roukos, Ward and Zhu (2002), BERTScore Zhang, Kishore, Wu, Weinberger and Artzi (2019), and MoverScore Zhao, Peyrard, Liu, Gao, Meyer and Eger (2019). BLEU measures surface-level similarity by computing n-gram overlap between generated and reference sequences, making it effective for capturing exact lexical matches.

<ref:2405.11258#pg7> BERTScore computes semantic similarity using contextualized token embeddings from pretrained language models. p. 7
Where the paper says it

BLEU measures surface-level similarity by computing n-gram overlap between generated and reference sequences, making it effective for capturing exact lexical matches. BERTScore computes semantic similarity using contextualized token embeddings from pretrained language models, making it well-suited for handling paraphrasing and variations in word order.

<ref:2405.11258#pg7>. MoverScore extends this approach by combining contextual embeddings with Earth Mover’s Distance to quantify semantic closeness. p. 7
Where the paper says it

BERTScore computes semantic similarity using contextualized token embeddings from pretrained language models, making it well-suited for handling paraphrasing and variations in word order. MoverScore extends this approach by combining contextual embeddings with Earth Mover’s Distance Rubner, Tomasi and Guibas (2000), which quantifies the minimum semantic effort required to transform one sequence into another and thus measures how closely the meaning of the generated text aligns with the reference.

<ref:2405.11258#pg7>. For the anomaly detection task, four classification metrics were used: Precision, Recall, F1 Score, and Matthews Correlation Coefficient (MCC). p. 8
Where the paper says it

country=’;SELECT%20*%20FROM %20shippers%20– ’;SELECT * FROM shippers – Appends raw SQL code into a query parameter to manipulate backend queries and extract database records. For the anomaly detection task, we use four classification metrics: Precision, Recall, F1 Score, and Matthews Correlation Coefficient (MCC).

<ref:2405.11258#pg9,For the anomaly detection task, we use four classification metrics: Precision, Recall, F1 Score, and Matthews Correlation Coefficient (MCC)> MCC provides a balanced evaluation of classification performance even with class imbalance using all four elements of the confusion matrix. p. 8
Where the paper says it

F1 Score = 2 ⋅ Precision ⋅ Recall Precision + Recall MCC. Provides a balanced evaluation of classification performance, even with class imbalance, using all four elements of the confusion matrix.

<ref:2405.11258#pg9,MCC provides a balanced evaluation of classification performance even with class imbalance using all four elements of the confusion matrix>. p. 8
Where the paper says it

F1 Score = 2 ⋅ Precision ⋅ Recall Precision + Recall MCC. Provides a balanced evaluation of classification performance, even with class imbalance, using all four elements of the confusion matrix.

Precision quantifies the number of correctly predicted positive instances out of all predicted positives. p. 8
Where the paper says it

These are defined as: Precision. Quantifies the number of correctly predicted positive instances out of all predicted positives.

<ref:2405.11258#pg9,Precision. p. 8
Where the paper says it

country=’;SELECT%20*%20FROM %20shippers%20– ’;SELECT * FROM shippers – Appends raw SQL code into a query parameter to manipulate backend queries and extract database records. For the anomaly detection task, we use four classification metrics: Precision, Recall, F1 Score, and Matthews Correlation Coefficient (MCC).

Quantifies the number of correctly predicted positive instances out of all predicted positives>. p. 8
Where the paper says it

These are defined as: Precision. Quantifies the number of correctly predicted positive instances out of all predicted positives.

Recall measures the proportion of actual positives correctly identified by the model. p. 8
Where the paper says it

Precision = 𝑇 𝑃 𝑇 𝑃 + 𝐹 𝑃 Recall. Measures the proportion of actual positives correctly identified by the model.

<ref:2405.11258#pg9,Recall. p. 8
Where the paper says it

country=’;SELECT%20*%20FROM %20shippers%20– ’;SELECT * FROM shippers – Appends raw SQL code into a query parameter to manipulate backend queries and extract database records. For the anomaly detection task, we use four classification metrics: Precision, Recall, F1 Score, and Matthews Correlation Coefficient (MCC).

Measures the proportion of actual positives correctly identified by the model> F1 Score represents the harmonic mean of Precision and Recall. p. 8
Where the paper says it

Precision = 𝑇 𝑃 𝑇 𝑃 + 𝐹 𝑃 Recall. Measures the proportion of actual positives correctly identified by the model.

<ref:2405.11258#pg9,F1 Score. p. 1
Where the paper says it

Our method achieves up to a 4. 94% increase in F1 score on CSIC 2010 and up to 21.

Represents the harmonic mean of Precision and Recall>

Data Set Details

The experiments were conducted on CSIC 2010 and ATRDF 2023 datasets.<ref:2405.11258#pg4> CSIC 2010 simulates HTTP traffic for an e-commerce web application with over 72,000 requests. p. 7

Where the paper says it

It simulates HTTP traffic for an e-commerce web application, where users interact with features such as product searches, shopping carts, and registration forms. The dataset includes over 72,000 web requests, comprising 36,000 normal requests and more than 25,000 attack instances.

<ref:2405.11258#pg4> ATRDF 2023 is a comprehensive dataset of API traffic reflecting modern API formats with approximately 78,000 abnormal pairs. p. 7
Where the paper says it

It reflects modern API formats and includes a wide variety of payload-based attacks, such as Directory Traversal (DT), Cookie Injection (CI), LOG4J, Remote Code Execution (RCE), Log Forging (LF), SQLi, and XSS, all labeled accordingly. The dataset is structured into four distinct groups and comprises approximately 54,000 normal pairs and 78,000 abnormal pairs.

<ref:2405.11258#pg4>. Both datasets were treated as HTTP-based API traffic given that modern APIs rely on the same underlying protocol and structural patterns. p. 7
Where the paper says it

(2025) for studying API-level threat detection and classification. Although CSIC 2010 represents HTTP traffic and ATRDF 2023 is explicitly API-based, we treat both datasets as HTTP-based API traffic, given that modern APIs rely on the same underlying protocol and structural patterns Niswar, Safruddin, Bustamin and Aswad (2024).

<ref:2405.11258#pg4>

Ablation Study Details

The ablation study systematically varied the confidence level used for token filtering to assess its impact on detection performance.<ref:2405.11258#pg6>. The study was performed using the custom-trained RoBERTa model by varying the confidence level from 97% to 99. p. 8

Where the paper says it

We begin by analyzing the identification of reserved tokens during the input masking phase. Next, we assess our method using a custom-trained RoBERTa model, which we trained from scratch on the experimental datasets.

5%.<ref:2405.11258#pg6>. The results showed that F1 score gains rose from +0. p. 9
Where the paper says it

SWAF also showed improved performance, especially in recall, while precision remained stable or showed slight variation. These results indicate that the augmented samples Aharon et al.

729% at 97% to +0.760% at 99.5%, reaching +1.00% at the default confidence level of 99.99% on CSIC 2010. p. 1
Where the paper says it

Drawing on techniques from Natural Language Processing (NLP), our approach leverages Transformer-based architectures, particularly RoBERTa, to enhance the contextual representation of API requests and generate realistic synthetic samples aligned with security-specific semantics. We evaluate our framework on two benchmark datasets, CSIC 2010 and ATRDF 2023, and compare it with a previous data augmentation technique to assess the importance of domain-specific synthesis.

<ref:2405.11258#pg6,As shown in Figure 3a, CSIC 2010 shows modest and steady improvements, with F1 score gains rising from +0. p. 9
Where the paper says it

In comparison, the RoBERTa-Base model shows a larger relative improvement in F1 score (+4. 94%), while GLASS-FODD sees only a modest increase (+0.

729% at 97% to +0.760% at 99.5%, and reaching +1.00% at our default confidence level of 99.99%>. The ATRDF 2023 dataset showed a peak improvement of +21.173% at a confidence level of 99%, followed by a slight decline to +21.138% at 99.5% and +21.10% at 99.99%.<ref:2405.11258#pg6>. The study demonstrated that our approach remains stable and effective across different settings. p. 9
Where the paper says it

10%), with the most substantial improvement observed in Precision (+38. Recall remains consistently high across all models at 99.

<ref:2405.11258#pg6>

Efficiency Comparison

The custom-trained RoBERTa model generated high-quality augmentations more efficiently than the larger RoBERTa-Base model despite being trained on significantly smaller, domain-specific datasets.<ref:2405.11258#pg10>. The custom model averaged 0. p. 8

Where the paper says it

We begin by analyzing the identification of reserved tokens during the input masking phase. Next, we assess our method using a custom-trained RoBERTa model, which we trained from scratch on the experimental datasets.

526 seconds per input sample compared to 0. p. 9
Where the paper says it

Meanwhile, domain-specific tokens such as "tienda1" in CSIC 2010 and "check" in ATRDF 2023 highlighted differences between the two API environments. Baselines In this experiment, we produced one augmented sample for each input HTTP request in the training set.

957 seconds for RoBERTa-Base. p. 8
Where the paper says it

Next, we assess our method using a custom-trained RoBERTa model, which we trained from scratch on the experimental datasets. We compare this model to the pre-trained RoBERTa-Base model to evaluate the impact of domain-specific language modeling.

<ref:2405.11258#pg10>. This highlights the value of compact, task-specific language models. p. 0
Where the paper says it

Highlights RoBERTa-Augmented Synthesis for Detecting Malicious API Requests Udi Aharon, Revital Marbel, Ran Dubin, Amit Dvir, Chen Hajaj • Framework inspired by Generative Adversarial Networks augments web API traffic data. • RoBERTa-based language model enhances the semantics of synthetic web request samples.

<ref:2405.11258#pg10>. The framework generates a single validated synthetic request per input sample. p. 9
Where the paper says it

Baselines In this experiment, we produced one augmented sample for each input HTTP request in the training set. To ensure the quality of the synthetic data, only the generated samples that passed the discriminator’s validation were retained.

<ref:2405.11258#pg7>. Future work should explore generating multiple diverse augmentations per request to improve coverage for less common attack patterns.<ref:2405.11258#pg13>. The paper is available at https://github. p. 1
Where the paper says it

10% on ATRDF 2023. The source codes of this work are available at https://github.

com/ArielCyber/GAN-API. p. 1
Where the paper says it

The source codes of this work are available at https://github. com/ArielCyber/GAN-API.

<ref:2405.11258#pg2,The source codes of this work are available at https://github. p. 1
Where the paper says it

10% on ATRDF 2023. The source codes of this work are available at https://github.

com/ArielCyber/GAN-API>

References

The paper cites numerous prior works covering web security, few-shot learning, and deep learning data augmentation techniques.<ref:2405.11258#pg3,Section 2 reviews prior work related to anomaly detection, fewshot learning, and deep learning techniques for data augmentation>. p. 2

Where the paper says it

The remainder of this paper is organized as follows. Section 2 reviews prior work related to anomaly detection, fewshot learning, and deep learning techniques for data augmentation.

Key references include RoBERTa Liu et al. p. 5
Where the paper says it

Transformer architecture is the backbone of various state-of-the-art (SOTA) language models, including BERT and RoBERTa Wolf, Debut, Sanh, Chaumond, Delangue, Moi, Cistac, Rault, Louf, Funtowicz et al. RoBERTa builds on the foundational BERT model, with some key updates in the way it’s trained to enhance its performance in language comprehension tasks.

(2019) for the Transformer architecture and GANs Sun and He (2020) for GANs in text. p. 2
Where the paper says it

Few-shot learning (FSL) is specifically designed to enable models to learn effectively from small amounts of labeled data, making it particularly useful for tasks such as anomaly detection Yu and Bian (2020); Huang, Liu, Fung, An, He, Zhao, Yang and Luan (2020); Lu and Liu (2023). On the other hand, Generative Adversarial Networks (GANs) are utilized to augment limited datasets by generating realistic synthetic samples before training Sun and He (2020); Saxena and Cao (2021); Chavdarova and Fleuret (2018); Mohebbi Moghaddam, Boroomand, Jalali, Zareian, Daeijavad, Manshaei and Krunz (2023).

<ref:2405.11258#pg3>. Other relevant studies include Iliyasu et al. p. 3
Where the paper says it

One line of work focuses on improving few-shot performance through discriminative representation learning. Iliyasu et al.

(2022) for few-shot learning and Ding et al. p. 4
Where the paper says it

In the context of network security, Ding et al. Ding, Chen, Dong, Fu and Cui (2022) proposed a hybrid approach combining K-Nearest Neighbors (KNN) for undersampling with a GAN variant to oversample minority-class intrusion data.

(2022) for GANs in intrusion detection. p. 4
Where the paper says it

In the context of network security, Ding et al. Ding, Chen, Dong, Fu and Cui (2022) proposed a hybrid approach combining K-Nearest Neighbors (KNN) for undersampling with a GAN variant to oversample minority-class intrusion data.

<ref:2405.11258#pg3,Few-Shot Learning (FSL) is specifically designed to enable models to learn effectively from small amounts of labeled data>. p. 2
Where the paper says it

Several methods have been introduced to address the challenge of limited datasets in deep learning. Few-shot learning (FSL) is specifically designed to enable models to learn effectively from small amounts of labeled data, making it particularly useful for tasks such as anomaly detection Yu and Bian (2020); Huang, Liu, Fung, An, He, Zhao, Yang and Luan (2020); Lu and Liu (2023).

The paper also references work on specific attacks like SQLi and XSS detection using various models. p. 3
Where the paper says it

Web Security and Anomaly Detection Extensive research has been conducted on detecting malicious behavior in web traffic, including attacks such as SQL Injection (SQLi), and Cross-Site Scripting (XSS). While early approaches often relied on rule-based or statistical models, more recent work has adopted machine learning and NLP techniques to analyze structured web requests and detect anomalies.

<ref:2405.11258#pg3>. The work builds upon the foundation of existing research in web security and anomaly detection. p. 3
Where the paper says it

Web Security and Anomaly Detection Extensive research has been conducted on detecting malicious behavior in web traffic, including attacks such as SQL Injection (SQLi), and Cross-Site Scripting (XSS). While early approaches often relied on rule-based or statistical models, more recent work has adopted machine learning and NLP techniques to analyze structured web requests and detect anomalies.

<ref:2405.11258#pg3>. The paper is supported by the Israel Innovation Authority and the Trust-AI consortium. p. 1
Where the paper says it

RoBERTa-Augmented Synthesis for Detecting Malicious API Requests Udi Aharona,c,∗ , Revital Marbele , Ran Dubina,c , Amit Dvira,c,1 and Chen Hajajb,c,d aDepartment of Computer and Software Engineering, Golan Heights 1, Ariel, 4077625, Israel bDepartment of Industrial Engineering & Management, Ariel University, Golan Heights 1, Ariel, 4077625, Israel cAriel Cyber Innovation Center, Ariel University, Golan Heights 1, Ariel, 4077625, Israel dData Science and Artificial Intelligence Research Center, Ariel University, Golan Heights 1, Ariel, 4077625, Israel eDepartment of Computer Science, Holon Institute of Technology (HIT), Golomb 52, Holon, 4077625, Israel A R T I C L E I N F O Keywords: Data Augmentation API Security GAN-Inspired NLP A B S T R A C T Web applications and APIs face constant threats from malicious actors seeking to exploit vulnerabilities for illicit gains. To defend against these threats, it is essential to have anomaly detection systems that can identify a variety of malicious behaviors.

<ref:2405.11258#pg13,This work was supported by the Israel Innovation Authority and the Trust-AI consortium>

Author Information

Udi Aharon is currently pursuing a Ph.D. degree in Computer and Software Engineering at Ariel University, Israel. p. 1

Where the paper says it

RoBERTa-Augmented Synthesis for Detecting Malicious API Requests Udi Aharona,c,∗ , Revital Marbele , Ran Dubina,c , Amit Dvira,c,1 and Chen Hajajb,c,d aDepartment of Computer and Software Engineering, Golan Heights 1, Ariel, 4077625, Israel bDepartment of Industrial Engineering & Management, Ariel University, Golan Heights 1, Ariel, 4077625, Israel cAriel Cyber Innovation Center, Ariel University, Golan Heights 1, Ariel, 4077625, Israel dData Science and Artificial Intelligence Research Center, Ariel University, Golan Heights 1, Ariel, 4077625, Israel eDepartment of Computer Science, Holon Institute of Technology (HIT), Golomb 52, Holon, 4077625, Israel A R T I C L E I N F O Keywords: Data Augmentation API Security GAN-Inspired NLP A B S T R A C T Web applications and APIs face constant threats from malicious actors seeking to exploit vulnerabilities for illicit gains. To defend against these threats, it is essential to have anomaly detection systems that can identify a variety of malicious behaviors.

<ref:2405.11258#pg14,Udi Aharon is currently pursuing a Ph. p. 0
Where the paper says it

Highlights RoBERTa-Augmented Synthesis for Detecting Malicious API Requests Udi Aharon, Revital Marbel, Ran Dubin, Amit Dvir, Chen Hajaj • Framework inspired by Generative Adversarial Networks augments web API traffic data. • RoBERTa-based language model enhances the semantics of synthetic web request samples.

D.

Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.

Improvements for AI systems

  1. GAN-inspired framework for API attack detection can generate high-quality, diverse API requests from a limited dataset by treating structured API requests as language-like sequences and using token masking guided by structural and semantic constraints. This allows the system to augment sparse datasets, improving anomaly detection on public HTTP traffic datasets.

  2. The system can leverage RoBERTa as both a generator guided by API-specific constraints and a discriminator trained in a self-supervised manner using Pseudo Labeling (PL) and Out Of Distribution (OOD) scoring to distinguish between normal and anomalous API requests. This dual role enhances the generation process while providing an internal signal to assess the confidence of the discriminator’s prediction.

  3. A domain-specific token masking strategy based on semantic distance and statistical filtering ensures that generated API samples remain structurally valid and contextually relevant to the API domain, by identifying outlier tokens using cosine similarity against a sentence embedding. This step preserves structural integrity during data augmentation for security analysis.

  4. The anomaly detection module can be trained on an extended dataset that includes both original and generated samples, utilizing a byte-level BPE tokenizer trained from scratch on the unified dataset to produce a reliable tokenizer without introducing bias from excessive short or fragmented tokens. This ensures robust classification performance on API traffic.

  5. The final classification task can be performed by training a Random Forest classifier where the anomaly detection threshold is dynamically defined as the 99th percentile of the model output probabilities over normal training data, aligning with our setting, where tokenized API requests may contain sparse or noisy elements.

Abstract

Application Programming Interfaces (APIs) face constant threats from malicious actors seeking to exploit vulnerabilities for illicit gains. Effective anomaly detection depends on diverse, representative datasets that capture real-world API behaviors. However, existing datasets are often limited in scope, privacy-restricted, or lack the structural variability needed to train robust detection models. To address this challenge, we propose a Small Language Model (SLM)-augmented synthesis framework designed to expand limited API datasets with constraints intended to preserve request structure and contextual relevance. The proposed framework, referred to as SLM-API, leverages a compact Transformer-based model to replace selected tokens in benign and malicious requests, subject to structural restrictions and a separately trained discriminator consistency check. We evaluate our framework on two benchmark datasets, the Spanish National Research Council (CSIC) 2010 Hypertext Transfer Protocol (HTTP) dataset and the API Traffic Research Dataset Framework (ATRDF) 2023, and compare it with pretrained models, plain masked language models, DeepSeek generation, and a duplication control to assess controlled augmentation. In addition, we apply our augmented data to various anomaly detection models to evaluate its impact on classification performance. Our method achieves Random Forest F1 scores of 97.67% on CSIC 2010 and 91.24% on ATRDF 2023, improvements of 1.00 and 21.12 percentage points, respectively, over training without augmentation. Component ablations and endpoint-family holdout reveal the role of replacement restrictions and uneven transfer to excluded routes.

Sources

Related papers