Skip to content
Blog

Cut LLM Token Spend 10x to 100x on SEC Filings and Financial Data With Local Rust CLIs

Written by Zac Ruiz.

Stop paying frontier LLMs to parse raw SEC filings, loan tapes, and spreadsheets. Use deterministic local Rust CLIs to pre-shape, diff, and validate files before a model sees them.

When finance, commercial real estate, and procurement teams complain that AI is too expensive or too unreliable on real files, the root cause is usually the same architectural mistake: they are paying a frontier language model to do deterministic file parsing and arithmetic.

Drop two monthly CMBS loan tapes, a 300-page 10-K, or a folder of vendor statements of work straight into a chat window or agent loop, and three predictable things happen:

  1. Token spend explodes. Multi-megabyte XML, HTML, and CSV files burn hundreds of thousands of input tokens on every prompt and every follow-up turn.
  2. Accuracy drops. Frontier models are built for reasoning, synthesis, and language. When you ask them to compare 8,000 tabular rows inside a crowded context window, silent omissions and rounding drift creep in.
  3. Nothing is reproducible. Re-run the same prompt next week and you get a slightly different summary with no hash of which file bytes went in.

There is a simpler architecture. Push everything deterministic into fast, local Rust CLI binaries before a single token leaves your machine, and reserve the LLM strictly for judgment, synthesis, and writing.

The two-stage pipeline: deterministic code first, LLM second

Raw files (10-K HTML, ABS-EE XML, CSV loan tapes, rent rolls, SOW exports)
|
v
[ Local Rust CLIs: 0 tokens, milliseconds, repeatable ]
1. vacuum + hash + lock -> inventory files, pin SHA-256 / BLAKE3 byte identity
2. shape + profile -> verify schema overlap, keys, and column types
3. rvl + verify + assess -> compute exact numeric diffs, run policy rules, rank exceptions
4. veil + airlock -> enforce sensitive-file boundaries & record model payload
|
v (Compact structured JSON: only material changes, refusals, and supporting rows)
[ Any Frontier LLM: Claude, ChatGPT, Codex, Copilot, or hosted workspace ]
-> Draft memo, explain drivers, answer analyst follow-ups using verified facts
|
v
[ pack + pack verify ]
-> Content-addressed receipt linking outputs back to exact hashed inputs

The division of labor is sharp:

  • Rust CLIs handle structure, hashing, diffs, tolerance checks, and refusals. Zero token cost, deterministic exit codes, millisecond latency, and exact numeric precision.
  • The LLM handles synthesis, explanation, and domain judgment. It reads a few kilobytes of clean, pre-verified JSON instead of megabytes of raw markup and unchanged rows.

Structural token math: raw document stuffing vs. local CLI pre-shaping

Note on the figures below: The token ranges in the table are structural estimates using standard English and markup tokenization (~4 characters per token, varying by XML/CSV density) to illustrate the order-of-magnitude reduction between sending raw files and sending deterministic CLI summaries. Always benchmark on your own files.

WorkflowRaw file stuffing into LLMLocal Rust CLI pre-shapingStructural input reduction
Monthly CMBS loan tape diff (two 10,000-row CSVs, ~2.5 MB each)~1,250,000 input tokens across chunked passesshape + rvl emits top material loan moves beyond tolerance (~2,000 to 4,000 tokens)~300x to 600x fewer tokens
SEC 10-K / 10-Q & exhibit filing comparison (multi-MB HTML/XBRL)~250,000 to 800,000 input tokens per filing pairvacuum + hash + structured schedule diff + verify (~3,000 to 12,000 tokens)~25x to 100x fewer tokens
Recurring vendor invoice / SOW policy check (batch CSVs + exhibits)~150,000 to 500,000 input tokens per review cycleprofile + verify + assess passes only flagged breaches & missing clauses (~5,000 to 15,000 tokens)~15x to 50x fewer tokens

Look at what happens on multi-turn analysis. In a raw chat workflow, every follow-up question re-reads the massive context (even with prompt caching, you still pay cache writes, cache reads, latency, and attention dilution). With local CLI pre-shaping, the working context stays tiny across every turn, and the numbers were never guessed by the model in the first place.

The open-source Rust CLI building blocks

CMD+RVL publishes a modular suite of open-source deterministic Rust CLIs on GitHub and cataloged on our tools page. For day-to-day human and agent workflows, install the unified cmdrvl porcelain wrapper (brew install cmdrvl/tap/cmdrvl) so commands like cmdrvl diff run schema checks (shape), route formats (rvl or redline), and emit redacted control.v0 JSON automatically. Every underlying plumbing binary also stands alone for CI scripts and answers --describe and --schema directly so coding agents like Claude Code and Codex can inspect contracts without guesswork.

1. Intake, identity, and snapshots

2. Schema checks, numeric diffs, and entity resolution

