<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Priyanuj Boruah</title>
    <description>The latest articles on DEV Community by Priyanuj Boruah (@priyanujboruah).</description>
    <link>https://dev.to/priyanujboruah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2197269%2Fb76f2ee7-2109-4510-a4fb-435824665d25.png</url>
      <title>DEV Community: Priyanuj Boruah</title>
      <link>https://dev.to/priyanujboruah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/priyanujboruah"/>
    <language>en</language>
    <item>
      <title>How We Built an 86µs Privacy Proxy for LLMs (9.3M Prompts, 1.94B Tokens Benchmarked)</title>
      <dc:creator>Priyanuj Boruah</dc:creator>
      <pubDate>Tue, 13 Oct 2026 14:15:20 +0000</pubDate>
      <link>https://dev.to/priyanujboruah/how-we-built-an-86us-privacy-proxy-for-llms-93m-prompts-194b-tokens-benchmarked-4g7e</link>
      <guid>https://dev.to/priyanujboruah/how-we-built-an-86us-privacy-proxy-for-llms-93m-prompts-194b-tokens-benchmarked-4g7e</guid>
      <description>&lt;p&gt;Integrating enterprise AI with strict privacy compliance (GDPR, HIPAA, SOC 2, CCPA) is usually a massive engineering headache.&lt;/p&gt;

&lt;p&gt;Stakeholders demand zero customer PII leakage to third-party model providers (OpenAI, Anthropic, Mistral, Google). But the existing solutions force an unpleasant tradeoff:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Python NLP / Named Entity Recognition (e.g., Microsoft Presidio, spaCy):&lt;/strong&gt; Heavy containers that typically add 50ms to 300ms of compute latency per prompt and require maintaining dedicated backend server clusters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Irreversible Redaction:&lt;/strong&gt; Blanking out entities with &lt;code&gt;[REDACTED]&lt;/code&gt;, which breaks the model’s reasoning context and makes customer-facing agent responses unusable.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We wanted to know: &lt;strong&gt;Can an AI privacy layer guarantee 100.00% exact roundtrip fidelity at the edge without adding perceptible latency?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To prove it, we built &lt;strong&gt;&lt;a href="https://projectspg.info" rel="noopener noreferrer"&gt;ProjectSPG&lt;/a&gt;&lt;/strong&gt;—an open, edge-native drop-in OpenAI proxy on Cloudflare Workers—and ran an exhaustive benchmark across &lt;strong&gt;9,334,805 prompts&lt;/strong&gt; (~1.94 billion tokens) and &lt;strong&gt;10,281,399 protected entities&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is what we learned and how the architecture works.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Architecture: Reversible Edge Tokenization
&lt;/h2&gt;

&lt;p&gt;Instead of running slow multi-gigabyte neural models in the critical request path, ProjectSPG executes deterministic tokenization and Luhn/checksum verification directly inside V8 isolates across Cloudflare’s global edge network (300+ locations):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Client App]
   │
   │ (Raw Prompt: "Refund $500 to alice@company.com")
   ▼
[ProjectSPG Edge Proxy] ── (86µs V8 Tokenizer)
   │
   │ (Reversible Mapping: alice@company.com -&amp;gt; EMAIL_1)
   ▼
[Upstream LLM: OpenAI / Groq / Mistral / Gemini]
   │
   │ (Prompt Processed: "Refund $500 to EMAIL_1")
   │ (Model Output: "Processed refund for EMAIL_1")
   ▼
[ProjectSPG Edge Rehydrator]
   │
   │ (Reverses EMAIL_1 -&amp;gt; alice@company.com in real-time stream)
   ▼
