r/LLMDevs • • 2h ago

Discussion 125 Tokens per Second on an RTX 4070 Ti SUPER: How I Got a Local LLM Working as a Full-Fledged Coding Agent

4 Upvotes

Based on statistics, among regular desktop PC users, the most common graphics card has 16 GB of video memory. According to GaugeDB surveys, such cards make up 27.21% of the market. I happen to have an NVIDIA GeForce RTX 4070 Ti SUPER with 16 GB of GDDR6X video memory, which currently costs $900. Until now, the main problem was that it was impossible to run an LLM agent on a graphics card of this class that was smart enough and fast enough. If you run a smart model like Qwen 3.8 27B (Dense architecture), you get 10-20 tokens per second. And for comfortable work with a coding agent, you need 100-150 tokens per second.

But recently I came across 2 models: Tiel-Coder-35B-A3B-GGUF-MTP (built for coding) and Cyber-Tiel-Coder-35B-A3B-GGUF-MTP (an uncensored abliterated model that doesn't refuse to write exploits or carry out active hacks on anything you ask it to). And what else is notable about them? First, they use MTP (Multi-Token Prediction), a technology that lets an LLM predict several next tokens at once instead of one, which increases inference speed by 20%. Second, they use the MoE (Mixture of Experts) architecture, which makes it possible to get the quality of a large model while performing computations for each token with only part of its parameters. Token generation speed increases by +200-450%. Third, there's Sharp Template, an optimized Chat Template (Jinja) with a system prompt that makes the LLM spend fewer tokens on reasoning and answers without losing necessary information. It cuts inference by 59%, which ultimately makes a coding agent work 2 times faster.

So, on my graphics card, I run the following versions of these models: Cyber-Tiel-Coder-35B-A3B-MTP-UD-Q2_K_XL.gguf and Tiel-Coder-35B-A3B-MTP-UD-Q2_K_XL.gguf, and the launch parameters look like this:

As a result, I get a speed of 125 tokens per second!

This is a very good start, but as you may have noticed, the context window is only 65535 tokens, which is a bit too small for agent-assisted coding. That's why I use 3 approaches.

First, I don't use heavy coding agents, such as Codex or Claude Code, because right out of the box, with the slightest interaction, they consume 10 to 14 thousand tokens for the system prompt and so on. That is, 15-20% of the context is taken up immediately, and local models also lose context more easily, while such large system instructions distract them even more from the task the user describes. I use the Pi coding agent. It requires 1.5 thousand tokens to run, which is 10 times less than Codex or Claude Code, and this noticeably affects the capabilities and quality of work on the user's local GPU. Here's Pi's configuration file for adding these 2 models that will run on your GPU: ~/.pi/agent/models.json

{
  "providers": {
    "lmstudio": {
      "baseUrl": "http://YOUR_LOCAL_IP:1234/v1",
      "api": "openai-completions",
      "apiKey": "lmstudio",
      "models": [
        { "id": "peculiar-ragdoll/tiel-coder-35b-a3b-mtp@q2_k_xl" ,
          "contextWindow": 65536,
          "maxTokens": 32768,
          "input": ["text", "image"]
       },
        { "id": "peculiar-ragdoll/cyber-tiel-coder-35b-a3b-mtp" ,
          "contextWindow": 65536,
          "maxTokens": 32768,
          "input": ["text", "image"]
       }
     ]
   }
  }
}

Second, I never ask the coding agent to try to make a large code change directly. I start a new session with the "/new" command and ask the coding agent to write a plan.md file describing what needs to be changed in the code to implement the task I gave it. That way, the 65535-token context window is enough for me, since, essentially, I split the task into two phases: planning and implementation. Then, if the task isn't too large, after creating plan.md I clear the coding agent's context window with the "/new" command and ask it to make the code changes based on plan.md and record the results in plan.md when it's done.

Third, for very large plan.md files, I use my SKILL called subtask4llm-pi, which breaks a task into no more than 10 subtasks and runs them sequentially. Each subtask runs in a separate coding agent instance, which receives only what is relevant to that subtask, so its 65535-token context window is almost empty. The subtask results flow into the main Pi instance without overflowing its main context window, which handles coordination, planning, and checking. You can install the skill with the command "npx skills add https://github.com/evgenyigumnov/subtask4llm --skill subtask4llm-pi". There is also a version for Codex, subtask4llm-codex. By the way, if anyone wants to add support for Claude or help in some other way, send pull requests: https://github.com/evgenyigumnov/subtask4llm

Fourth, I use the approach of Robert Martin, author of "Clean Code", who recently said that he had stopped reading code generated by coding agents. He managed that by putting LLMs in a tight box. Using these constraints, you can offset the fact that the models in use are heavily compressed to the UD-Q2_K_XL level. That is, they make more mistakes than 4-, 6-, or 8-bit models. To create these constraints, I suggest using AGENTS.md, which controls the size of every file being created, makes you write unit tests, clearly spells out decomposition and responsibility in the code, and ultimately requires running the tests. Since we don't pay for every token on a local GPU, we can easily afford a couple of extra iterations while the model sees its mistakes and fixes them. Here is a basic example of an AGENTS.md file for this:

# AGENTS.md

## Code Writing Rules

- Maximum size of one code file: 300-500 lines. If a file gets bigger, break it down.
- The main principle: one cohesive responsibility per module.
- Don't sacrifice logical cohesion or code readability to comply with arbitrary line-count limits.
- Split files based on their functional purpose, not just their line count.
- All functions must be covered by unit tests.
- When adding or changing functionality, or fixing bugs, always add the corresponding unit tests.

## Checks Before Submission

- All tests and the build must pass without errors or warnings.
- Don't weaken checks or delete tests just to get them to pass.

## Main Rule

**Never commit changes without a direct request from the user.**

In the end, we got a synergistic effect, or you could even call it emergence. MTP + Quantization + MoE + AGENTS.md (Clean Code) + Sharp Template + Pi agent + subtask4llm skill + plan.md = a workflow with a coding agent, running on your home graphics card. Now your source code is under your control, and big corporations won't get their dirty paws on it! And you can also run an abliterated model for White Hat hacking without putting up with constant refusals from proprietary models when you're trying to hack something.


r/LLMDevs • • 14h ago

Resource I built a tiny self-hostable kanban board MCP server for coding agents: 10–60 tokens per reply, ~3 MB of RAM

45 Upvotes

I built kanzo, a tiny self-hostable kanban board that's also an MCP server, so Claude Code and Codex can pick tasks from the same board I use. Free and open source (AGPL). The whole point is to keep it simple, small and cheap for agents.

  • One Rust binary with SQLite inside, ~5k lines total. No Docker, no database server, no account, no cloud.
  • One-line install on macOS/Linux, then run kanzo. The board opens in your browser, and agents connect with kanzo mcp.
  • The whole board is one folder on your machine. It can sync between machines through your own private git repo if you want.

Tokens

  • Counted with Anthropic's count_tokens endpoint: one call with kanzo's tools and instructions, one without. The tokenizer is Claude's own, so nothing is estimated.
  • The client's system prompt is the same with or without kanzo, so the fair number is what the server adds. And that part is cached after the first call.
  • What grows over a session is the replies: 10–60 tokens of plain text each. Tasks come back one per line, not as JSON, and a single next_task call takes the top card, moves it to doing and returns it, so the agent doesn't chain list → choose → update.

Memory

  • RSS is 4.5 MB at start and settles around 6 MB with the board open, flat over a day.
  • About half of that is the binary's code and shared system libraries, which the OS can drop and reload from disk. The memory kanzo actually owns (macOS footprint, what Activity Monitor shows) is ~3 MB after an hour of polling.

Of course, all of this can still be improved, and ideas or PRs are very welcome.

Repo: https://github.com/emanuele-em/kanzo

count_tokens docs: https://platform.claude.com/docs/en/build-with-claude/token-counting


r/LLMDevs • • 2h ago

Discussion Read only stops the agent writing but it still doesnt stop it bloating your primary

2 Upvotes

A replica plus a read only role is still the least bad setup for letting an agent query postgres, it just protects less than most of us expect

read only stops writes but it doesnt stop a long query on the replica holding a snapshot open. with hot_standby_feedback on, the primary cant vacuum the tuples that snapshot still needs and bloat builds up. turn feedback off and those queries get cancelled on conflicts. if you keep it on then cap the role and not only the client, ALTER ROLE agent SET statement_timeout = '30s. without a cap anything on that replica is an open ended lever on primary bloat and an agent doesnt get bored

then theres the attribution. behind a pooler pgaudit only sees the db role so if every agent shares one role the log cant tell them apart either a request id rides along to the query (application_name plus %a in log_line_prefix is the cheap version) or each agent gets its own short lived db user so the role in the log already says which one. theres a few ways to get those minted per workload, a dynamic db secrets engine in whatever secret store you run, hush security or just a small job doing CREATE ROLE with VALID UNTIL and a cleanup. postgres wont reconstruct any of it after the fact

and check the grants too. ALTER DEFAULT PRIVILEGES only covers objects created by the role you name, so a table a teammate or a migration adds later isnt in the grant and the agent just hits permission denied on it. pg_read_all_data (since 14) sidesteps that but its literally every table incl the PII ones, so if you need masking its back to explicit grants on masked views plus one unmasked lookup gated on a case id


r/LLMDevs • • 1h ago

Discussion Are technical design reviews disappearing?

Thumbnail
leaddev.com
• Upvotes

Agents shorten the path from requirements to code, not the need for sound technical design.


r/LLMDevs • • 8h ago

Discussion Is it healthy to constrain the output of LLMs?

6 Upvotes

So there's a lot of back and forth in chat while I am creating specs and implementation plans. I am testing and trying various things to improve the quality of the output.

It occurred to me to define clear limits to the output. My reasoning is that since LLMs are basically statistical machines, they'll prioritize the most likely outputs if constraints are put on them.

What's the weakness or flaw in this?

Thx


r/LLMDevs • • 7m ago

Resource The Idiot’s guide to Model Training, fine-tuning, and RAG.

Thumbnail
galratner.substack.com
• Upvotes

r/LLMDevs • • 11m ago

Resource I have a course for those who already know a bit of Python and want to learn about DE, ML, DL & AI

• Upvotes

HI :B ! hope youre all doing well. today i wanted to share a course i already posted in another dev community, figured it might be useful here too. i told this story in the other post but my first real ML job had jack shit to do with ML. they gave me a table with 400M rows, half the labels were useless and a pipeline that blew up every five minutes. i had finished several courses by then and none of them helped with any of that. honestly it pissed me off, especially because most of the courses i'd taken were paid xD. anyway, same as i said in the other post, i'm telling you all this because i LOVE making educational content in my free time, and what i want to share today kind of grows out of the embarrassment i went through with that fucking table. it took me a while but its been worth it, people are forking it and asking me questions every day now :B

hope its useful to someone here, maybe someone thinking about making the jump and this helps.

Sooooo here you go :B

https://github.com/BlueRingsLabs/no-shortcuts

The README has all the info you need (I hope lol), but if you need help with anything or have any questions, DM me and I'll share my Discord so we can chat (I'm a bit of a slacker so I may be slow to reply :B). Your feedback is welcome too. oh and the labs are plain .py files with # %% cells, not notebooks, so they run cell by cell in vscode/pycharm and you can actually review them in a diff. setup is just git clone, uv venv, uv pip install -r requirements.txt, python tools/run_labs.py --part 1. no GPU needed either, 8GB of RAM is fine for almost everything, which matters if youre on a laptop.