3. Policy gates, boundary controls, and evidence sealing

  • verify: Evaluates declared constraints against named datasets and reports passes, failures, and refusals with supporting rows. Try the offline rule check.
  • benchmark: Scores extraction results by checking (entity, field, value) assertions against a gold dataset while separating accuracy from coverage. Try the offline gold-set scorer.
  • decoding: Reconciles conflicting multi-source claims under a declarative policy and catches false corroboration when two agreeing sources share one upstream origin. Try the offline convergence check.
  • assess: Classifies collected evidence against a declared policy into PROCEED, PROCEED_WITH_RISK, ESCALATE, or BLOCK. Try the offline policy router.
  • veil and airlock: veil runs local PreToolUse hooks and opt-in macOS Seatbelt sandboxing to block raw reads of confidential files by coding agents; airlock proxies and screens outbound prompts and records what crossed the boundary alongside not_crossed.json.
  • pack: Seals lockfiles, reports, and tool outputs into one content-addressed evidence pack verifiable offline with pack verify. Try the offline SHA-256 tamper test.

If your team already uses Claude Code, Codex, ChatGPT, or Copilot, you can paste our system prompt into an agent workspace and put these binaries in front of your files immediately. And if your firm uses hosted workspaces like Rogo, Hebbia, or Harvey, deterministic pre-shaping still pays off upstream because clean, verified slices beat raw dumps in any workspace.

Why smaller, cleaner context also improves accuracy

Cost is only half the win. In our Tokens Tell You Cost. Delivery Tells You Value. essay, we noted that the hidden tax of financial AI is repeated verification: an analyst gets an answer in ten seconds and spends twenty minutes checking whether the model hallucinated a row or skipped an addendum.

When shape refuses two misaligned loan tapes up front, or rvl isolates the exact 14 loans whose balance moved beyond $10,000 with supporting row IDs, the analyst stops auditing model arithmetic and spends their time reviewing real credit exceptions. You get lower token bills and higher trust from the same change.

Where open-source CLIs stop and the paid lineage stack begins

Be clear about the boundary: open-source Rust CLIs are the fast, zero-lock-in starter layer, not an enterprise lineage system on their own.

Local binaries verify files on disk and cut token burn dramatically, but when a finance or commercial real estate team scales to recurring workflows across dozens of deals, internal warehouses, and compliance sign-offs, three harder problems show up:

  1. Warehouse-native catalog & ownership: Knowing which Snowflake or Databricks tables are current, who owns each field definition, and how schemas shifted over time (Reveal MCP).
  2. Direct structured queries & sealed claims: Letting any approved AI assistant query public SEC/CMBS feeds alongside private tables without copying data into a third-party workspace (Data MCP, EDGAR MCP, Evidence MCP, and x402 APIs).
  3. Offline twinning & evals: Rehearsing agents against deterministic local protocol twins (Twinning) and regression benchmarks before changes hit production.

That full end-to-end lineage stack is what CMD+RVL deploys and licenses for larger firms, either in our cloud or directly inside your Snowflake or cloud warehouse.

Try it on one real file this week

You do not need a procurement cycle to test this pattern:

  • Start free locally: Pull the open-source Rust CLIs from our tools directory and run shape and rvl on two monthly CSV exports or tapes.
  • Test live filing checks free: Text Cairn on SMS, Signal, or WhatsApp to see source-backed filing and document checks without a demo gate.
  • Build one workflow in half a day: Book a $500 half-day founder workshop online or near Philadelphia. Bring one noisy document workflow, and leave with a working local CLI + AI pipeline you own.

Common questions

How do local Rust CLIs cut LLM token spend 10x to 100x on financial documents?

Instead of stuffing raw multi-megabyte SEC filings, CSV loan tapes, or rent rolls into an LLM context window, local Rust CLIs deterministically check schemas, hash inputs, compute exact numeric diffs, and filter out unchanged rows first. The LLM receives only a compact JSON payload of material changes and rule failures, often reducing input tokens by 10x to 100x or more.

Why not just use a model with a 1-million-token context window?

Large context windows still charge per input token on every turn, increase latency, and degrade recall on dense tabular numbers. Paying a frontier model to scan 10,000 unchanged loan rows just to find 12 balances that moved is both expensive and less accurate than running a millisecond deterministic diff before the model drafts commentary.

Do CMD+RVL's open-source Rust CLIs work with Claude, ChatGPT, Codex, and existing tools?

Yes. Every open-source CLI in the CMD+RVL suite runs locally, outputs structured JSON, and answers --describe and --schema directly so coding agents and assistants like Claude Code, Codex, ChatGPT, and Copilot can invoke them cleanly. Teams using hosted financial workspaces like Rogo, Hebbia, or Harvey can also use them upstream to clean and verify inputs.

Do the open-source CLIs provide end-to-end data lineage on their own?

No. Open-source Rust CLIs are the local starter layer for pre-shaping, deterministic comparison, rule checks, and byte-level artifact sealing. End-to-end lineage across a firm's data warehouse lives in CMD+RVL's paid stack: Reveal catalog tracking, paid MCP servers and x402 APIs over Snowflake or your warehouse, Evidence MCP receipts, and deterministic offline twinning and evals.


Read next:

Zac Ruiz

Zac Ruiz

Co-Founder

Technology leader with 25+ years' experience, including a decade in securitization and capital markets.

LinkedIn