Researchers from Zillow and the University at Buffalo have developed a specialized "recipe" for fine-tuning a Llama-3-8B model to become a domain-specific chatbot that strictly adheres to U.S. fair housing laws. By utilizing a high-quality synthetic dataset focused on legal compliance, their 8-billion parameter model matches or exceeds the performance of significantly larger models like GPT-4o and Llama-3-70B in both helpfulness and safety.
The Compliance Challenge in Real Estate AI
The real estate industry in the United States has a complex history of discriminatory practices, specifically steering (directing buyers toward or away from neighborhoods based on protected characteristics) and redlining. While the Fair Housing Act (FHA) was established to prevent these practices, the rise of Large Language Models (LLMs) introduces a new risk: these models often inadvertently replicate biases found in their massive training datasets.
Even state-of-the-art models like GPT-4o can fail these compliance checks. For example, a model might recommend neighborhoods based on a user's religious preferences, which directly violates fair housing regulations. This research addresses the challenge of building a "compliance-aware" AI that provides expert advice without crossing legal or ethical lines.
Methodology: Building the Specialist
The authors employed a multi-stage pipeline to transform a general-purpose model into a real estate expert:
- Synthetic Data Generation: Using GPT-4o as a "teacher," they generated a dataset of real estate instructions across 90 core topics, such as property taxes and mortgages.
- Safety Alignment: The model was specifically trained to recognize non-compliant queries. Instead of a simple refusal, the model is taught to explain why a query is non-compliant (e.g., citing the FHA) before pivoting to a helpful, legal alternative. This strategy maintains user trust while ensuring safety.
- Semantic Pruning: To ensure dataset quality and diversity, a pruning algorithm based on semantic similarity was used to remove redundant examples.
- Fine-Tuning: The researchers used LoRA (Low-Rank Adaptation) to efficiently fine-tune the Llama-3-8B-Instruct model, allowing for domain adaptation without the high cost of full parameter training.
Datasets and Evaluation
The study introduced a comprehensive three-part synthetic dataset, which has been open-sourced:
- General Instructions: ~16,600 examples covering 90 real estate topics.
- Safety Split: ~7,100 examples focused on navigating FHA and Equal Credit Opportunity Act (ECOA) scenarios.
- Dialog Split: ~1,700 multi-turn conversations to improve follow-up handling.
To evaluate the model, the team created two new benchmarks: a First-time Home Buyers Benchmark derived from real Zillow user questions, and a Legal Safety Benchmark manually crafted by legal experts to test the model's compliance limits.
Key Results
The results demonstrate that domain specificity can trump scale. In head-to-head safety benchmarks, the fine-tuned 8B model was preferred 86% of the time over Llama-3-70B.
As shown in the performance metrics, the 8B model achieved a "Helpfulness without reference" score of 99.58, actually outperforming GPT-4o (98.67). Furthermore, the researchers found a 95.56% correlation between their AI-based safety judge and human legal experts, validating the use of LLMs for automated compliance auditing in regulated industries.
Limitations and Future Work
Despite these advancements, several hurdles remain for production-ready systems. The model currently relies on static training data and cannot access real-time listings or interest rates. Future work will likely involve integrating Retrieval-Augmented Generation (RAG) to provide live, compliant property data. Additionally, while the model handles U.S. laws effectively, adapting it for international markets would require new safety datasets tailored to local regulations.
Summary updated