[Client App Receives: "Processed refund for alice@company.com"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Prompt Interception:&lt;/strong&gt; Intercepts the raw prompt before it leaves the edge network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-Speed Regex &amp;amp; Shannon Entropy Scanning:&lt;/strong&gt; Detects 109-country PII, financial identifiers (IBANs, credit cards with Luhn validation), and secrets at sub-millisecond speeds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reversible Tokenization:&lt;/strong&gt; Swaps entities with cryptographically scoped typed tokens (&lt;code&gt;EMAIL_1&lt;/code&gt;, &lt;code&gt;CARD_1&lt;/code&gt;, &lt;code&gt;SSN_1&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streaming Rehydration:&lt;/strong&gt; As the upstream model streams tokens back via Server-Sent Events (SSE), the proxy dynamically restores the original values on the fly. The client receives clean, contextual output with zero model hallucinations or character drift.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Benchmark: 9.33 Million Prompts &amp;amp; 1.94 Billion Tokens
&lt;/h2&gt;

&lt;p&gt;Testing on synthetic dummy strings is never enough. Real-world prompts contain messy punctuation, code snippets, mathematical symbols, Unicode emojis, and tracking numbers. &lt;/p&gt;

&lt;p&gt;Our benchmark corpus combined 5 major datasets into 94 Apache Parquet row groups:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LMSYS Chatbot Arena:&lt;/strong&gt; 2.52M real multi-turn conversations with frontier LLMs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenOrca:&lt;/strong&gt; 2.91M technical instructions, Python stack traces, UUIDs, and SQL statements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WildChat:&lt;/strong&gt; 2.15M unfiltered global prompts covering edge Unicode delimiters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enron Email Corpus:&lt;/strong&gt; 1.02M corporate email headers, signatures, and phone numbers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer Support Twitter:&lt;/strong&gt; 734K unstructured complaints with tracking numbers (FedEx, UPS).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sovereign ID Synthesis:&lt;/strong&gt; Algorithmic test vectors across 109 jurisdictions (Aadhaar, SSN, NRIC, Codice Fiscale).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Results
&lt;/h2&gt;

&lt;p&gt;Every single prompt was tokenized, rehydrated, and evaluated for strict byte-for-byte exact equality (&lt;code&gt;rehydratedText === originalPrompt&lt;/code&gt;):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Measured Value&lt;/th&gt;
&lt;th&gt;Standard&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Exact Roundtrip Fidelity&lt;/td&gt;
&lt;td&gt;100.00%&lt;/td&gt;
&lt;td&gt;Zero character drift&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Engine Execution Latency&lt;/td&gt;
&lt;td&gt;86 µs (median)&lt;/td&gt;
&lt;td&gt;Sub-millisecond&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;p95 Engine Latency&lt;/td&gt;
&lt;td&gt;142 µs&lt;/td&gt;
&lt;td&gt;High consistency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;p99 Engine Latency&lt;/td&gt;
&lt;td&gt;218 µs&lt;/td&gt;
&lt;td&gt;SLA stable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Throughput (Single Node)&lt;/td&gt;
&lt;td&gt;17,735 prompts/sec&lt;/td&gt;
&lt;td&gt;V8 optimized&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full HTTPS Network Overhead&lt;/td&gt;
&lt;td&gt;13.3 ms&lt;/td&gt;
&lt;td&gt;Global Cloudflare Edge&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Wire-Compatible Drop-In: How to Test
&lt;/h2&gt;

&lt;p&gt;Because it follows the OpenAI wire specification, you don't need any special SDK. Just point your &lt;code&gt;baseURL&lt;/code&gt; to the proxy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.projectspg.info/v1/chat/completions &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer YOUR_SPG_KEY"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-tokenization-mode: mask"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "model": "codestral-2508",
    "messages": [
      {
        "role": "user",
        "content": "Please send the invoice for $4,500 to sarah.connor@acme.org."
      }
    ]
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What the upstream model actually receives:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Please send the invoice for $4,500 to EMAIL_1."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What your application gets back:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Invoice for $4,500 has been dispatched to &lt;a href="mailto:sarah.connor@acme.org"&gt;sarah.connor@acme.org&lt;/a&gt;."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Try It Live
&lt;/h2&gt;

&lt;p&gt;You can test prompt tokenization, inspection, and rehydration directly in the web playground without signing up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Playground:&lt;/strong&gt; &lt;a href="https://projectspg.info" rel="noopener noreferrer"&gt;projectspg.info&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Empirical Benchmark Report:&lt;/strong&gt; &lt;a href="https://projectspg.info/blog/benchmark" rel="noopener noreferrer"&gt;projectspg.info/blog/benchmark&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We would love to hear your thoughts on edge tokenization, entropy edge cases, and compliance architectures!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>openai</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
