17 min read
A local AI harness for security research on a 16 GB card
How far a local model, pipeline and harness can go for security research on an average modern GPU with 16 GB of VRAM.
Introduction
This started with Keith’s 3-part series on securing.dev, Getting started with local LLMs. After reading it I decided to take the plunge myself and see what I could get away with on the setup I already have.
I had some experience running local models for image generation, but what I actually wanted was open models for security research. From what I can see, a lot of offensive teams right now are working with local models that have either had their guardrails stripped or never had any. And as someone who started on Gemini and now uses Claude for most things, I had been hitting guardrails myself, sometimes on personal projects and sometimes on research.
My background is penetration testing, with Kali Linux and the tools that come with it, and my strongest side is the network. Software, and web apps especially, is where I was weaker, though I have shored that up over the past few years. What I like doing is finding vulnerabilities and helping secure the web, and I wanted models that could help me do that locally.
So I set up my own local harness, models and workflow to see if I could do offensive security research on my own machine. One rule from the start: I wanted it GPU bound. I did not want the model spilling into my RAM, so everything here has to fit in 16 GB of VRAM. Spilling over is something I will explore later.
To see what the setup can really do, I have been benchmarking it. I feed it known CVEs to see if the model finds them, and then I look at the fixes it proposes.
For the workflow I am following a pipeline design I have seen recommended on the engineering side: a planner, an engineer, a reviewer, and then the work gets split out to workers. The difference is that I cannot run several agents in parallel with these models on this much VRAM. Everything has to be sequenced, one model call after another, so the runs are longer. That is the trade for now.
So this post is an introduction to what I have been doing to tune a local pipeline for this kind of work. I want to share the few findings I have so far, and show how I went about it. I would also like to hear from others: which models and harnesses you use, and which tasks and questions you give them. And if you want to do something similar and do not really know where to start, this might be a decent reference point, at least to avoid the pitfalls I fell into.
It is one card, one operating system and a lot of overnight runs, and some of it did not work.
The short version
- Out of 7 models I tried, 1 was usable for auditing and patching. The others could not call tools, could not stop generating, or could not tell safe code from unsafe code.
- Once I had a model that could do the work at all, changing the harness moved the results more than changing the model did. That is a good find by itself, and it is most of what this post is about.
- Long files have to be cut into pieces. With a 16K window the model does not get through an 800 line file in one go.
- On real published vulnerabilities the setup found the right flaw 13 times out of 21, and it complained about already-fixed code 1 time out of 13.
- The tests decide if a patch is good, not the model. Every model I tried as a reviewer approved broken code at least once.
- It is slow. Auditing 13 files 3 times each took about 15 hours.
Starting with models that have no guardrails
Since guardrails were the reason I went local, the first thing I wanted was models that could be used for this type of work at all. So I began with abliterated models, which are open models with their refusals removed. I picked those to make sure the guardrails would not be the thing that stopped me, and nothing leaves the machine either way.
I do not think an abliterated model is strictly necessary. Removing the refusals can cost a model some of its quality, and some of the strong open models have fairly loose guardrails to begin with. I have not tested those yet, so for now that is a guess and not a result.
And it seems to be working, at least on some of the benchmarks. But this is limited testing, and I am fairly certain there is a more efficient and stronger setup to be had from this same card, whether that comes from the model, the harness, or the agents with their prompts and their tasks. What surprised me is where the gains have come from so far: tweaking the harness changed the output more than swapping the model did.
The setup
- GPU: AMD RX 7800 XT, 16 GB of VRAM, Windows 11
- Ollama 0.40.16, the build from AMD’s AI bundle
- Model:
huihui_ai/Qwen3.8-abliterated:27b-q3_K, 14 GB on disk - Harness: oh-my-pi (
omp) 19.0.1, run from scripts, one fresh session per task
Everything is AMD on Windows because that is what I have. None of it was tried on NVIDIA or Linux.
Staying on the GPU
A 14 GB model on a 16 GB card leaves about 2 GB for context. The harness does not tell Ollama how much context to use, so Ollama loaded the model at its full advertised size, a quarter of a million tokens, and it spilled to the CPU. It still worked, it was just very slow and nothing said why.
The fix is a copy of the model with the size written in:
FROM huihui_ai/Qwen3.8-abliterated:27b-q3_K
PARAMETER num_ctx 16384
Then 2 settings on the Ollama server make 16K fit fully on the card:
OLLAMA_FLASH_ATTENTION=1
OLLAMA_KV_CACHE_TYPE=q8_0
With those, 16K runs at about 32 tokens a second. 24K runs at the same speed but found nothing extra. 32K drops to 23 tokens a second. So the whole pipeline is built around a 16K window, which is small.
Two harness defaults that hurt a small model
omp works with hosted models and with local engines like Ollama, and it finds a local engine on its own. But some of its defaults assume a strong model with a big context window. For files over 100 lines its read tool returns an outline, function names with the bodies left out, and expects the model to ask for more. The local model never asked, it answered from the outline as if it had read the code.
read:
summarize:
enabled: false
defaultLimit: 1000
And when omp runs from a script it waits on standard input forever unless it is closed (< /dev/null).
Use a model to help you set up a model
Honestly, I used other models to help me set all of this up, and I read the omp documentation to understand some of its settings. I would encourage people to do the same, for a local setup or any other environment. A model is a great starting point for learning a setup and for finding the mistakes in it, as long as you do not offload too much to it and you actually understand each setting you change and what it does.
I also really appreciate the omp documentation. It is good, and there is a lot of useful information in it.
Picking the model
The cool thing to see was how clear the pros and cons of each model are, depending on the task you give it.
Granite is the best example. It is really fast, but it did not work as an auditor: it flagged about as many safe spots as real flaws. When the good and the bad come in equal amounts, the output is not information you can use.
That being said, a fast model that makes mistakes still has a place, and it points at an idea I want to push further: stacking models in tiers. The fast one goes through the whole codebase quickly and grabs what looks relevant, and only that gets handed to the next tier up, so the stronger and slower model has a smaller scope to work on. I have already done one tier of this. My best patching mix uses Granite as the scout and a bigger model for everything after, and it passed 13 of 15 bug cases. The risk is that the fast model drops something the later steps needed. I saw that too: as a scout on a set of documentation questions, Granite was about 8 times faster than the model it replaced and got 4 answers wrong.
Across the board, one of the Qwen models, Qwen 3.8 27B, turned out to be the best. As a reviewer it was right 32 times out of 33, and as an auditor on small test apps it found 24 of 24 planted flaws and reported nothing on the clean app. It also makes tool calls, which not every model can do. One model I tried writes out the tool call as text and nothing ever runs it, and another described a plan and never called a tool at all. A model that does everything acceptably is worth a lot on 16 GB, because the same model can take several roles and nothing has to be swapped in and out of memory.
Here is the rest of what I tried, each in one line:
- Qwen 3.5 9B: too weak to find vulnerabilities, but it holds a 64K window on this card, which makes it the one I use for reading and research.
- Qwen 2.5 Coder 14B: named the right bug class, never fixed it, and cannot make tool calls.
- Qwen 3 Coder 30B: makes tool calls and sometimes writes the right fix, but as an auditor it looped until the time ran out in 5 of 9 runs.
- Gemma 12B: as a reviewer it kept generating until the deadline about half the time.
- Devstral 24B: described a plan and never called a tool.
The samples for the models I dropped early are small, so read those lines as what I saw and not as a ranking.
Research, uninterrupted
Online research is something I wanted in the pipeline from the start, because I like to explore ideas, especially in security. For example, I was researching QR codes: what the attack vectors are right now, if there are any, and what patterns have been used. On a hosted model that kept getting blocked, even though I was only trying to learn.
Locally, the research role runs on Qwen 3.5 9B with the 64K window. It searches the web and reads pages from inside the harness, and it does not get interrupted. The answers still need checking: on one test it described a known vulnerability as the wrong kind of bug and named the wrong fixed version. So it finds the sources without stopping, and I read the sources.
The pipeline, one step at a time
Here is the pipeline I have today. Each step is a fresh model session with one job:
- The scout reads the code and reports what is relevant.
- The planner decides what to change.
- The engineer makes the change.
- The reviewer reads the result and says yes or no.
If the answer is no, the change goes back to the engineer with the reason, and it cycles until it passes or it hits the cap. The cap is 2 attempts right now. In my tests the yes or no that counts comes from a hidden set of checks the model never sees, and the reviewer’s opinion is recorded next to it. More on why in the patching section.
I think it is worth giving each step a decent, well defined role. But with smaller models and smaller context windows there is not much choice anyway: the work has to be sliced up. The clearest proof I have is this. I gave a small model 17 questions about a set of documents in one long session, and it got 4 right. I gave the same model the same 17 questions one at a time, each in a fresh context window, and it got 16 right. I had also tried 3 different harness settings on the long session before that, and none of them helped.
So a small model with a small window needs small jobs. And it means a model is not simply good or bad. How you hand it the work changes a lot of what comes out.
That makes the real question which steps to split apart, and where a split is actually needed. Splitting is not free. The one-question-at-a-time run took about 2.5 times as long, and every hand-off is a place where something can get lost. Split too much and the steps become redundant, when what you want is for each model to do as much as it can on its own, right up to the point where it starts falling apart. I have not found that point yet. So far I have only measured the two ends: everything in one session, and one small job per session.
What I am aiming for
These are things I want to test, benchmark and explore. None of them is guaranteed to make the pipeline better or more efficient.
- Workers in parallel. The design I am following fans the work out to several workers at once. On 16 GB only one model fits at a time, so everything runs in sequence, and using 2 different models means a reload every time they swap.
- More tiers. A fast model sweeps everything, and each tier above it gets a smaller scope and a stronger model.
- A reviewer I can trust. Right now the hidden checks are the authority, and those only exist because I wrote them for the test cases.
That being said, I want to keep the limit. I want to squeeze as much juice out of the lemon as possible, meaning the best workflow and pipeline I can build with this amount of VRAM. The easy fix is obvious: get more VRAM and run bigger, stronger models. But that is beside the point of what I am doing here. This is a challenge I set for myself, and these kinds of puzzles are fun to explore.
Why I started with patching
The real goal of the local setup, for me, is offensive research: finding attack vectors in code, in setups, in networks. Patching is not the goal. But it was a really good place to start benchmarking, because finding a problem is one thing and fixing it is another, and a test that asks for both tells you a lot about a model.
The very first test was exactly that, on a bug someone else had already found: a published vulnerability in a small JavaScript package. Could the model find it, and could it write a fix that actually closes it? The 9B never named the bug. The 14B named it and never fixed it. The 30B got to a working fix on its second try, once it was told its first one was still exploitable.
That test gave me the rule I have kept since: the tests are the judge, not the model. A fix counts when the exploit stops working and nothing else breaks, and the model never sees that check.
From there I moved to small Python apps built for the purpose, each with a bug report and a hidden check:
- On 5 bug cases, 3 runs each, the best mix of models passed 13 of 15.
- When I gave the pipeline its own audit findings to fix, it closed all of them 6 times out of 6 without breaking anything.
- One rule in the prompts made a real difference: fix the cause, not the symptom. One case went from 1 of 3 to 3 of 3.
The reviewer is the weak part. Every model approved a broken patch at least once, and the best one once passed a fix that the hidden check caught.
The limit is that apart from that first test, all of the patching was on small apps made for testing. Patching real code is not tested yet. Some of these numbers are also from before I fixed the folder name problem described under traps, and have not been rerun since.
Finding vulnerabilities in real code
This is the real goal. The end point of all of this is a pipeline I can use to find vulnerabilities and problems in code.
To measure how close it is, I use a CVE benchmark. I took 7 published vulnerabilities in Python packages, and for each one the file as it was before the fix and the file after. The question for the first file is “does it find the flaw”, and for the second “does it leave the fixed code alone”.
Whole files did not work. Past about 250 lines the model mostly gave no answer: it thinks until the window is full, the harness compacts, and it starts over. Giving it more time only added loops. What worked was cutting each file into slices of whole functions, about 150 lines each, one session per slice.
With slicing, 3 runs per file:
| Package | Right flaw found |
|---|---|
| Babel | 3 of 3 |
| MechanicalSoup | 3 of 3 |
| NiceGUI | 3 of 3 |
| Starlette | 2 of 3 |
| tqdm | 2 of 3 |
| cookiecutter | 0 of 3 |
| requests | 0 of 3 |
- Total: 13 of 21. On the fixed files it repeated the old complaint 1 time out of 13.
- The Starlette and tqdm misses were sessions that ran out of time before answering. When the session finished, the flaw was found every time.
- cookiecutter is a warning about scoring: it flagged the right function twice, for a different reason.
- requests was never found, in 21 tries across every setting. Seeing it needs knowledge of how proxies and TLS tunnels behave, and the model read the function and called it safe.
Limits: about 1 session in 4 runs out of its 8 minutes. These are public vulnerabilities, so the model may have seen them in training. And the model reports other things in these files that I have no answer key for, 56 of them, which I have not judged.
One part of this pipeline does not work correctly at the moment: the second opinion. I tried having the model check its own findings, as in here is a claim, here is the code, is it real? I tried it 5 ways. It catches factual mistakes, but it accepts most of what it is shown, and it threw out 4 of the 13 correct findings. The same claim checked twice can get 2 different answers, and lowering the temperature did not change that. So for now the check is a label on a finding and not a filter, and every finding has to be read by a person.
So is this usable on real targets? Honestly, it is up in the air. I have not had the chance to test that, and we are still far from it. What these numbers show is where the setup stands on known flaws in public code, and that is all they show.
Traps that cost me time
The folder name gave away the answer
This one is really interesting. The harness shows the model which folder it is working in, and my test cases lived in folders with names like “audit-clean”. The model noticed. In its reasoning it wrote that the benchmark was called clean, which suggested the answer was clean, and it did that in 10 of the 18 sessions I looked at.
After I moved every test into a folder with a meaningless name, the results changed. The app with nothing wrong in it had been reported clean 6 times out of 6. Without the hint it was 4 out of 6.
That taught me I need to learn more ways to sanitize my benchmarks, so that nothing around the task gives away free information.
The model was spilling to the CPU because of my setup
This is the context size mistake from the setup section. Nothing was broken, everything just ran slowly, and it was my configuration that caused it.
The common thread
Most of the problems I hit came from the setup, or from what I was handing the model, and not from the model. That seems to be a common thread with LLMs in general: context is almost everything. The same model gives wildly different results depending on whether it was given the right context and information.
So make sure your benchmark setup is really doing what you think it is, and that you are testing what you want to be testing. Some of my runs take hours. More than once, a simple mistake in the setup or in how the test was run made those hours useless. One full run recorded nothing but zeros because the model server was not running. Another counted every session that ran out of time as “found nothing”. A short run of a few cases would have shown the problem in 40 minutes, before I let a 3 or 4 hour run go through. That can suck sometimes.
Smaller ones
- A plugin replaced the harness’s web search with one that always failed, and every setting I changed for a day was irrelevant.
- Setting thinking to “low” did not shorten the thinking.
- A temp-folder cleaner deleted files in the middle of a run.
What comes next
Here is what I want to explore next:
- Memory for the harness: RAG, an LLM wiki, or something else.
- Web research: the harness uses Parallel today, and I want to compare it with Firecrawl.
- Letting the model spill into RAM, to see what a bigger model buys and what it costs in speed.
- Running the audit on code the model cannot have seen.
- Patching real code, not just test apps.
Just knowing that this kind of work can be done locally, uninterrupted, is a big bonus for me. If anything, it has shown me that I want a proper local pipeline for all the work I currently do with Claude. Claude is really good for a lot of things. But it is also fun to have an in-house setup I can call on for anything that gets blocked, and that I can have confidence in, or at least use to its full potential.
And if there is one thing I would want a reader to do, it is to explore, in tech or in whatever your interests are, and to try bringing AI into how you work and learn. There is a lot of fear around it, and it will have very large consequences. I still think the sooner you start using it and adapting it to your own needs, the more you gain.
Some people keep away from it because handing work to something else feels like the work is no longer theirs. I share part of that. Ask an AI for a 200 page book about dragons and magic and you will get 200 pages, and it will be garbage, because there is no creativity behind it. When it comes to the arts I will always prefer the mistakes of the human element.
But for dense subjects like engineering, math, languages and anything academic, it is a great learning tool, as long as you do not offload the learning itself. I already had a lot of IT knowledge from my background, and AI still pushed me to another level.
If you have tried something like this, I would like to hear what you found: the models, the harness, the specific tasks or questions you give them, and what broke. And if you are just starting out with your own local models, I hope this saves you a few of the pitfalls. All feedback and suggestions are welcome.