SlimT5: Compact Encoders for Vulnerability and Technical Debt Detection
2 min readupdated
SlimT5 is a family of compressed code encoders based on Salesforce/codet5-small, created by author Jyo-K for the NLBSE'27 competition. The model handles two code classification tasks simultaneously: finding vulnerabilities and identifying self-admitted technical debt (SATD, developer comments noting temporary or suboptimal workarounds). It relies on a 4-block encoder featuring a 32K-token byte-level BPE tokenizer and a dual-output classification head. Using structured pruning (removing excess FFN neurons and attention heads via Taylor criteria) followed by fine-tuning, the model runs significantly faster than its uncompressed 4-block counterpart while matching its accuracy. This tool is useful for developers and security specialists looking to analyze large codebases quickly.
Key features
- Structured compression: FFN layer sizes are reduced from 2048 to 512 neurons, with lineup variants featuring 8, 6, and 4 attention heads.
- High speed: The main L4_prune_f512_h8_s0 version contains 22.9M parameters and requires half the computations (58,354 GFLOPs compared to 116,650 for the uncompressed model).
- Baseline-level accuracy: On public validation, the model achieves 0.9376 mean F1 and 0.9549 competition score, outperforming the uncompressed variant (0.9501) and baseline CodeBERT (0.730).
- Flexible configuration options: The repository provides 15 training variants featuring different pruning settings, distillation, and thresholds.
What you can do
- Automate security audits: Check functions for vulnerabilities using a binary classifier and configurable thresholds from
model_config.json. - Track technical debt: Locate code sections and comments containing SATD during code reviews or large repository analysis.
- Balance speed and accuracy: Use the fastest 4-head attention version (20.8M parameters, 13.4s for the full split) for constrained resources or the 8-head variant for maximum F1.
Example
import sys
from huggingface_hub import snapshot_download
sys.path.insert(0, "final")
import flib
path = snapshot_download("Jyo-K/SlimT5", allow_patterns="L4_prune_f512_h8_s0/*")
clf, tok, cfg = flib.load_run(f"{path}/L4_prune_f512_h8_s0", device="cuda")Read more
DetailsBenchmarks (L4_prune_f512_h8_s0): Public F1 — 0.9376, Dev F1 — 0.9353, Competition Score — 0.9549 (vs 0.730 for CodeBERT)
Hardware and speed: Tested on a single Kaggle T4 GPU in fp16; processing 30,655 functions takes 19.0s (58,354 GFLOPs)
Training: 3 post-pruning recovery epochs; training dataset NLBSE/nlbse27-code-comment-classification not included in the repository
License: Apache License 2.0 (base CodeT5-small is distributed under Salesforce's own license)










Comments