# Quality Filtering: Removing Sycophantic Responses

Canonical: https://hyperparam.app/docs/usecases/quality-filtering

Filter out low-quality, overly agreeable responses from a chat log dataset using LLM-generated quality scores.

## Overview

Starting with a 200k-row chat log dataset ([ultrachat_200k](https://hyperparam.app/files?key=https%3A%2F%2Fhuggingface.co%2Fdatasets%2FHuggingFaceH4%2Fultrachat_200k%2Fresolve%2Frefs%252Fconvert%252Fparquet%2Fdefault%2Ftrain_gen%2F0000.parquet)), generate a sycophancy score for each conversation, then filter out highly sycophantic responses.

![Demo showing removing sycophantic responses in Hyperparam](https://s3.hyperparam.app/video/Quality_Filtering.gif)

## Steps

1. **Load the dataset**

   Open [ultrachat_200k/train_gen/0000](https://hyperparam.app/files?key=https%3A%2F%2Fhuggingface.co%2Fdatasets%2FHuggingFaceH4%2Fultrachat_200k%2Fresolve%2Frefs%252Fconvert%252Fparquet%2Fdefault%2Ftrain_gen%2F0000.parquet)

2. **Generate sycophancy scores**

   Open the chat panel on the right-hand side

   Use chat to request: "add a 0-1 sycophancy score for each row"

   > **Note:** Hyperparam analyzes each conversation and creates a `sycophancy_score` column (0.0 = authentic, 1.0 = highly sycophantic).

3. **Sort by the new column**

   Click the `sycophancy_score` column header to sort the table ascending or descending by sycophancy

4. **Create a SQL view**

   In chat, request: "create a view of rows with sycophancy_score < 0.2"

   Hyperparam calls `add_view` with a query like:

   ```sql
   SELECT * FROM "0000.parquet" WHERE sycophancy_score < 0.2
   ```

   > **Note:** Views are saved to the workspace and can be selected from the file browser. Unlike the old filter UI, views are composable: you can build views on top of views, JOIN across sources, and express anything SQL supports.

5. **Export the view**

   Open the view tab, click the ⋮ button, and choose "Write Table"

   Select export options: columns, max rows, file name (e.g., `ultrachat_200k_filtered.parquet`)

   > **Note:** Export runs the view's SQL over the full dataset.

## Expected Results

- **Generated column**: `sycophancy_score` rating each response's authenticity
- **Filtered dataset**: Only rows with sycophancy score < 0.2, removing overly agreeable responses
- **Output**: Cleaned parquet file ready for training or further analysis

---

## Other Use Cases

- [Dataset Discovery](https://hyperparam.app/docs/usecases/dataset-discovery): Use natural language to find public datasets
- [Classifying Prompt Patterns](https://hyperparam.app/docs/usecases/data-transformation): Categorize unstructured prompts to see your real traffic mix
- [Patient Data Workflow](https://hyperparam.app/docs/usecases/patient-data-workflow): Extract, filter, and export structured medical data
- [Deep Research](https://hyperparam.app/docs/usecases/summary-comparison): Multi-step AI workflow for comparing model outputs
