Building Fair Housing Guardrails for Real Estate LLMs: Zillow's Multi-Strategy Approach to Preventing Discrimination

zillow · Other · 2024 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.5 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Real estate conversational AI, fair housing compliance, and responsible AI

Zillow wanted to explore LLM-powered conversational real-estate experiences, but generic LLMs can produce discriminatory or steering responses when user prompts include protected-class characteristics. In real-estate search, lending, marketing, and transaction contexts, this can create Fair Housing Act, ECOA, and state/local anti-discrimination risk. Zillow therefore needed guardrails that could block both user inputs and model outputs that might facilitate steering while still allowing legitimate queries such as accessible-housing searches.

Constraints:

Architecture

Zillow designed an LLM Fair Housing Guardrails system that combines three approaches: FHA compliance instructions in the LLM prompt, a syntactic stop list for unambiguous offensive terms, and a fine-tuned BERT-based sequence classifier for contextual fair-housing classification. The guardrail is exposed as a standalone service/API that validates both user inputs and system responses. It runs before the LLM as a pre-processing filter and after the LLM as a post-processing validator; flagged content is replaced by a predefined fair-housing message. The classifier was trained from real-estate query data, LLM-generated response data, legal/domain expert examples, sentence-level labels, weak labels reviewed by humans, and augmentation techniques.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  real-estate-conversational-interface[Real-estate conversational interface] --> fair-housing-guardrails-service[Fair Housing Guardrails service]
  fair-housing-guardrails-service --> stop-list-matcher[Stop list matcher]
  fair-housing-guardrails-service --> fair-housing-compliance-classifier[Fair Housing Compliance classifier]
  fair-housing-guardrails-service --> guardrails-api[Guardrails API]
  guardrails-api --> llm-application[LLM application]
  guardrails-api --> pre-processing-validator[Pre-processing validator]
  guardrails-api --> post-processing-validator[Post-processing validator]
  pre-processing-validator --> llm-application
  pre-processing-validator --> predefined-compliance-response[Predefined compliance response]
  llm-application --> fha-compliance-prompt-instructions[FHA compliance prompt instructions]
  llm-application --> post-processing-validator
  post-processing-validator --> predefined-compliance-response
  predefined-compliance-response --> real-estate-conversational-interface
  fair-housing-compliance-classifier --> classifier-training-data[Classifier training data]
  classifier-training-data --> legal-and-domain-experts[Legal and domain experts]
  legal-and-domain-experts --> classifier-training-data
  data-augmentation[Data augmentation] --> classifier-training-data
  user-feedback-loop[User feedback loop] --> stop-list-matcher
  user-feedback-loop --> classifier-training-data
  fair-housing-guardrails-service --> user-feedback-loop
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Real-estate conversational interface Multi-turn customer-facing interface for real-estate questions, search refinement, agent introductions, loan-officer handoff, and offer guidance. Fair Housing Guardrails service
Fair Housing Guardrails service Standalone service that combines stop-list matching and the Fair Housing Compliance classifier. Stop list matcher, Fair Housing Compliance classifier, Guardrails API, User feedback loop
Guardrails API Integration surface that validates both user inputs and LLM responses for LLM applications. LLM application, Pre-processing validator, Post-processing validator
Pre-processing validator Analyzes and categorizes user input before the LLM processes it. Fair Housing Guardrails service, LLM application, Predefined compliance response
LLM application Conversational real-estate LLM experience with FHA compliance instructions in its prompt. FHA compliance prompt instructions, Post-processing validator
FHA compliance prompt instructions Prompt guidance that tells the LLM to refuse protected-class requests and avoid discriminatory real-estate responses. LLM application
Post-processing validator Reviews LLM outputs before display and flags potentially non-compliant content. Fair Housing Guardrails service, Predefined compliance response
Predefined compliance response Canned user-facing message shown when content is blocked for fair-housing reasons. Real-estate conversational interface
Stop list matcher Fast lexical matcher for unambiguous severe protected-class phrases. Fair Housing Guardrails service
Fair Housing Compliance classifier Fine-tuned BERT sequence classifier that detects potential FHA violations with tunable precision/recall. Classifier training data, Fair Housing Guardrails service
Classifier training data Real-estate queries, generated responses, hand-crafted legal/domain examples, sentence-level labels, weak labels, and augmented examples. Legal and domain experts, Data augmentation, Fair Housing Compliance classifier
Legal and domain experts Provide hand-crafted examples, labeling guidelines, and human review of weak labels. Classifier training data
Data augmentation Back-translation, paraphrasing, word embedding swaps, and neighboring-character swaps used to expand examples. Classifier training data
User feedback loop Ongoing user feedback and sampled human review that find false positives/negatives and add decision-boundary training examples. Stop list matcher, Classifier training data

