Rehydration

The complement to masking — restoring original values in the provider's response.

How it works

  1. Masking produces a token map: PERSON_1 → "John Smith", EMAIL_1 → "john@acme.com".
  2. The map exists in request-local memory only.
  3. When the provider responds, Privian substitutes each placeholder back to its first-observed surface form.
  4. The rehydrated text is returned in response; the map is discarded with the request.

Example

text
Prompt:    Email John Smith at john@acme.com about Friday.
Sent:      Email PERSON_1 at EMAIL_1 about Friday.
Returned:  Sent. I'll email PERSON_1 at EMAIL_1 about Friday.
Final:     Sent. I'll email John Smith at john@acme.com about Friday.

Properties

  • Response-only. Rehydration runs once, on the provider response.
  • First-observed surface form. If a prompt contains both John Smith and john smith, both share PERSON_1 and rehydrate to the first form observed.
  • Lossless for masked spans. Tokens that appear in the response are restored verbatim.
  • Stateless across requests. A token from request A cannot be rehydrated by request B.

Limitations

  • If the model emits a placeholder that was not in the request map (a model hallucination), it is returned literally — Privian does not invent substitutions.
  • Streaming responses use artificial chunking over the already-rehydrated text; native token-level streaming is not exposed in the beta.

Related