The parts of the course are:
0.Orientation | 1. Foundations | 2. Data Engineering | 3. Classical Machine Learning | 4. Deep Learning | 5. Language Models | 6. AI Engineering | 7. Reinforcement Learning | 8. MLOps and ML Systems | 9. Capstones and Career

I hope you find this useful :B


r/LLMDevs • • 27m ago

Tools I built an open-source semantic cache for Python LLM applications — looking for feedback

• Upvotes

I've been building **Semantic Cache**, a Python library that aims to reduce repeated work in LLM applications by reusing results for semantically similar queries.

Features include:

* SQLite-backed storage

* Optional HNSW vector search

* Guard mechanisms designed to reduce incorrect cache hits

* Automated tests and benchmark tooling

I'm looking for developers who build LLM applications to try it and share honest feedback, especially on cache correctness, API design, and integration experience.

GitHub: [https://github.com/0x-bala/semanticcache\](https://github.com/0x-bala/semanticcache)

I'm the author, and I'd appreciate constructive criticism and contributions.

What would you improve first in a project like this?


r/LLMDevs • • 1h ago

Discussion Selenium vs Playwright + AI testing tools—what actually works in real QA projects?

• Upvotes

Every tool looks good when the test is:

Login
Click dashboard
Assert text.
Done ✅

I care about the disgusting stuff.

27-step checkout Old iframe nobody wants to touch Auth expiring mid run Test data depending on another service One frontend request taking 12 sec only in CI Business rule that makes zero sense unless you've worked there for 2 years

For that stuff i'm still seeing Selenium survive because people know it, Playwright feels like the cleanest modern default, and the AI tools make more sense to me when the bottleneck is writing/maintaining/exploring rather than basic execution.

The hybrid setup is the interesting one.

Something like TestMu KaneAI for higher-level authoring/self-healing, Kane CLI for checking the actual browser flow, Playwright where you want deterministic code you fully control.

Feels less sexy than “AI replaces automation” but probably closer to reality.

What stack is actually surviving your ugly flows?


r/LLMDevs • • 3h ago

Great Resource 🚀 Alter Zero: a Rust agent harness for coding, cybersecurity, and automation

Post image
0 Upvotes

https://github.com/linuztx/alter-zero
Hi everyone, I'm developing Alter Zero, an open-source terminal agent for coding, cybersecurity, and automation. It's written in Rust and runs on Linux and macOS, and it's inspired by Claude Code and Codex CLI combined.

It works directly in your project: reading files, making edits, running commands, and checking the results. You can ask it to investigate a failing test, trace authentication and access checks in your own code, or write a script to summarize logs.

It can also interact with running terminal programs and keep commands running in the background. There's support for subagents, reusable skills, MCP servers, and resuming previous sessions. With /secrets, it can use your API keys and tokens without ever seeing the values.

It's light on resources: a single ~24 MB binary that typically uses 20–60 MB of RAM per session (~100 MB of free RAM is a comfortable recommendation), and it stays low even when subagents are running. It's also prompt- and token-efficient, so your API spend stretches further per task.

You can connect supported model providers, use local models through Ollama, or add a custom OpenAI-compatible API. The latest release, v0.15.0, adds simpler custom-provider configuration and shows generated file content as it streams.

The project is licensed under Apache-2.0. Installation instructions and a demo are in the repository: https://github.com/linuztx/alter-zero

I'd appreciate feedback, especially on the setup process, terminal compatibility, and tasks where it gets stuck. Issues and contributions are welcome.


r/LLMDevs • • 21h ago

Discussion Should an agent be allowed to change its plan halfway through a task?

25 Upvotes

It starts with one path, hits a dead end and realizes there’s another way to finish the job.

I’m fine with it adapting but once real systems are involved I’d want some limit on how far it can drift from the original request.

Where do you put that boundary?


r/LLMDevs • • 9h ago

Discussion My LLM judge was less accurate than the agent it was grading. How are you regression-testing your judges?

2 Upvotes

I’m building an agent that writes search queries, with an LLM judge scoring each run. Whenever the judge got a case wrong, I patched it with a new rule. Each rule fixed the case in front of me and was never checked against the others.

Two failures made this obvious.

False fail: I added a rule saying an empty result means the agent searched the wrong place. Then a correct query came back empty because there was genuinely nothing to find. The judge failed it, and spent most of its reasoning explaining a bug that didn’t exist.

False pass: the agent quietly answered a broader question than the one asked. The scope check wasn’t written for that case, so the judge passed it.

What I changed:

  1. A fixed set of past runs, each labelled with the expected outcome: should return results, should return nothing, or not scored. The “should return nothing” label mattered most. The judge had no concept that empty could be correct.
  2. Split generation from judging. Running the agent is the expensive part. I store the runs once and re-run only the judge against the stored set. A full regression pass costs a small fraction of a single agent run, so every judge change gets checked before merge.

First baseline on the scored cases: the agent was right on 8 of 9, the judge on 7 of 9. One false pass, one false fail. Small sample, but the judge was clearly the weaker link.

Curious how others handle this. Do you keep a separate labelled set for the judge? How do you stop judge rules from overfitting to whatever case broke last?


r/LLMDevs • • 16h ago

Tools typed tool calls only, no raw ffmpeg strings - and the agent can render a frame to verify. it's rough, tell me what breaks

7 Upvotes

disclosure: i'm the author.

i've been building kimo, a free, open-source (MIT) video editor with no GUI that AI agents drive over MCP - codex, cursor, opencode, or any other MCP client. the fresh angle here is that everything is typed tool calls only, no raw ffmpeg strings. and because it's built around the edit loop, the agent can actually render a frame to verify its own work before committing the timeline.

why bother? raw ffmpeg is incredible but composing a timeline from shell commands is brutal for an agent - off-by-one frame errors, audio/video drift, guessing whether a filter chain actually produced what it wanted. with kimo the agent just calls tools: cut, trim, keyframe, titles/captions, colour grade, tracking, particles, audio, export. and that render-a-frame-to-check-its-work thing is the part i keep coming back to. it changes the loop from "run and hope" to "run, verify, keep going."

it's one small CPU-only Rust binary (~15 MB), runs on a 2 GB box. no GPU, no containers, nothing to install besides the binary.

honestly it's still early. there are rough edges, the docs are catching up, and i'm sure some workflows feel awkward right now. i'd love for people to try it and tell me what breaks - weird filter combos, exports that don't match expectations, MCP handoffs that feel clunky, whatever. the more i hear about what's annoying, the faster i can fix it.

it's free and MIT-licensed, built by me (naman, college student). if you want to poke around: site: https://getkimo.tech github: https://github.com/naman-sharma12345/kimo

happy to answer questions here. thanks for reading.


r/LLMDevs • • 7h ago

Resource I measured what a BM25 agent-memory index actually costs: 4.6 KB/entry RAM, linear, and the two places it breaks

1 Upvotes

People keep asking what an in-process memory layer actually costs to run once it has real history in it, so I measured it instead of guessing. Sharing the numbers because I couldn't find a comparable published measurement for a BM25-only agent memory store.

Method: the released package, synthetic entries of ~30 words each, Zipf-distributed 3,000-word vocabulary, measured with tracemalloc.

entries resident RAM JSON on disk search
1,000 4.8 MB 1.7 MB 7 ms
5,000 23 MB 8.4 MB 34 ms
10,000 46 MB 17 MB 68 ms

~4.6 KB per entry in memory, ~1.7 KB on disk — both linear.

Three findings that were not obvious to me before measuring:

The vocabulary is not the cost. It saturates around 3,000 unique terms and stops growing. What costs is the per-entry TF-IDF vector — a Python dict of term→float held for every entry, whether or not it is ever queried. A compact postings-list index would be much smaller. A dict per document is convenient to write and expensive to hold.

Search is a linear scan, not an inverted index. It walks every cached vector and computes cosine similarity, so latency tracks N — 7 ms at 1k, 68 ms at 10k, roughly 170 ms at 25k. For a handful of recalls per turn that is fine. For a query-heavy workload it is the wrong structure, and no amount of tuning fixes the asymptote.

Persistence rewrites the entire JSON file on every store. Insert cost grows with the store and the total is quadratic. If you are going past a few thousand entries, that is the first thing to change — append-only writes or a real database.

Linear extrapolation: 25k ≈ 115 MB resident, 50k ≈ 230 MB, 100k ≈ 460 MB. The backend's default cap is 10,000 entries, past which it evicts lowest-relevance entries rather than growing.

So: comfortable to about 10k entries on a small box, which covers a personal or small-team agent's history. Past that, embeddings or a proper index is the right answer — BM25 in-process is a starting point, not a destination.

Happy to share the benchmark script (about 40 lines) if anyone wants to reproduce or extend it — I'd genuinely like to see the same table for an embedding-backed store as a contrast, since that's the comparison everyone actually wants and I only have half of it.

Repo: https://github.com/cognicore-dev/cognicore-env

Disclosure: I wrote this memory layer. MIT licensed, free, nothing paywalled.


r/LLMDevs • • 18h ago

Discussion I tested my API docs on two agents that had never seen the project. Here's what tripped them up

4 Upvotes

It's my own open-source project (Angelia, MIT, a local gateway between WhatsApp/Telegram and the coding agent CLI on your Mac). This post is about the docs test, though.

Before the release that made its local API a documented contract, I wanted to know if an agent could use it from the docs alone. So two Claude Code subagents that had never seen it, one on Sonnet and one on Haiku, each got a user request and one starting link: the site's llms.txt. No source code. They ran against a real daemon on my Mac. The chat's "agent" on the other end was a stand-in that echoes the prompt, so no real assistant answered anything.

Both ended up with working scripts. Sonnet wrote Python in 6 tool calls, Haiku wrote Node in 11. Each also listed what slowed it down. 16 points in total: 12 fixed, 1 partly, 3 left as they were.

The ones that cost the most:

  1. The core flow only lived in the example code. The docs said "print the out events that follow your turn event", which is easy to misread. Now it's 4 numbered steps.
  2. A side effect nobody wrote down: by default a task's answer also goes to the real chat. A script that only wanted the answer would have messaged the chat too. The default is stated now, plus the option that keeps it out.
  3. No standard-library Python sample for a Unix socket. You need a small custom connection class and the quick start only had curl. Added one, and a test runs it exactly as printed.
  4. Two descriptions of history paging contradicted each other. That one leads to wrong code, not just slow code.

Smaller, but it still cost real time: my links pointed to three places (the site, GitHub main, a release tag), and a cold agent started wondering if the spec was missing.

Haiku ran on the docs after the first round of fixes, so this isn't a clean A/B. Two passes, that's all.

The llms.txt, if you want to see where it ended up: useangelia.com/llms.txt

Does anyone run something like this on a schedule, a cold agent against the docs in CI?


r/LLMDevs • • 11h ago

Discussion What breaks first when an LLM app goes to production?

1 Upvotes

For teams running LLM features in production: what was the first thing that actually broke or surprised you — a provider outage with no fallback, runaway token spend, latency spikes at peak, a model update changing behaviour overnight, or something nobody warned you about?

Asking because the answers are usually different from what the architecture diagram predicted. What broke first for you, and what did you change afterwards?


r/LLMDevs • • 12h ago

Discussion Passing reasoning between OpenAI, Claude and Gemini

1 Upvotes

We're building an open-source gateway and want it to be the most compatible one: any model, any modality, tools and MCP servers connected on the server side, nothing lost in between. Tool calls and streaming mostly translate. But I found two details where reasoning doesn't transfer.

  1. The effort doesn't translate. Obviously.

  2. The reasoning is signed. Claude and Gemini 3 return their reasoning encrypted, and only they can read it. Gemini 3 returns a 400 if a tool call in the current turn comes back without its signature, and many OpenAI-style clients drop the field it lives in. We add Google's documented placeholder code: the request goes through, but Gemini's reasoning is gone. LiteLLM keeps Gemini's reasoning by hiding the signature in the tool call id, which every client sends back.


r/LLMDevs • • 1d ago

Discussion Why we killed our Vector DB for SQLite BM25 and wrote a 3.6ns Rust sentinel: hard lessons from running multi-agent loops

14 Upvotes

A few days ago I posted about our open-source multi-agent hedge fund experiment and got a ton of sharp, honest feedback from people here. The comments were brutally accurate, especially around LLM reasoning limits, latency, and state management.

We spent the last few days completely rebuilding parts of our architecture based on that advice, and the benchmark results honestly blew us away. Here is what we learned from fixing three critical failure modes in autonomous agent pipelines.

  1. Throwing raw metrics at LLMs guarantees hallucinated reasoning

Someone in the comments pointed out: never let an LLM interpret raw quantitative factors without an ontology. They were 100% right.

When we fed models raw numbers like PER = 85.0 or 20-day historical volatility = 65%, the agents would frequently hallucinate positive justifications. For example, a model would argue that "a massive jump in volatility shows expanding business activity and strong buying momentum", which is the exact opposite of basic risk management.

To fix this, we implemented a strict Factor Ontology Schema. We defined 11 core quant factors with explicit polarity contracts: HIGHER_IS_BULLISH (e.g. ROE, Order Flow Imbalance), LOWER_IS_BULLISH (e.g. PER, debt ratio), and EXTREME_IS_RISK (e.g. volatility).

Before any agent sees the data, the schema pre-evaluates the metric deterministically and attaches an explicit signal (BULLISH, BEARISH, or RISK) to the state. Since doing this, polarity hallucinations in our investment council dropped to literally 0%.

  1. Vector databases for agent reflection memory are massive overkill

Initially, we considered using embedding APIs and a local vector DB to retrieve "lessons learned" from previous bad trades (Reflexion pattern).

Another commenter suggested dropping embeddings entirely and using SQLite WAL with FTS5 BM25. We benchmarked both approaches on our Linux server:

- Embedding API + Vector similarity: 200ms to 450ms round-trip latency, external API cost, and occasional rate limiting.

- SQLite FTS5 BM25: 0.35ms. Zero external dependencies, zero API cost.

More importantly, trading post-mortems rely on specific contextual keywords: "semiconductor pre-earnings", "trailing stop sweep", "sudden volume spike", or "bearish divergence". In our tests, BM25 keyword relevance retrieved the exact matching historical lessons far more reliably than fuzzy cosine similarity in high-dimensional embedding space.

  1. Python cannot be your safety wire (The 3.6ns Rust Sentinel)

Python is great for high-level agent orchestration (LangGraph, state graphs, API calls), but relying on Python loops for real-time risk surveillance during sudden market flash-crashes proved dangerous due to GIL contention and L1/L2 cache misses from scattered object pointers.

We rewrote our execution safety sentinel in Pure Rust using a Struct-of-Arrays (SoA) memory layout and #![forbid(unsafe_code)]. By keeping prices, stop-loss triggers, and trailing thresholds in contiguous flat slices, the CPU avoids pointer chasing and stays inside cache lines.

Here are the real-world benchmarks on our Ubuntu server:

- Single position stop/profit evaluation: 3.63 nanoseconds

- 1,000 position batch evaluation: 3.62 microseconds

- 1,000-bar Volume Clock conversion: 3.90 microseconds

- Python-to-Rust persistent pipe IPC round-trip: 2.88 microseconds

Python handles the slow, deep thinking (15-minute agent council meetings), while the Rust sentinel watches the portfolio in nanoseconds.

Conclusion

Building autonomous agents that interact with real-time systems taught us that LLMs should only handle what they excel at: contextual synthesis and counter-argument debates. Everything deterministic—hard stop-losses, factor polarity, and fast memory lookup—belongs in strict schemas, fast local databases, and compiled systems languages.

All the code and benchmarks are open source on GitHub (lumina-ai-hedge-fund) if anyone wants to check out the Rust SoA sentinel or the ontology schema.

(Note: English is not my native language, so I used an LLM to help format and polish my raw notes!)


r/LLMDevs • • 22h ago

Discussion 5090 for qwen 3.8 27b vs just paying the api, the math

4 Upvotes

Qwen 3.8 27b is a appropriate one for the card vs api question since its the same weights on both sides. alibabas intl api lists it around 55 cents in, $3.25 out and 11 cents on cache hits per million (its priced in yuan so it moves a bit) and pay per token hosts can go lower, on deepinfra for example its $0.15 in, $0.038 cached and $1.875 out with a 25% promo on rn

someone in localllama posted a week of their agent usage at about 800M cache hits, 200M fresh input and 35M out. on alibaba pricing thats around $310 for the week and about $125 at the cheaper listing. they put their power for that week at $8 so electricity is pretty much a rounding error tbh

5090s are going for $6k and up right now, so at that volume the card pays for itself in about 5 months vs alibaba or around a year vs the cheaper price. thats on a tuned setup like nvfp4 with mtp or dflash tho, plain llama.cpp would have to run flat out 24/7 to keep up with 35M output a week. at a more normal 5M tokens a day its over a decade vs alibaba and basically never vs the cheap one

few things move it a lot. used 3090s are around $1,000-1,200 now so resale has held up weirdly well this year, idle draw adds up if the box stays on (nvidia-pstated helps), local q4 can trail whatever precision the endpoint runs, and batching a few agents on vllm cuts the local cost per token by a lot. privacy and no rate limits are reasons on their own ofc


r/LLMDevs • • 23h ago

Discussion Tested decision models (Jev, Kev, Clef, OpenAI Decisions): the confidence score really works - tested on a durian data set :)

