Skip to content
/ SS-GEN Public

AAAI2025 Paper (Oral) "SS-GEN: A Social Story Generation Framework with Large Language Models" (SS-GEN)

Notifications You must be signed in to change notification settings

MIMIFY/SS-GEN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SS-GEN: A Social Story Generation Framework with Large Language Models (AAAI 2025 Oral)

Paper License: OpenRAIL Dataset

🧠 Introduction

SS-GEN is a novel framework for automated generation of Social Storiesβ„’ aimed at helping children with Autism Spectrum Disorder (ASD) better understand and navigate social situations. Social Stories have traditionally been written by psychologists under strict guidelines β€” however, this process is costly, time-consuming, and lacks diversity.

SS-GEN leverages Large Language Models (LLMs) and a custom-designed, constraint-driven strategy (STARSOW) to generate personalized, high-quality Social Stories at scale.

SS-GEN Overview

πŸ“ Abstract

Children with Autism Spectrum Disorder (ASD) often struggle to interpret social cues and engage in daily routines. Social Storiesβ„’, designed to improve these abilities, are typically handcrafted by experts, limiting their scalability. To address this, we propose SS-GEN, a framework that prompts LLMs to generate constraint-compliant Social Stories using a novel strategy named STARSOW. We further curate a high-quality dataset via human filtering and propose a structured evaluation framework. Finally, we fine-tune lightweight open-source models on our dataset, achieving strong results with lower cost and easier deployment. SS-GEN represents a significant step in creating accessible, affordable, and automated tools to assist ASD communities.

🌳 Framework: STARSOW

The STARSOW pipeline includes:

  1. Taking Root: Generating diverse chapter themes from seed examples.
  2. Branching Out: Producing multiple Social Story titles under each chapter.
  3. Bearing Star Fruits: Completing full stories from titles, guided by strict structural and narrative constraints.
  4. Gardening Work: Rigorous filtering to ensure quality, relevance, and safety.

SS-GEN Framework

πŸ› οΈ Implementation: StarSOW Method

This repository provides a complete implementation of the StarSOW method for generating Social Stories datasets. The implementation is organized into two main components:

πŸ“ Repository Structure

πŸ“‚ SS-GEN/
β”œβ”€β”€ seed_data_gen/              # Seed dataset generation
β”‚   β”œβ”€β”€ seed_data/              # Generated seed data
β”‚   β”œβ”€β”€ seed_ main.py           # Main script for seed data generation
β”‚   β”œβ”€β”€ openai_access.py        # OpenAI API interface
β”‚   β”œβ”€β”€ utils.py                # Utility functions
β”‚   └── explain_chapter.py      # Chapter explanation generation
β”œβ”€β”€ hierarchical_instruct/      # StarSOW pipeline implementation
β”‚   β”œβ”€β”€ bootstrap_chapters_breadth.py      # Step 1: Chapter generation
β”‚   β”œβ”€β”€ bootstrap_titles_breadth_depth.py  # Step 2: Title generation
β”‚   β”œβ”€β”€ bootstrap_stories_depth.py         # Step 3: Story generation
β”‚   β”œβ”€β”€ gpt3_api.py                        # GPT API wrapper
β”‚   β”œβ”€β”€ prompt_complete_social_story.py    # Story generation prompts
β”‚   β”œβ”€β”€ data/                              # Generated data and processing
β”‚   β”œβ”€β”€ visualization/                     # Data visualization tools
β”‚   └── command_generate_story.sh          # Batch generation script
β”œβ”€β”€ SS-GEN Dataset/             # Final dataset
β”œβ”€β”€ README.md
└── Technical Appendix.pdf      # Detailed prompt templates

πŸš€ Quick Start

Prerequisites

pip install openai tqdm numpy pandas rouge-score datasets

Step 1: Generate Seed Dataset

First, prepare your seed Social Stories data and generate chapter explanations:

cd seed_data_gen
python seed_ main.py

This will:

  • Load your original Social Stories data (pure-ori.json)
  • Generate chapter explanations using GPT
  • Create structured seed data for the StarSOW pipeline

Step 2: Generate Chapters (Taking Root)

Expand the seed chapters to create a diverse set of chapter themes:

cd hierarchical_instruct
python bootstrap_chapters_breadth.py \
    --seed_stories_path ../seed_data_gen/seed_data/seed_chapters_explanations.jsonl \
    --batch_dir data/gpt4_test_generations \
    --num_chapters_to_generate 56 \
    --engine gpt-4o \
    --api_key YOUR_API_KEY \
    --base_url YOUR_BASE_URL

Step 3: Generate Titles (Branching Out)

For each chapter, generate multiple Social Story titles:

python bootstrap_titles_breadth_depth.py \
    --seed_stories_path ../seed_data_gen/seed_data/seed_chapter_title_list.jsonl \
    --input_file machine_generated_chapters_explanations.jsonl \
    --batch_dir data/gpt4_test_generations \
    --num_titles_to_generate 70 \
    --engine gpt-4o \
    --api_key YOUR_API_KEY \
    --base_url YOUR_BASE_URL

Step 4: Generate Stories (Bearing Star Fruits)

Complete the Social Stories from titles using strict structural constraints:

python bootstrap_stories_depth.py \
    --seed_stories_path ../seed_data_gen/seed_data/seed_chapter_story_list.jsonl \
    --input_folder Titles generation \
    --batch_dir data/gpt4_test_generations \
    --output_seed_folder Stories generation/Seed_Titles \
    --output_expand_folder Stories generation/Generated_Titles_from_gpt4 \
    --engine gpt-4o \
    --api_key YOUR_API_KEY \
    --base_url YOUR_BASE_URL

Step 4.1: Batch Generation (Optional)

Use the provided shell script for automated batch processing:

bash command_generate_story.sh

πŸ”§ Configuration

API Configuration

Update your API credentials in the respective scripts:

# In gpt3_api.py or individual scripts
api_key = "your-openai-api-key"
base_url = "your-api-base-url"  # Optional, for custom endpoints

Generation Parameters

Key parameters you can adjust:

  • --num_chapters_to_generate: Number of chapters to generate (default: 56)
  • --num_titles_to_generate: Titles per chapter (default: 70)
  • --num_prompt_demonstrations: Few-shot examples in prompts (default: 4-10)
  • --engine: LLM model (gpt-4o, gpt-3.5-turbo, etc.)

πŸ“Š Data Processing and Visualization

The hierarchical_instruct/data/ folder contains:

  • Generated chapters, titles, and stories
  • Processing scripts for data cleaning

The hierarchical_instruct/visualization/ folder includes:

  • Data distribution analysis

🎯 Quality Control

The implementation includes several quality control mechanisms:

  1. Rouge-based Similarity Filtering: Removes highly similar generated content
  2. Length Constraints: Ensures stories meet minimum/maximum word counts
  3. Structural Validation: Verifies proper story structure (introduction, main body, conclusion)
  4. Content Safety: Filters inappropriate or unsafe content
  5. Human Refined: Human-curated and further refined for the final SS-GEN dataset.

πŸ“ˆ Monitoring Progress

Each generation step provides progress bars and detailed logging:

# Example output
Loaded 14 human-written seed chapters and explanations.
Loaded 0 existing machine-generated chapters and explanations.
Outer loop for total chapters which need to be titles-expanded: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 14/14 [02:15<00:00]

πŸ”„ Resuming Generation

The system supports resuming interrupted generation:

  • Automatically detects existing generated files
  • Continues from the last completed step
  • Maintains consistency with request_idx tracking

πŸ“Š Dataset

We construct a large-scale Social Story dataset:

Item Description
Chapters 57 diverse themes
Titles in each chapter >=70
Total stories 5,085
Avg. chapter length (in words) 2.46
Avg. title length (in words) 5.28
Avg. story content length (in words) 281.65
Structure Title + Introduction + Body + Conclusion
Constraints Structural Clarity, Descriptive Orientation, Situational Safety

πŸ§ͺ Load Dataset via Hugging Face πŸ€— (Recommend)

from datasets import load_dataset

# Login using e.g. `huggingface-cli login` to access this dataset
ds = load_dataset("FMiMiY/SS-GEN")

πŸ”— View on Hugging Face

πŸ“ˆ Results

  • We fine-tuned several 2B–8B models (e.g., Gemma, Mistral, LLaMA3).
  • Fine-tuned models significantly outperformed zero-shot baselines across BLEU, ROUGE, and BERTScore.
  • Human evaluation confirmed improvements in empathy, coherence, and narrative safety.

Citation

If you use SS-GEN or our dataset, please cite:

@inproceedings{feng2025ss,
  title={SS-GEN: A Social Story Generation Framework with Large Language Models},
  author={Feng, Yi and Song, Mingyang and Wang, Jiaqi and Chen, Zhuang and Bi, Guanqun and Huang, Minlie and Jing, Liping and Yu, Jian},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  volume={39},
  number={2},
  pages={1300--1308},
  year={2025}
}

🀝 Acknowledgments

This work is supported by Beijing Jiaotong University, Tsinghua University, and Tencent. Special thanks to psychologists, educators, and collaborators who helped shape and evaluate this project.

πŸ“¬ Contact

If you have any questions, suggestions or feedback, feel free to submmit a issue or contact :

Yi Feng – yifeng@bjtu.edu.cn

About

AAAI2025 Paper (Oral) "SS-GEN: A Social Story Generation Framework with Large Language Models" (SS-GEN)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published