Data flow

A user sends a real-estate conversational query. The Fair Housing Guardrails service first checks the input using stop-list matching and the Fair Housing Compliance classifier. The LLM prompt also includes FHA compliance instructions to improve the likelihood of compliant generation. After the LLM produces a response, the same service validates the output before display. If the input or output is flagged, a predefined fair-housing response is shown instead. User feedback and sampled data for human review update the stop list and add boundary examples for classifier retraining.

4 supporting quotes
“Guardrails system should combine all three strategies into a single comprehensive system. This system has been designed and deployed internally for testing as follows: 1. A standalone service that combines both a stop list with a fast lexical match, as well as fast inference using the Fair”article, stated
“A service API ready for integration with an LLM application, both to process and validate user input, as well as to validate the response from the system.”article, stated
“As a pre-processing component, the fair housing guardrail analyzes and categorizes user input before it is processed by the LLM.”article, stated
“In its role as a post-processing component, the fair housing guardrail reviews the output from the LLM, flagging any content that might potentially violate fair housing regulations before it is displayed to the user. For flagged content, a predefined message”article, stated

Why this architecture

Zillow combines prompt instructions, stop lists, and a classifier because each alone has a failure mode. Prompting is simple but over-cautious and non-deterministic; stop lists are deterministic but lack context; the classifier adds nuanced semantic decision-making and tunable precision/recall. Putting the guardrail both before and after the LLM creates a safety net for user requests and generated responses.

3 supporting quotes
“the optimal LLM Fair Housing Guardrails system should combine all three strategies into a single comprehensive system.”article, stated
“the expressive power of the prompt-based solution, with the explicit control of the stop list and finally with the ability to tune the precision and recall of the classifier model.”article, stated
“This double layer of scrutiny, applied both before and after the LLM's operations, adds a robust safety net to the system.”article, stated

Models used: LLMs · Generative AI · BERT · Bidirectional Encoder Representations from Transformers · Sequence classification model · Binary cross entropy loss · Few-shot prompting

Scale

Alternatives considered (roads not taken)

Prompt-only fair housing compliance.

Rejected because: Prompting was simple and high-recall, but became over-cautious and refused permissible queries that only resembled protected-class language.

“The main advantage of a prompt-based approach is the simplicity of its implementation. The conversational behavior can be further refined via prompt engineering of the fair housing compliance instructions. While this approach covers and resolves a large”article, stated
“the system now has high recall with respect to detecting queries that may elicit a non-compliant response, but the precision is sub-optimal”article, stated

Stop list as the sole compliance mechanism.

Rejected because: Strict lexical matching cannot distinguish discriminatory protected-class usage from legitimate terms like accessible housing or place names.

“An obvious shortcoming of using a stop list is its reliance on a strict, lexical match without considering the context of the phrase.”article, stated
“It is clear, therefore, that stop lists should not be the sole method that is used to prevent housing discrimination.”article, stated

Classifier-only compliance.

Rejected because: Even though the classifier produced expected results on sample cases, Zillow says some scenarios may still be better handled by prompt guidance or stop lists.

“even though the Classifier method produced the expected results for all three of our sample test cases, there are still scenarios where the other methods might perform better.”article, stated

Full-response labeling for generated responses.

Rejected because: Longer responses may contain only one non-compliant sentence, making full-response labels too coarse for the model to learn the offending text.

“We labeled responses at a sentence level, since we found several longer responses that only contained one non-compliant sentence.”article, stated
“When responses are long, it can be difficult for the model to associate non-compliant labels with the offending sentence.”article, stated

Static one-time training data.

Rejected because: Zillow expects feedback and sampled human review to expose new phrasings, contexts, false positives, false negatives, and decision-boundary examples.

“User feedback is invaluable for improving the components of the fair housing guardrail. It not only provides real-world examples to learn from, but also exposes a wide range of phrasings, contexts, and nuances that might not have been encountered during”article, stated
“periodically sampling data for human review allows for the identification of false positives and false negatives.”article, stated

Patterns

guardrails-io-filtering (safety)

Zillow runs fair-housing checks both before the LLM sees user input and after it generates output, replacing flagged content with a predefined compliance message.