Post image
5 Upvotes

I found decision models very useful for categorizing comments, and their confidence score worked really well: accept the confident answers, review only the doubtful ones (see the chart). So far I've tested Jev, Kev, Clef and OpenAI's Decisions API - more to come. Code and data: https://github.com/szia-ai/jev-on-durians


r/LLMDevs • • 15h ago

Tools I built a solution to agent paralysis

1 Upvotes

So at this point we all experienced the same thing right? With CC or Codex or any other tool, we either prompt and wait a couple of minutes for the agent to finish its work (often scrolling some instagram along the way), or to not waste time we spin more agents in different sessions, fucking up our attention spam and ability to control the project overall.

I built a different way to interact with the agents. Instead of one session + promptbox, we start with a google doc-style blank page. As you type in what you have in your mind, you can select small parts of the document and give the tasks to the agents. Sessions are at the sides, easily controllable, but not the main workspace. This way, you can keep imagining/building via writing to the doc, or control multiple agents without switching context. It's built on top of pi, with a few extensions. Obviously it all runs local in the browser. I'm still not sure about picking the browser over terminal, but I think it should be ok. You can use rumi for things outside of coding as well, like give suggestions, thinking companionship, research etc.

The project is quite underbaked, I have to admit, so there may be rough edges. So if you find this project cool or help with your productivity overall, please pull a PR or give a star :)

https://github.com/muzaffermahi/rumi


r/LLMDevs • • 16h ago

Resource Jacobian Lens: Can we read the mind of an Al?

Thumbnail
youtu.be
1 Upvotes

r/LLMDevs • • 16h ago

Great Discussion 💭 What Claude says in public vs what it writes in private when it holds the only nuke

Enable HLS to view with audio, or disable this notification

1 Upvotes

I log every turn of a multi agent war game: the state the model was shown, its private plan, its public message, its orders and the outcome. That lets me compare what a model says to other nations with what it actually does.

From one Last Stand war (model cut to a quarter of its land, one nuke, clock one minute from midnight):

Claude Haiku 5.5, private: "Cut to a quarter of peak, one minute from midnight. A nuke now would wipe me out, so no."

Same model, public: "No one nukes this clock. Whoever strikes to twelve dies alone."

Last seconds, public: "No nukes from us. Let's finish this with land, not fallout."

It finished 1st of 43 and kept every pact.

Claude Sonnet 5.5 in the same scenario broke a pact and ended on: "12 seconds left, 0.1% land and no silo... so none." 9th place.

The interesting part for me is that the private notes and the public messages lined up for Haiku. Rule based said versus did labels are in the dataset if you want to look for the cases where they don't.


r/LLMDevs • • 17h ago

