# myracheng/elephant architecture

> Architecture diagram of the GitHub repository myracheng/elephant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/myracheng/elephant
- Repository: https://github.com/myracheng/elephant

## Overview

ELEPHANT is a research toolkit for evaluating social and moral sycophancy in language-model responses and comparing results with human baselines. Its main workflow is to run inference on prompt datasets, score responses for validation, indirectness, and framing, then compare those scores with human results; moral sycophancy is scored separately from paired, flipped-perspective outputs. The README documents broader paper-reproduction analyses, but their notebook internals were not sampled, so those links reflect documentation rather than inspected implementation.

Main entry points: [`get_responses_gpt.py`](https://github.com/myracheng/elephant/blob/main/get_responses_gpt.py) (GPT inference), [`full_results_from_paper/get_model_responses.py`](https://github.com/myracheng/elephant/blob/main/full_results_from_paper/get_model_responses.py) (Multi-model inference), [`sycophancy_scorers.py`](https://github.com/myracheng/elephant/blob/main/sycophancy_scorers.py) (Social metrics), [`moral_sycophancy_scorer.py`](https://github.com/myracheng/elephant/blob/main/moral_sycophancy_scorer.py) (Moral metric)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Prompt datasets"]
  node_datasets["Prompt datasets"]
end

subgraph group_inference["Response generation"]
  node_responses["Model responses"]
  node_gpt_inference["GPT inference"]
  node_paper_inference["Multi-model inference"]
end

subgraph group_metrics["Sycophancy metrics"]
  node_social_metrics["Social metrics"]
  node_moral_metric["Moral metric"]
  node_scored_results["Scored results"]
end

subgraph group_analysis["Comparison and research"]
  node_human_comparison["Human comparison"]
  node_paper_analysis["Paper analyses"]
end

node_researcher(("Researcher"))
node_openai["OpenAI API"]
node_model_providers["Model providers"]

node_researcher -->|"runs inference"| node_gpt_inference
node_researcher -->|"runs inference"| node_paper_inference
node_datasets -->|"provides prompts"| node_gpt_inference
node_datasets -->|"provides prompts"| node_paper_inference
node_gpt_inference -->|"requests responses"| node_openai
node_paper_inference -->|"dispatches inference"| node_model_providers
node_gpt_inference -->|"writes responses"| node_responses
node_paper_inference -->|"writes responses"| node_responses
node_researcher -->|"runs scoring"| node_social_metrics
node_responses -->|"provides responses"| node_social_metrics
node_social_metrics -->|"requests judgments"| node_openai
node_social_metrics -->|"writes metric scores"| node_scored_results
node_researcher -->|"runs scoring"| node_moral_metric
node_responses -->|"provides paired outputs"| node_moral_metric
node_moral_metric -->|"writes rates"| node_scored_results
node_scored_results -->|"compares with humans"| node_human_comparison
node_scored_results -->|"analyzes results"| node_paper_analysis
node_researcher -->|"reviews comparison"| node_human_comparison

click node_datasets "https://github.com/myracheng/elephant/tree/main/sample_datasets"
click node_gpt_inference "https://github.com/myracheng/elephant/blob/main/get_responses_gpt.py"
click node_paper_inference "https://github.com/myracheng/elephant/blob/main/full_results_from_paper/get_model_responses.py"
click node_social_metrics "https://github.com/myracheng/elephant/blob/main/sycophancy_scorers.py"
click node_moral_metric "https://github.com/myracheng/elephant/blob/main/moral_sycophancy_scorer.py"
click node_human_comparison "https://github.com/myracheng/elephant/blob/main/compare_to_human.ipynb"
click node_paper_analysis "https://github.com/myracheng/elephant/tree/main/full_results_from_paper/sycophancy_analyses"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_datasets toneBlue
class node_responses,node_gpt_inference,node_paper_inference toneAmber
class node_social_metrics,node_moral_metric,node_scored_results,node_openai toneMint
class node_human_comparison,node_paper_analysis toneRose
class node_researcher,node_model_providers toneIndigo
```

## Components

### Prompt datasets

- [Prompt datasets](https://github.com/myracheng/elephant/tree/main/sample_datasets): `sample_datasets`

### Response generation

- **Model responses**
- [GPT inference](https://github.com/myracheng/elephant/blob/main/get_responses_gpt.py): `get_responses_gpt.py`
- [Multi-model inference](https://github.com/myracheng/elephant/blob/main/full_results_from_paper/get_model_responses.py): `full_results_from_paper/get_model_responses.py`

### Sycophancy metrics

- [Social metrics](https://github.com/myracheng/elephant/blob/main/sycophancy_scorers.py): `sycophancy_scorers.py`
- [Moral metric](https://github.com/myracheng/elephant/blob/main/moral_sycophancy_scorer.py): `moral_sycophancy_scorer.py`
- **Scored results**

### Comparison and research

- [Human comparison](https://github.com/myracheng/elephant/blob/main/compare_to_human.ipynb): `compare_to_human.ipynb`
- [Paper analyses](https://github.com/myracheng/elephant/tree/main/full_results_from_paper/sycophancy_analyses): `full_results_from_paper/sycophancy_analyses`

### Other components

- **Researcher**
- **OpenAI API**
- **Model providers**

## Connections

- Researcher → GPT inference: runs inference (evidence: `README.md`)
- Researcher → Multi-model inference: runs inference (evidence: `README.md`)
- Prompt datasets → GPT inference: provides prompts (evidence: `README.md`)
- Prompt datasets → Multi-model inference: provides prompts (evidence: `README.md`)
- GPT inference → OpenAI API: requests responses (evidence: `get_responses_gpt.py`)
- Multi-model inference → Model providers: dispatches inference (evidence: `full_results_from_paper/get_model_responses.py`)
- GPT inference → Model responses: writes responses (evidence: `get_responses_gpt.py`)
- Multi-model inference → Model responses: writes responses (evidence: `full_results_from_paper/get_model_responses.py`)
- Researcher → Social metrics: runs scoring (evidence: `README.md`)
- Model responses → Social metrics: provides responses (evidence: `README.md`)
- Social metrics → OpenAI API: requests judgments (evidence: `sycophancy_scorers.py`)
- Social metrics → Scored results: writes metric scores (evidence: `README.md`)
- Researcher → Moral metric: runs scoring (evidence: `README.md`)
- Model responses → Moral metric: provides paired outputs (evidence: `README.md`)
- Moral metric → Scored results: writes rates (evidence: `moral_sycophancy_scorer.py`)
- Scored results → Human comparison: compares with humans (evidence: `README.md`)
- Scored results → Paper analyses: analyzes results (evidence: `README.md`)
- Researcher → Human comparison: reviews comparison (evidence: `README.md`)
