Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

S³ (Sequential Self-feeding Slot Prediction)

CBT-based panic-disorder reframing dialogue framed as task-oriented dialogue state tracking.
A T5 model predicts belief-state slots sequentially in an order derived from Ellis's ABC model, feeding each prediction into the prompt for the next slot.

Files

  • common.py — shared prompt constants and utilities
  • run_language_modeling.py — training (--do_train) / evaluation (--do_eval)
  • run_generate.py — inference: sequential slot generation from a trained checkpoint

Slot order

event → thought → symptoms → cognitive distortion → client cognitive distortion → system response

Each step's prompt:

task: {dialogue state | system response} || context: {C_t} || question: {slot question}

From the second slot on, previously predicted values (except "Not mentioned") are appended as natural-language descriptions. Use --random_shuffled / --reverse for ablations on slot order.

Install

pip install torch transformers pandas numpy tqdm tensorboard

(--fp16 requires apex)

Usage

Train + eval

python run_language_modeling.py \
    --train_src_file data/train.csv --eval_src_file data/dev.csv \
    --output_dir outputs/s3-t5-base \
    --model_type t5 --model_name_or_path t5-base \
    --do_train --do_eval \
    --per_gpu_train_batch_size 4 --num_train_epochs 10 \
    --learning_rate 5e-5 --alpha 0.7 --gamma 1.0

Eval only

python run_language_modeling.py \
    --eval_src_file data/test.csv --output_dir outputs/s3-t5-base \
    --model_type t5 --model_name_or_path outputs/s3-t5-base --do_eval

Generate

python run_generate.py \
    --model_name_or_path outputs/s3-t5-base \
    --prompts_from_file data/test.csv \
    --path_output predictions/test_result.csv \
    --length 100

Key arguments

arg description
--alpha weight of aux (yes/no) loss (default 0.7)
--gamma weight of system-response loss vs. DST loss (default 1.0)
--block_size max tokenized length (defaults to model's model_max_length)
--random_shuffled use a fixed alternate slot order
--reverse reverse slot order
--should_continue resume from latest checkpoint in output_dir
--save_total_limit cap number of saved checkpoints

About

Code and data for "S3: Sequential Self-feeding Slot Prediction for Explainable Cognitive Reframing in Task-Oriented Dialogue" (ACM HEALTH)

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages