Skip to content
ykwon0407Public

About

What LLMs Think When You Don’t Tell Them What to Think About?

Resources

Stars

15 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What LLMs Think When You Don't Tell Them What to Think About?

TL;DR: Our interactions with large language models (LLMs) are dominated by task- or topic-specific questions, such as “solve this coding problem” or “what is democracy?” This framing strongly shapes how LLMs generate responses, constraining the range of behaviors and knowledge that can be observed. We study the behavior of LLMs using minimal, topic-neutral prompts. Despite the absence of explicit task or topic specification, LLMs generate diverse content; however, each model family exhibits strong and systematic topical preferences. GPT-OSS favors programming and math, Llama leans literary, DeepSeek often produces religious content, and Qwen tends toward multiple-choice questions. We further observe that our generation settings can degenerate into repetitive or meaningless outputs, revealing model-specific quirks, such as Llama generating personal social media URLs.

Hugging Face Paper URL Paper URL

Key Results

Figure 1. UMAP visualzation generated by frontier LLMs when prompted with minimal seed phrases. We observe significant variation in topic preferences across model families, revealing distinct conceptual priors embedded during training. A high-quality image is provided in the paper.

Overview

This codebase provides tools for:

  1. Text Generation: Generate completions from LLMs using various starter phrases (chain-of-thought, rhetorical inquiry, conversational softeners, etc.)
  2. Data Cleaning: Remove repetitive patterns that can occur in unconstrained generation
  3. Embedding Extraction: Extract semantic embeddings for downstream analysis
  4. Semantic Labeling: Classify generated text into hierarchical topic categories
  5. Difficulty Labeling: Assess the complexity level of math and programming content

Project Structure

llm_tom_analysis/
├── configs/
│   └── text_completion.yaml    # Configuration for models and sampling
├── prompts/                     # Prompt templates for labeling tasks
│   ├── math_difficulty_prompt.txt
│   ├── programming_difficulty_prompt.txt
│   └── semantic_labeling_prompt.txt
├── src/
│   ├── generate_text_completion.py  # Main entry point for text generation
│   ├── generate_utils.py            # Generator class (LiteLLM/vLLM backends)
│   ├── clean_data.py                # Remove repetitive patterns from outputs
│   ├── extract_embedding.py         # Extract embeddings using Qwen3-Embedding
│   ├── semantic_labeling.py         # Open-vocabulary semantic classification
│   ├── level_test_labeling.py       # Difficulty labeling (basic→expert)
│   └── utils.py                     # Utility functions
├── data/                            # Data directory (not included in repo)
└── outputs/                         # Generated outputs directory

Setup

# Install dependencies
pip install vllm litellm pydantic tenacity pandas torch tqdm

# Set API key for API-based inference (optional)
export TOGETHER_API_KEY="your-api-key"

Requirements

  • Python 3.10+
  • vLLM (for local inference and embeddings)
  • LiteLLM (for API-based inference)
  • PyTorch
  • pandas, pydantic, tenacity

Usage

Step 1: Generate Text Completions

Generate text completions from LLMs using various starter phrases:

# Using API-based inference (LiteLLM)
python -m src.generate_text_completion \
    --config configs/text_completion.yaml \
    --model_key qwen2.5 \
    --backend litellm

# Using local GPU inference (vLLM)
python -m src.generate_text_completion \
    --config configs/text_completion.yaml \
    --model_key llama3.1 \
    --backend vllm

Step 2: Clean Generated Data

Remove repetitive patterns from generated outputs:

python -m src.clean_data \
    --raw-dir data/raw/model_outputs \
    --clean-dir data/clean/model_outputs

Step 3: Extract Embeddings

Extract semantic embeddings for analysis:

python -m src.extract_embedding \
    --model_outputs_dir data/clean/model_outputs \
    --embedding_dir data/embeddings

Step 4: Semantic Labeling

Classify generated text into semantic categories:

python -m src.semantic_labeling \
    --clean-dir data/clean/model_outputs \
    --label-dir data/semantic_labels/model_outputs

Step 5: Difficulty Labeling (Optional)

Label math and programming content by difficulty level:

python -m src.level_test_labeling \
    --input-file data/level_test/level_test_subset.csv \
    --model openai/gpt-oss-120b

Configuration

Edit configs/text_completion.yaml to configure:

  • Models: Available LLMs for both API and local inference
  • Sampling parameters: temperature, top_p, max_tokens, batch_size
  • Starter phrases: Various prompt categories for probing LLM priors
  • Output paths: Where to save generated sequences

License

This project is released for research purposes. Please cite our work if you use this codebase.

About

What LLMs Think When You Don’t Tell Them What to Think About?

Resources

Stars

15 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages