TL;DR
Commercial "reasoning" models like OpenAI o1 conceal intermediate thinking traces to protect proprietary methods, yet bill users on a pay-per-token basis for these hidden steps. To close this billing verification gap without forcing providers to expose their full chains of thought, CoIn introduces an auditing framework that combines Merkle hash trees for token quantity verification with embedding-based neural matching heads to verify semantic validity.
What Problem Does This Paper Address?
Reinforcement learning-tuned reasoning models (such as DeepSeek-R1 and OpenAI’s o1/o3 series) can generate reasoning traces that outnumber the final answer by an order of magnitude or more. In Commercial Opaque LLM APIs (COLA), providers return only the final answer while billing users for the entire token stream—reasoning tokens included.
Because users cannot see intermediate tokens, this creates a severe asymmetry of information and an exploitable vulnerability: token count manipulation. Dishonest providers could overbill users with near-zero computational cost either by direct misreporting (simply inflating the reported count $m_f > m$) or by naive/adaptive inflation (injecting cheap, synthetic, or random tokens into the invisible stream).
Methods
CoIn sits as a trusted third-party auditing framework between the user and COLA, relying on two complementary mechanisms:
[Reasoning Blocks & Tokens]
│
├──> Token Quantity Verification: Merkle Hash Tree (SHA-256)
│ └── Proves count & inclusion via spot-checked Merkle proofs
│
└──> Semantic Validity Verification: Lightweight Matching Heads
├── Tokens-to-Block Head (MH_tb): Ri coherence within block Bj
└── Block-to-Answer Head (MH_ba): Bj relevance to final answer A
- Token Quantity Verification (Cryptographic Hashing):
- The reasoning sequence $R$ is partitioned into $\alpha$ blocks ($B_j$).
- COLA uses an auditor-specified embedding model (
all-MiniLM-L6-v2) to generate embeddings for each block and token, producing composite token fingerprints: $\text{Embd}(B_j) \mathbin{\Vert} \text{Embd}(r_i)$. - A cryptographic Merkle hash tree is built over the hashed fingerprints. COLA submits the Merkle Root as a commitment.
- During an audit, users sample token indices; the auditor checks Merkle proofs along the path, preventing misreported counts.
- Semantic Validity Verification (Relevance Matching):
- Cryptographic proofs prevent misreporting counts, but an adversary could still commit hashes of random or low-effort filler text.
- CoIn uses two lightweight binary classifiers ("matching heads") that evaluate feature vectors constructed from embeddings and their interactions ($[a; b; a-b; a \odot b; \cos(a, b)]$).
- Tokens-to-Block Verification: Verifies sampled reasoning tokens logically belong to their enclosing block (detects random injection).
- Block-to-Answer Verification: Verifies the reasoning block is semantically aligned with the final answer $A$ (detects unrelated content insertion).
- Decisions are aggregated over multiple rounds using either a rule-based verifier (score thresholds) or a learning-based DeepSets verifier.
Datasets
The authors constructed training and evaluation sets derived from reasoning traces generated by DeepSeek-R1, spanning five domains:
- Medical (HuatuoGPT-o1 / Medical-R1-Distill-Data)
- Code (OpenThoughts-114k-Code)
- Math (OpenR1-Math-220k)
- General Reasoning (Glaive reasoning-v1-20m)
- Out-of-Domain (OOD) Math (OpenThoughts-114k-math)
The training corpus comprised 1.2 million positive and negative pairs across four domains, while 1,000 samples per dataset were held out for evaluation. They evaluated four adaptive inflation strategies (embedding-similar token injection, prompt/answer token sampling, swapping reasoning steps from other examples, and Wikipedia document retrieval).
Key Insights and Ideas
- Zero-knowledge without prohibitive overhead: Full Zero-Knowledge Proofs (ZKPs) for autoregressive transformer decoding remain computationally intractable at scale. CoIn circumvents this by combining Merkle trees with third-party embedding fingerprints, verifying counts while exposing minimal surface area.
- Auditing without model distillation risk: Exposing partial reasoning traces risks leaking proprietary IP. By enforcing block sizes of $\ge 256$ tokens and sampling small subsets ($\le 40\%$ embedding exposure and $< 4\%$ token visibility), embedding inversion tools (like Vec2Text) fail to recover usable training data.
- Asymmetric verification burden: A rule-based verifier works best on benign traffic to keep false positives low (minimizing rounds and information leakage), while a DeepSets neural verifier is substantially better at identifying subtle, adaptive token-injection attacks.
Key Results
- Detection Success Rate (DSR): The learning-based verifier achieved up to 94.7% average DSR against adaptive attacks at a $3.0$ inflation ratio (IR), maintaining an average 84.3%–93.1% DSR against tough attacks like prompt token reuse or sequence swapping. Even under subtle $10\%$ token inflation, CoIn retained a 40.1% detection rate.
- Matching Head Accuracy: The Block-to-Answer head averaged 94.8% DSR across inflation types (and $94.7\%$ on unseen OOD math). The Tokens-to-Block head achieved an 87.2% average DSR.
- Minimal Construction Cost: Merkle tree construction scales linearly with sequence length and was found to be computationally negligible on standard multi-core CPUs.
- IP Protection: In embedding inversion experiments, Vec2Text BLEU scores plummeted from $43.8$ (block size 16) down to $4.07$ at block size 256 and $0.67$ at block size 512, demonstrating that proprietary reasoning traces cannot be reverse-engineered from the audit proofs.
Limitations and Future Work
- Low Inflation Regimes: When inflation is minimal (e.g., $< 10\%$), detection probability drops noticeably.
- Adversary Cooperation: The protocol requires active COLA cooperation to generate the auditor-mandated embeddings and Merkle paths.
- High-Cost Attacks Out of Scope: CoIn targets near-zero-cost inflation. Sophisticated adversaries willing to expend significant compute—such as using smaller auxiliary LLMs for full rewriting—fall under "model substitution" attacks, requiring complementary defenses like n-gram redundancy checks.
Summary updated