Sub topic 10
The Einstein Trust Layer and Model Selection
This chapter assumes you know how a prompt template is built and how merge fields ground it in record data. It also assumes Einstein generative AI is enabled in your org. It covers what happens to a template's prompt between the moment it is resolved and the moment the answer comes back. It also covers how you choose the large language model (LLM) that handles the prompt.
Why this matters for every template type
Sales Email, Field Generation, Record Summary and Flex templates all pull real data from your org into a prompt. That data can include names, email addresses, case descriptions and revenue figures. The prompt then goes to an LLM that may be hosted outside Salesforce.
The Einstein Trust Layer sits between your org and the model. You do not add it to a template, and every template type goes through it. You do configure parts of it, and you choose the model, so both are your decisions even though the flow is automatic.
What the Trust Layer does
The Trust Layer is a set of safeguards applied on the way to the model and on the way back. You can think of it in two directions.
Before the prompt reaches the model:
- Secure data retrieval and dynamic grounding. Merge fields resolve using the permissions of the running user. If a user cannot see a field, that field does not become part of the prompt. Grounding is done at request time, so the model sees current data.
- Data masking. Sensitive values in the resolved prompt are detected and replaced with placeholders before the prompt leaves Salesforce.
- Prompt defense. Salesforce adds instructions to the prompt that tell the model how to behave. These instructions reduce the chance that the model follows malicious text hidden in the data, and they discourage unwanted output.
After the model responds:
- Demasking. The placeholders in the response are swapped back to the original values, so the person reading the output sees real names and numbers.
- Toxicity detection. The response is scored for harmful content, and the score is recorded.
- Audit trail and feedback. Prompts, responses, masking details and toxicity scores can be stored for review. Feedback such as thumbs up or down is stored with them. This storage uses Data Cloud, so it must be set up before you can use it.
Separately, Salesforce has zero data retention agreements with its LLM provider partners. Under those agreements the provider does not store the prompt or response and does not use them to train its models. This applies to models that Salesforce hosts or connects to on your behalf. It does not automatically apply to a model you connect yourself.
How data masking looks in practice
Take the Sales Email prompt from earlier in the tutorial. After merge fields resolve, the prompt might read like this:
Write a short, friendly follow-up email to Maria Lopez, who works at Northwind Traders.
Mention that we met recently and offer to schedule a call.
Keep it under 120 words and do not invent product details.With masking on for personal names, the model might receive text like this instead. The placeholder format is illustrative and varies by implementation.
Write a short, friendly follow-up email to PERSON_0, who works at Northwind Traders.
Mention that we met recently and offer to schedule a call.
Keep it under 120 words and do not invent product details.The model writes "Hi PERSON0, ...". The Trust Layer replaces `PERSON0` with "Maria Lopez" before you see the draft. The model never saw the real name, and the output still reads naturally.
Masking uses pattern matching and named entity recognition to find sensitive values. You choose which categories to mask in Setup, on the Einstein Trust Layer page. Typical categories are personal names, email addresses, phone numbers and similar identifiers.
Limits of masking
- Detection is not perfect. Pattern matching works well for regular formats such as emails or card numbers. Names embedded in free text, such as a case description that says "talked to Maria yesterday," are harder to catch.
- Masking can hurt quality. If the model needs a value to do its job, masking it removes that value. A prompt that asks the model to compare two company names will perform worse if both are replaced with placeholders.
- Support varies. Masking coverage can depend on the model, the language and the feature. Check the current Salesforce documentation for what your org supports before you rely on it for compliance.
Selecting a model
Each prompt template has a model setting. The choice affects output quality, speed and cost, and it can affect where processing happens. In Prompt Builder you pick the model in the template workspace, and you can change it later. A new version of the template can use a different model than the previous one.
Models fall into three groups:
| Source | What it is | Trust Layer coverage | Typical reason to use it |
|---|---|---|---|
| Salesforce default | The model Salesforce selects for your org when you make no choice | Full, with zero data retention agreements | Getting started, general tasks |
| Salesforce-managed from a provider | Models from third-party providers that Salesforce connects for you, and models Salesforce hosts | Full, with zero data retention agreements | Matching a model to a task, such as long summaries or tight latency |
| Bring your own model (BYOM) | A model you register through Einstein Studio, from your own cloud account or a provider you contract with directly | Depends on setup. Retention and handling terms are yours to verify | Contractual, regional or specialist model requirements |
The list of available models changes over time as Salesforce adds and retires them. Do not rely on a model name from a tutorial. Open the model picker in your org to see the current options.
Criteria for choosing a model
- Task fit. Short, structured output such as a one-sentence account description needs less capability than a summary of a long case thread with many comments.
- Input size. Record Summary and Flex templates can pull in long text. The model needs a context window large enough for the resolved prompt plus the answer.
- Latency. A Field Generation template that runs while a user waits should respond quickly. A background automation can tolerate a slower, more capable model.
- Cost. Larger models generally use more of your Einstein request allowance per call. Check your edition's metering rules.
- Data and compliance rules. If your company requires a specific region or provider, the model list may narrow the choice for you.
A sensible method is to start with the default, preview with realistic records, and move to a different model only when the output shows a clear gap.
Configuring the Trust Layer in Setup
A short checklist for an admin enabling templates for a team:
- Confirm Einstein generative AI is turned on.
- Open the Einstein Trust Layer page in Setup.
- Review which data categories are masked and adjust them to your policy.
- Decide whether to store an audit trail. This requires Data Cloud, so plan that dependency first.
- Review which models are available to the org and whether any BYOM models are registered.
- Give prompt template users the permission sets they need to run templates.
Common mistakes
- Assuming masking hides everything. Masking covers detected categories only. Unstructured text can still carry sensitive details.
- Assuming BYOM inherits every protection. Zero data retention comes from Salesforce's agreements with its partners. For a model you bring, check the terms with whoever hosts it.
- Granting broad field access to the running user. Merge fields respect user permissions. A user with wide access produces prompts with more data in them, so review profiles and permission sets along with the template.
- Skipping the audit trail in a regulated setting. Without stored prompts and responses, you cannot review what was sent or generated after the fact.
- Changing the model and the prompt text at once. If output improves or worsens, you will not know which change caused it.
Summary
The Trust Layer applies to every template type. It resolves data under the user's permissions, masks sensitive values, adds prompt defense, checks toxicity, demasks the answer and can keep an audit trail. You choose the model per template version, trading capability against speed, cost and compliance. Salesforce-managed models carry the full set of protections. Models you bring yourself need their terms checked.
Exercise
A Record Summary template sends a long case history to the model. A reviewer notices that customer names in the output look correct, yet the model provider never received those names. Which two Trust Layer steps explain this, and in what order do they happen?
Show answer
Data masking replaces the names with placeholders before the prompt leaves Salesforce. Demasking then swaps the placeholders back to the real names in the response before the user sees it. Masking happens on the way out and demasking on the way back.
Exercise
Your team wants to test whether a larger model improves a Flex template's summaries. Describe how to run the test so the result is trustworthy.
Show answer
Clone the active template version and change only the model. Leave the prompt text, merge fields and input record the same. Preview both versions against the same record, or several representative records, and compare the outputs. Changing only one variable shows whether the model caused the difference.