How to Verify LLM Responses: Principles and Implementation of Verifiable Inference

    This article explores how to prevent fraud in Large Language Model (LLM) responses through verifiable inference. It addresses the core challenge of confirming the source and execution of LLM calls, defines specific verification goals, and evaluates three types of evidence: behavioral detection, digital signatures, and verifiable computation. The piece details the workflow of verifiable inference—including commitments, proofs, and verification—while highlighting practical boundaries and engineering challenges. Finally, it outlines a staged approach for developers to build auditable pipelines, ensuring that service commitments are transformed into verifiable evidence.

    I. The Core Challenge: Receiving a Response Doesn’t Confirm Its Source

    In LLM applications, developers can typically observe request payloads, response texts, latency, and partial metadata, but it is difficult to directly observe what computation the server actually executed.

    When requests pass through proxies, relays, or multi-tier service orchestration, this information asymmetry becomes more pronounced: an application may declare calling a high-capability model, but the actual request might be routed to a cheaper model. The server might adjust quantization precision, context processing methods, or generation configurations without the client’s knowledge.

    These changes are not necessarily fraudulent. Reasonable load scheduling, fault degradation, and version upgrades can also alter response behavior. The real issue is the lack of client-verifiable evidence between the service provider’s claims and the actual execution.

    Therefore, LLM anti-fraud should not merely study “whether the response looks like a specific model,” but must answer three clearer questions:

    1. Does this response come from a trusted service entity?
    2. Does this response correspond to this specific request, rather than an old result or the result of another request?
    3. Does the computation generating this response comply with the pre-agreed model and execution rules?

    These three questions correspond to different levels of assurance and cannot be simply replaced by a single technology.

    II. Define Verification Goals First: Anti-Fraud is Not Universal Authentication

    Before designing a solution, the target of prevention must be clear.

    1. Preventing Tampering with Responses

    If a proxy node rewrites the answer, the user needs to be able to detect it. Digital signatures applied by a trusted service provider to the request digest and response digest usually provide effective assurance for this.

    The premise is that the client possesses a trusted verification public key and knows who the signing entity is.

    2. Preventing Replay of Old Responses

    If the evidence is only bound to the output text, an attacker might copy a historical response and its proof to impersonate a new call result.

    Therefore, the evidence should also bind the current request, a random challenge value, and necessary validity period information. The client must not only verify the signature or proof but also check whether these fields match the current call.

    3. Preventing Mismatch Between Actual and Declared Models

    This is a more complex issue. A service provider can sign a statement saying “the agreed model was used for this call,” but a digital signature only proves who issued the statement, not that the statement is true.

    To further verify the computation process, the “model identity” must be translated into checkable computational constraints: for instance, whether the agreed weights, agreed inference program, and agreed inputs actually produced the corresponding output.

    4. Preventing Undisclosed Execution Changes

    The same set of weights can be executed under different precisions, context truncation rules, or sampling configurations. Proving consistency in weights alone does not necessarily prove consistency in complete service behavior.

    Therefore, the verification target for model anti-fraud cannot solely include the model name; it should cover tokenization rules, inference programs, numerical precision, and key generation configurations as required.

    The strength of an anti-fraud solution depends on what it verifies, not how complex the evidence file is.

    III. What Three Types of Evidence Can Prove

    1. Behavioral Detection: Providing Clues, Not Definitive Identity

    By using fixed questions, language styles, specific knowledge points, or response fields, some obvious anomalies can be detected. However, such methods are easily affected by prompts, sampling randomness, version updates, and post-processing of outputs.

    Asking the model “who are you” is particularly unreliable because the model might generate an identity description based on context rather than reading an unforgeable runtime identity.

    Behavioral testing is better suited for screening anomalies or evaluating capabilities, not for serving as cryptographic proof of model identity.

    2. Digital Signatures: Proving a Trusted Subject Made a Claim

    The service provider can jointly sign the following information:

    • Request digest;
    • Response digest;
    • Model version identifier;
    • Configuration digest;
    • Random challenge value;
    • Issuance time and validity period.

    After verifying the signature, the client can confirm that this content has not been modified and that the signature comes from the holder of the corresponding private key.

    However, if the signer itself is the entity that needs to be constrained, relying solely on its self-signed statement still requires trusting it to execute honestly. This is the capability boundary of signatures, not a flaw in the signature algorithm.

    3. Verifiable Computation: Proving Execution Meets Defined Relationships

    Verifiable computation describes the inference process as a mathematical relationship:

    “There exists a set of model parameters and intermediate execution states that satisfy specified commitments, such that the agreed program processes the given input to produce the specified output.”

    The prover generates evidence, and the verifier checks whether the evidence holds. Under appropriate cryptographic assumptions and correct implementations, the verifier can obtain assurance about this relationship without needing to recompute everything.

    Among these, Zero-Knowledge Proofs (ZKPs) can hide the weights or intermediate states acting as secret witnesses while proving the relationship holds. However, public inputs, output lengths, and other public fields can still leak information; “zero-knowledge” should not be misunderstood as implying that the entire business process inherently has no privacy risks.

    IV. Basic Process of Verifiable Inference: Commitment, Proof, and Verification

    The following is a general design framework and does not represent that any specific project has implemented all capabilities.

    Step 1: Publish Trusted Model and Execution Commitments

    The service provider needs to determine the verification targets, such as:

    • Model parameters and their versions;
    • Parameter encoding and serialization rules;
    • Inference program;
    • Numerical precision and rounding rules;
    • Input preprocessing and tokenization rules;
    • Generation configurations included in the verification scope.

    Subsequently, through an appropriate cryptographic commitment mechanism, these objects are bound to a public commitment.

    The commitment must possess binding properties to prevent the prover from arbitrarily changing the committed content later. If hiding model information is also required, a construction meeting the corresponding hiding requirements should be used; a standard digest cannot automatically fulfill this goal in all cases.

    More importantly, the client needs to reliably obtain “which commitment corresponds to which agreed model.” If the commitment is arbitrarily provided by an untrusted relay, even if the proof is valid, it might only prove that it correctly ran a different model.

    Step 2: Bind the Current Request and Generate Proof

    When the client submits the input, it can attach a one-time random challenge value. After the server completes the agreed computation, it generates a proof that binds the following simultaneously:

    • Trusted model commitment;
    • Current request digest;
    • Current response digest;
    • Execution configuration digest;
    • Client challenge value;
    • Necessary execution context.

    The proof relationship must clearly specify how these public fields are associated with the actual execution.

    For autoregressive generation, it is not enough to prove that the model computation at a single position is correct; it must also clearly cover which generation steps are included, and whether tokenization, stopping conditions, and sampling choices are verified. If the sampling process is not included in the proof, the evidence cannot completely cover the generation logic of the final text.

    Step 3: Client Independently Verifies and Executes Policies

    The client first obtains the verification materials from a trusted source, then checks the proof and its bound fields.

    The meaning of successful verification should be precisely stated as: The computational relationship described by the evidence holds. It does not automatically mean that the answer is factually correct, the content is safe, or the business advice is reliable.

    If verification fails or evidence is missing, the client should also distinguish different reasons, such as field mismatch, expired materials, unsupported format, or mathematical verification failure. Missing evidence can be judged as “not meeting verifiable requirements,” but this alone cannot be used to assert that the service provider definitely swapped the model.

    V. From Mathematical Relationships to Real Inference: Easily Overlooked Boundaries

    1. Numerical Computation is Not Directly Moved into Proof Systems

    LLM inference generally involves a large number of matrix operations and nonlinear functions, while proof systems usually operate within specific algebraic structures. Engineering implementations need to handle numerical representation, range constraints, overflow, rounding, and approximate computation.

    If the proof covers a certain fixed-point implementation, it proves that this implementation complies with the agreement, not automatically that its results are exactly identical to any floating-point implementation.

    2. Complete Output Requires Covering the Full Generation Pipeline

    Proving a single step of computation does not equal proving the entire response. How context is constructed, how caches participate, and how outputs are concatenated can all affect the final result.

    If only partial computation can be proven, the coverage scope should be clearly stated; local evidence should not be packaged as end-to-end authentication.

    3. Tool Calls and Retrieved Content Require Additional Evidence

    Model responses may rely on external retrieval, computational tools, or business databases. Even if the model inference itself is verifiable, it cannot prove that the external data is authentic, complete, and up-to-date.

    The complete application pipeline requires separately handling the associations between data sources, tool execution, access permissions, and final outputs.

    VI. Why High-Intensity Anti-Fraud Capabilities May Not Be Deployed Immediately

    Moving verifiable inference from research proposals to online services usually requires crossing multiple engineering thresholds.

    First, proof generation may incur additional computation, memory, and data transmission costs. A lightweight verification end does not mean that evidence generation on the server side is cheap; actual performance needs to be tested with real models and business loads.

    Second, online systems frequently use streaming outputs, dynamic batching, and cache reuse. The proof system needs to be compatible with these mechanisms; otherwise, it might increase response wait times or only provide evidence after the entire generation is complete. The user interface must distinguish between “content has been returned” and “content has been verified.”

    Third, model updates bring new commitments, version mapping, and verification material management needs. Updating server-side weights alone without maintaining the client-side trust chain may cause verification failures or version explanation confusion.

    Finally, the proof circuit or constraints themselves may have flaws. If key checks are omitted, even if the proof passes, it only means that an incomplete relationship holds. Therefore, constraint design, implementation review, and security evaluation are core tasks, not just add-on steps before launch.

    These limitations explain why related capabilities might first be used in experiments, specific models, or high-value scenarios, but one cannot infer the actual deployment status of a specific service based on this.

    VII. How Developers Can Build Auditable Pipelines in Stages

    Stage 1: Make Call Records Complete

    Generate unique identifiers and random challenge values for requests, and record model declarations, configuration digests, response digests, and verification status. Sensitive raw text should be retained minimally according to business needs, with access permissions and retention periods set.

    This step cannot prove that model computation is authentic, but it reduces subsequent investigation and audit costs.

    Stage 2: Introduce Trusted Signatures

    Require trusted upstream services to jointly sign the request, response, and key execution metadata. This can prioritize solving issues like proxy tampering, unknown sources, and partial replays.

    The signing entity, distribution of verification public keys, and key rotation mechanisms must be clear.

    Stage 3: Verify High-Value Requests

    For calls that affect funds, compliance, or critical business decisions, gradually introduce stronger execution evidence. Whether it is suitable for full-scale deployment should be decided based on risk, cost, latency, and verifiable coverage scope.

    If sampling verification is adopted, measures must prevent the server from identifying sampled requests in advance; otherwise, the sampling results may not represent overall behavior.

    Below is an illustrative validation logic, not an actual interface:

    1. expected = load_trusted_model_policy()
    2. if response.challenge != request.challenge:
    3. reject("Request challenge mismatch")
    4. if response.request_digest != digest(request.payload):
    5. reject("Request content mismatch")
    6. if response.model_commitment != expected.commitment:
    7. reject("Model commitment does not match the agreed policy")
    8. if response.output_digest != digest(response.output):
    9. reject("Output integrity check failed")
    10. if not verify_evidence(expected.verification_material, response):
    11. reject("Execution evidence verification failed")
    12. accept_as_verified(response.output)

    Real implementations also need to handle field normalization, key revocation, protocol versioning, exception degradation, and duplicate submissions. In particular, verification failures must not be silently handled as normal successful responses, or the security mechanism will lose its actual constraining power.

    VIII. Conclusion: Anti-Fraud Should Become a Clear Service Contract

    LLM anti-fraud is not about attaching a label to a response, nor is it about guessing identity through a few test questions; it is about converting service commitments into checkable evidence.

    Digital signatures solve “who made the claim”; model commitments solve “what the verification target is bound to”; verifiable computation further solves “whether the actual execution meets the agreement.” The three can be combined but should not be confused.

    For developers, the most pragmatic path is to first establish trusted metadata, signatures, and auditing, and then gradually introduce computational proofs based on business risk. At the same time, independent quality evaluation should always be retained: a genuine source does not mean a correct answer; compliant execution does not mean the task was done well.

    Only by clearly defining the verification scope, trust sources, and failure policies can model anti-fraud transform from a technical concept into a genuinely usable engineering capability.