“it can be integrated both as a pre-processing and post-processing component.”article, stated
“For flagged content, a predefined message is displayed instead of the LLM output.”article, stated

safety-policy-enforcement (safety)

The system intentionally combines prompt instructions, stop-list lexical controls, and a trained classifier rather than relying on a single guardrail technique.

“the optimal LLM Fair Housing Guardrails system should combine all three strategies into a single comprehensive system.”article, stated
“A standalone service that combines both a stop list with a fast lexical match, as well as fast inference using the Fair Housing Compliance classifier.”article, stated

fine-tuning-adaptation (model-operations)

Zillow fine-tuned a BERT-based sequence classifier on domain-labeled real-estate examples to identify possible fair-housing violations with contextual nuance.

“we implemented a classification model based on Bidirectional Encoder Representations from Transformers (BERT)”article, stated
“We fine-tuned the base sequence classification model with a binary cross entropy loss function on labeled examples from our domain”article, stated

human-in-the-loop-gate (governance)

Legal and domain experts supply hand-crafted examples, sentence-level labeling guidelines, and review weak labels generated from few-shot prompting.

“We also used hand-crafted compliant and non-compliant queries from legal and domain experts in the areas of fair housing and fair lending.”article, stated
“weakly labeling refers to taking a first pass at generating labels, and then having a human expert review and validate the annotations.”article, stated

data-quality-loop (data)

User feedback and periodic human review identify false positives, false negatives, and decision-boundary examples used to improve the stop list and classifier over time.

“User feedback is invaluable for improving the components of the fair housing guardrail.”article, stated
“also contributes additional examples for training the classifier component that are closer to the decision boundary”article, stated

synthetic-data-generation (data)

Because naturally collected data was mostly compliant, Zillow created non-compliant and long-tail examples by modifying compliant queries, generating responses, weak labeling, and applying augmentation.

“Most of the collected data was compliant, so in order to get some non-compliant examples we sampled from a list of protected attribute values and discriminatory phrases.”article, stated
“To produce additional examples, we used several data augmentation techniques, including back-translation, paraphrasing, word embedding swap, and neighboring character swap.”article, stated

eval-driven-development (evaluation)

Zillow evaluates prompt, stop-list, and classifier strategies with sample queries, dataset labels, precision/recall tradeoffs, and response-level training data before combining them.

“The precision lift obtained by including sentence-level response data as part of the training data is shown in Figure 2”article, stated
“Finally, we summarize in Table 6 the three approaches discussed based on desirable properties and their dominant pros and cons”article, stated

Tradeoffs

Fair housing detection architecture

Chose combined prompt, stop-list, and classifier guardrails over choosing a single strategy.

Rationale: The combined design gets prompt expressiveness, stop-list explicit control, and classifier precision/recall tuning.

“the optimal LLM Fair Housing Guardrails system should combine all three strategies into a single comprehensive system.”article, stated
“allows us to leverage the expressive power of the prompt-based solution, with the explicit control of the stop list and finally with the ability to tune the precision and recall of the classifier model.”article, stated

Classifier model requirements

Chose fast BERT sequence classifier over slower or less tunable compliance reasoning inside the main LLM alone.

Rationale: The classifier has to run as part of the LLM reasoning flow and allow precision/recall sensitivity tuning.

“the model must be fast to execute as we expect its decision making to be a step in the LLM reasoning flow.”article, stated
“the sensitivity of the model must be tunable to achieve the desired tradeoff between precision”article, stated

Response labeling granularity

Chose sentence-level labels over full-response labels.

Rationale: Sentence-level labeling tells the classifier which exact sentence is non-compliant in longer responses.

“We labeled responses at a sentence level, since we found several longer responses that only contained one non-compliant sentence.”article, stated
“it can be difficult for the model to associate non-compliant labels with the offending sentence.”article, stated

Stop list scope

Chose sparing use for worst offending terms over broad protected-class lexical blocking.

Rationale: Broad lexical blocking creates false positives for legitimate terms and place names, so nuanced cases need classifier/review handling.

“stop lists should not be the sole method that is used to prevent housing discrimination.”article, stated
“used sparingly to unambiguously address the worst offending terms, and leave nuance to other methods.”article, stated

Guardrail placement

Chose both pre-processing and post-processing checks over only checking input or only checking output.

Rationale: Checking both sides catches non-compliant user requests early and catches generated output before users see it.

