How each method works in a prompt pipeline
Both methods follow the same lifecycle for a protected value in a prompt pipeline. The difference is the form the protected value takes while the model is processing it: ciphertext or a token.
- Detect and protectSensitive values are found in prompts, retrieved context, and tool outputs, then replaced before inference.
- Model processesThe LLM reasons over ciphertext or tokens, never the original identifiers.
- Re-hydrate under policyOriginal values are restored in responses only for principals and purposes that are authorized and logged.
Effects on model output quality and downstream validation
Because the model reasons over ciphertext or tokens rather than original identifiers, the choice of method depends on what the model or a downstream validator needs to see. The key question is whether the original format or cross-turn consistency must be retained.
FPE fits when a value must keep its exact format and stay consistent across systems without a lookup store. Tokenization fits when protected values should carry no mathematical relationship to the original.
Comparison on practical criteria
| Criterion | Format-preserving encryption | Tokenization |
|---|---|---|
| Use when | A value must keep its exact format and stay consistent across systems without a lookup store. | You want protected values that carry no mathematical relationship to the original and can be revoked centrally. |
| Format | Keeps the exact format of the value. | Protected values carry no mathematical relationship to the original. |
| Consistency and control | Consistent across systems without a lookup store. | Can be revoked centrally. |
A decision framework by data type
Many prompt pipelines use both methods, chosen by data type. Work through the following questions for each data type in your prompts before choosing.
Questions to answer before choosing
- Which prompt data types need reversible protection, and which can be redacted?
- Does the model or a validator need the original format or cross-turn consistency?
- Which principals may decrypt or detokenize, and how is each reveal approved and logged?
- What is the blast radius if the key store or vault is compromised?
- How are protected values handled in prompt, response, and log storage?
Where runtime policy enforcement fits
Whichever method protects a value, a policy layer decides who may reveal original values. Original values are restored in responses only for principals and purposes that are authorized and logged.