How jubayeronrob/proactive-conversation-assistant works
Purpose and Entry Points
This is a research/training repository for a proactive conversation assistant: Stage 1 detects dialogue moments needing intervention; Stage 2 generates short contextual hints. Primary executable entry points are experiments/runner.py for Stage 1, experiments/stage2_train.py and experiments/stage2_eval.py for generation, plus the end-to-end notebook Notebooks/inference-full.ipynb.
1. Corpus Reconstruction and Canonicalization
The dataset layer converts source conversational corpora and marker annotations into tokenizer-independent, character-offset-aligned examples. It supports AMI and ICSI sources, corpus profiles/splits, marker processing, labeling, and output emission.
Paths: pca/corpora/emit.py, pca/corpora/labeling.py, pca/corpora/ami.py, pca/corpora/icsi.py.
Dataset-build validation and canonical-index generation sit outside runtime training.
Paths: analysis/build_canonical_index.py, analysis/validate_v3.py, orchestration/recon_dataset2.py.
2. Stage 1 Gating Data and Models
Stage 1 consumes tokenized dialogue windows and binary proactive-activation labels. pca/data.py is the dataset/input boundary; pca/models.py defines decoder and baseline model integration; pca/trainer.py owns training/evaluation control flow. Loss variants—including focal loss for sparse triggers—are isolated in pca/losses.py.
Paths: pca/data.py, pca/models.py, pca/trainer.py, pca/losses.py.
3. Configured Experiment Runner
Stage 1 runs are configuration-driven: YAML files select model, loss, and run parameters, and experiments/runner.py executes them. The experiment matrix compares decoder-only families and RoBERTa, with focal/weighted-CE ablations and resume configurations.
Paths: experiments/runner.py, experiments/configs/e1-llama-32-1b-focal.yaml, experiments/configs/e0b-roberta-natural-512.yaml.
Run metadata is captured through pca/runinfo.py; aggregate run state is represented in results/RUN_MANIFEST.csv.
4. Retrieval and Memory-Augmented Hint Context
The system has explicit retrieval and memory modules for supplying Stage 2 with relevant conversational context rather than treating generation as a standalone prompt. Retrieval configuration generation and sweeps form the experimentation boundary around this capability.
Paths: pca/retrieval.py, pca/memory.py, experiments/rag_sweep.py, analysis/make_rag_configs.py.
5. Stage 2 Hint Generation and Judging
Stage 2 trains and evaluates a generative model on gated contexts, enforcing short hint outputs and measuring generated text quality. pca/stage2.py is the shared Stage 2 domain layer; scripts separate training, automatic evaluation, and LLM-rubric judging.
Paths: pca/stage2.py, experiments/stage2_train.py, experiments/stage2_eval.py, experiments/judge_stage2.py.
Judge artifacts are persisted separately from model metrics.
Paths: results/judge/, results/s2_model_metrics.json.
6. Evaluation, Statistical Analysis, and Research Outputs
Core scoring includes conventional evaluation plus fast scoring, rubric definitions, and dataset statistics. Analysis scripts consume results to produce tables, significance tests, diagnostics, and paper-ready figures.
Paths: pca/evaluate.py, pca/fastscore.py, pca/rubrics.py, analysis/build_all.py, analysis/build_stage2_tables.py.
Generated outputs feed the three LaTeX reports.
Paths: paper/tier1_report/main.tex, paper/tier2_report/main.tex, paper/dataset2_report/main.tex.
7. Compute and External-Service Boundary
The project targets Python 3.10+ with CUDA GPUs; dependencies are declared in requirements.txt. Training and evaluation are dispatched to Kaggle T4/P100-style environments and Modal/remote infrastructure, with adapter/checkpoint publishing and upload workflows.
Paths: orchestration/dispatch.py, orchestration/kaggle_t4.py, orchestration/modal_stage2.py, orchestration/publish_ckpt.py.
External dependencies include LlamaPIE source data, Hugging Face model ecosystems, Kaggle GPU execution, and Modal; judge result naming also indicates Fireworks-backed judging runs.
Main entry points: trainer.py Stage 1 trainer · emit.py Canonical emitter · stage2_eval.py Stage 2 evaluation · dispatch.py Remote dispatch
Components 20
Corpus pipeline
Reconstructs canonical dialogue examples from AMI and ICSI.
- Corpus adapters · AMI and ICSI source conversion.
pca/corpora/ami.py - Canonical emitter · Emits character-offset-aligned examples and labels.
pca/corpora/emit.py - Marker labeling
pca/corpora/labeling.py - Canonical validation · Builds indices and validates reconstructed data.
analysis/validate_v3.py
Stage 1 gating
Trains proactive-activation detectors.
- Gating dataset · Tokenized dialogue windows with binary activation labels.
pca/data.py - Detector models · Decoder-only and baseline model families.
pca/models.py - Trigger losses · Includes focal loss and weighted cross-entropy.
pca/losses.py - Stage 1 trainer · Owns detector training and evaluation flow.
pca/trainer.py - Experiment runner · Executes YAML-configured Stage 1 runs.
experiments/runner.py - Run manifest
results/RUN_MANIFEST.csv
Retrieval and Stage 2
Builds context and generates short hints.
- Retrieval and memory · Selects relevant conversational context for hint generation.
pca/retrieval.py - RAG sweeps · Generates and executes retrieval configurations.
experiments/rag_sweep.py - Stage 2 domain · Shared gated-context and short-hint logic.
pca/stage2.py - Stage 2 training
experiments/stage2_train.py - Stage 2 evaluation · Automatically evaluates generated hints.
experiments/stage2_eval.py - LLM rubric judge · Persists judge artifacts separately from model metrics.
experiments/judge_stage2.py
Evaluation and research outputs
Scores experiments and produces reports.
- Scoring and rubrics · Conventional, fast, and rubric-based scoring.
pca/evaluate.py - Analysis builders · Builds tables, significance tests, diagnostics, and figures.
analysis/build_all.py - LaTeX reports · Tier and dataset reports consume generated findings.
paper/tier1_report/main.tex
Compute boundary
Dispatches GPU and remote runs.
- Remote dispatch · Kaggle, Modal, checkpoint publishing, and upload workflows.
orchestration/dispatch.py
Connections 23
- Corpus adapters → Canonical emitter: source conversations
- Marker labeling → Canonical emitter: marker labels
- Canonical emitter → Canonical validation: canonical dataset
- Canonical emitter → Gating dataset: dialogue examples
- Gating dataset → Stage 1 trainer: windows and labels
- Detector models → Stage 1 trainer: model
- Trigger losses → Stage 1 trainer: loss selection
- Experiment runner → Stage 1 trainer: YAML-configured run
- Stage 1 trainer → Run manifest: run metadata
- Stage 1 trainer → Retrieval and memory: gated dialogue moments
- RAG sweeps → Retrieval and memory: retrieval configurations
- Retrieval and memory → Stage 2 domain: relevant context
- Stage 2 domain → Stage 2 training: training domain
- Stage 2 domain → Stage 2 evaluation: generation evaluation
- Stage 2 evaluation → LLM rubric judge: generated hints
- Stage 2 evaluation → Scoring and rubrics: model outputs
- LLM rubric judge → Scoring and rubrics: rubric results
- Scoring and rubrics → Analysis builders: scores and metrics
- Run manifest → Analysis builders: experiment results
- Analysis builders → LaTeX reports: tables and figures
- Remote dispatch → Experiment runner: Stage 1 GPU jobs
- Remote dispatch → Stage 2 training: Stage 2 GPU jobs
- Remote dispatch → Stage 2 evaluation: remote evaluation