“it can be integrated both as a pre-processing and post-processing component.”article, stated
“This double layer of scrutiny, applied both before and after the LLM's operations, adds a robust safety net to the system.”article, stated

Gotchas (what bit them)

Prompt-only compliance over-blocked legitimate accessibility queries.

Root cause: The prompt treated any semantic connection to protected classes as suspicious, producing high recall but poor precision.

Resolution: Use prompt guidance only as one layer and add contextual detection through a classifier.

“Any semantic connection with the protected classes might result in a similar message, as indicated above.”article, stated
“the precision is sub-optimal, inadvertently withholding permissible information”article, stated

Stop lists misclassify context-dependent protected-class terms.

Root cause: Strict lexical matching cannot tell whether a term such as disabilities or Indian is discriminatory, accessible-housing related, a place name, or a point of interest.

Resolution: Use stop lists sparingly for unambiguous offensive phrases and leave nuanced cases to machine learning plus review.

“The stop list strategy is simply not sophisticated enough to address cases with semantic meaning that varies based on the context of the query.”article, stated
“this approach should be used sparingly to unambiguously address the worst offending terms, and leave nuance to other methods.”article, stated

Full-response labels can hide the actual violating sentence.

Root cause: Long model responses may contain only one non-compliant sentence, so response-level labels make it hard for the classifier to associate the label with the offending text.

Resolution: Label generated responses at sentence level using legal-expert guidelines.

“We labeled responses at a sentence level, since we found several longer responses that only contained one non-compliant sentence.”article, stated
“When responses are long, it can be difficult for the model to associate non-compliant labels with the offending sentence.”article, stated

High recall can damage the user experience through false positives.

Root cause: Fair housing compliance prioritizes catching violations, but low precision makes the assistant refuse legitimate queries.

Resolution: Tune the classifier's precision/recall tradeoff and use feedback/review to improve boundary cases.

“maximizing recall is of the utmost importance because it ensures that Fair Housing rules are never violated.”article, stated
“lower precision, which is manifest as a high rate of incorrectly flagging queries as “non-compliant” (i.e., false positives), creates a suboptimal product experience”article, stated

Naturally collected real-estate query data underrepresents violations.

Root cause: Most collected data was compliant, creating class imbalance for non-compliant examples.

Resolution: Sample protected attributes and discriminatory phrases, modify compliant examples, add legal/domain expert examples, generate responses, and augment the dataset.

“Most of the collected data was compliant, so in order to get some non-compliant examples we sampled from a list of protected attribute values and discriminatory phrases.”article, stated
“We also used hand-crafted compliant and non-compliant queries from legal and domain experts in the areas of fair housing and fair lending.”article, stated

Evaluation

Zillow evaluated the three strategies against fair-housing sample queries, analyzed precision/recall for non-compliant classification, trained a BERT sequence classifier on labeled domain examples, compared models with and without sentence-level response data, and used feedback and human review to identify false positives and false negatives.

Metrics: Precision and recall for the non-compliant label. · High recall for catching potential violations. · False positive rate as product-experience risk. · Precision lift from including sentence-level response data. · Classifier inference speed as an application-flow requirement. · Decision-boundary examples from human review.

4 supporting quotes
“precision and recall refers to classification accuracy metrics expressing how many of the detected instances are truly negative and how many true negatives have been detected.”article, stated
“maximizing recall is of the utmost importance because it ensures that Fair Housing rules are never violated.”article, stated
“lower precision, which is manifest as a high rate of incorrectly flagging queries as “non-compliant” (i.e., false positives), creates a suboptimal product experience”article, stated
“As shown, precision lift is maximized when recall is around 0.6. ![](https://www.zillowstatic.com/bedrock/app/uploads/sites/31/2024/01/LLMimage6.”article, stated

Outcomes

Zillow frames the guardrails as necessary for web and app experiences used by hundreds of millions of online housing searchers. The article reports internal testing and system design rather than public production impact metrics.

5 supporting quotes
“This system has been designed and deployed internally for testing as follows:”article, stated
“the Classifier method produced the expected results for all three of our sample test cases”article, stated
“For flagged content, a predefined message is displayed instead of the LLM output.”article, stated
“As shown, precision lift is maximized when recall is around 0.6. ![](https://www.zillowstatic.com/bedrock/app/uploads/sites/31/2024/01/LLMimage6.”article, stated
“It is worth noting that the standalone service can also be used in non-LLM applications requiring Natural Language Processing, for example in call transcript analytics.”article, stated