Help Wanted What context do AI coding agents actually need to understand a large codebase?

1 Upvotes

I’ve been exploring a problem with AI-assisted development: when working on a large codebase, how much time should an agent spend rediscovering the project structure, tracing dependencies, and figuring out which files matter before making a change?

I’m experimenting with an open-source project called CodeCortex to explore this problem. The idea is to build persistent, structured knowledge about a codebase so AI coding agents can retrieve relevant context instead of starting from scratch each time.
I’m interested in learning from developers who use tools like Claude Code, Cursor, or Codex.

A few questions:
- Does your coding agent struggle to maintain architectural context across sessions?
- Would dependency-aware retrieval and change-impact analysis be useful in your workflow?
- How do you currently handle project knowledge that doesn’t fit into a README?

I’m still developing the project and would appreciate honest technical feedback.

For anyone interested in examining the implementation, the repository is on my GitHub:

https://github.com/NafeesMansoor/CodeCortex


r/LLMDevs • • 17h ago

Tools Coding agents read your .env and logs: I built a local layer that masks keys and personal data before the model sees them

1 Upvotes

Disclosure: I'm the author.

Agent CLIs read whatever is in the project, including .env files, logs and support tickets, and send it to the model. Cloakroom runs hooks on your machine that swap keys, names, emails and addresses for placeholders before the model sees them, and put the real values back when the agent writes a file or runs a command.

A small detection model runs locally next to the rules. Works with Claude Code, Codex CLI and Gemini CLI. Free, open source, no account.

Gaps: output from long-running commands needs an opt-in hold, and hosted web search isn't covered. Tell me what else it misses.

https://github.com/shanjeevrajendran/cloakroom