SShortSingh.
Back to feed

Developer builds 7ms prompt-injection detector on 78K samples, skips LLM approach

0
·1 views

A developer built a prompt-injection detection system trained on over 78,000 attack samples, deliberately avoiding the increasingly common approach of using a large language model as the judge. Instead, the system relies on deterministic regex and classical machine learning — specifically TF-IDF character n-grams fed into logistic regression — completing each check in roughly 7 milliseconds at no per-call cost. On held-out public benchmarks, the detector achieved 0.895 recall on real-world jailbreaks and 0.799 on obfuscated attacks, both at 1.00 precision, but scored only 0.324 recall on subtle roleplay-framed jailbreaks — a gap the developer openly acknowledges. The developer also highlighted that false-positive rates vary significantly by traffic type, ranging from roughly 0.4% on curated benign input to 5% on open conversational logs, warning that single-number FPR claims from vendors are often best-case figures. The core argument is that a cheap, fast, deterministic layer should handle all traffic, with heavier models reserved only for ambiguous edge cases that justify the added latency and cost.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

A 14-Day GitHub-Based Loop to Guide Your Next Career-Change Decision

A structured framework proposes replacing the vague advice of 'believe in yourself' with a 14-day decision loop for people navigating career transitions into tech. The method uses a GitHub repository to log a narrow career hypothesis, one hands-on artifact built under a realistic time constraint, and structured feedback from at least one external reviewer. Rather than aiming for certainty, the loop is designed to generate enough evidence to choose a clear next reversible step — whether that means applying for roles, adjusting the learning plan, pausing, or stopping altogether. At the end of 14 days, participants produce a written decision record drawn from real observations rather than emotions or tutorial completions. The approach treats career exploration as a repeatable experiment, with each cycle scoped to no more than four additional weeks of follow-up action.

0
ProgrammingDEV Community ·

Developer builds AI history video pipeline, learns hard lesson about idempotent resume logic

A solo developer built an automated pipeline to generate history-explainer videos using local AI tools, including a FLUX image model that creates one 1024x576 image per script sentence. When resuming a partially completed 17-image batch, the process appeared to stall because a blunt --force flag caused the tool to silently regenerate already-completed images under new filenames instead of skipping them. The developer caught the issue after questioning Claude Code three times about whether the job was actually progressing. The fix was a simple shell check that skips image generation if the output file already exists, reducing a redundant 15-minute run to just 4 minutes. The episode highlighted a broader principle: long-running jobs should resume by building only what is missing, rather than restarting from scratch.

0
ProgrammingDEV Community ·

Playwright and Chroma Replace Postman for 20x Faster RAG Memory Testing

A developer at a RAG-based assistant product discovered a critical memory bug after a user reported the assistant forgot a peanut allergy mid-conversation. The root cause was a legacy API endpoint overwriting freshly stored memory — a path that manual Postman tests had never covered. The existing workflow, which involved manually sending fixed conversations and inspecting Chroma via Jupyter notebooks, was slow, incomplete, and impossible to reproduce reliably under pressure. To fix this, the team replaced manual testing with an automated end-to-end pipeline combining Playwright as a real browser driver and a direct Chroma client for vector store verification. The new setup runs entirely in local or CI environments via a single pytest file, cutting one test cycle from over five minutes to a fraction of that time.

0
ProgrammingDEV Community ·

AI's 70-Year Journey: From Hardcoded Rules to Autonomous Agents

Artificial intelligence has evolved through distinct stages over more than seven decades, beginning with rule-based systems that relied entirely on manually programmed logic. The field progressed through classical machine learning, which identified patterns in labeled data, and then deep learning, which allowed neural networks to automatically extract features from raw inputs. Large Language Models, powered by the 2017 Transformer architecture, marked a shift to general-purpose models capable of handling diverse tasks without retraining. The latest development is agentic AI, where LLMs are equipped with tools and multi-step planning abilities to carry out complex tasks with minimal human intervention. Despite rapid advances, key limitations persist — including hallucination and compounding errors in agents — with reliability remaining the central unsolved challenge.

Developer builds 7ms prompt-injection detector on 78K samples, skips LLM approach · ShortSingh