How zero-9215/online-cl-llms works
Purpose and entry points
This is an offline research pipeline for parameter-efficient continual learning of LLMs across ordered NLP tasks, supporting Long_Sequence and SuperNI benchmarks. Training starts by generating shell scripts with gen_script_new_long_llama.py or gen_script_new_superni_llama.py; scoring is invoked through score.py. Core model runners are src/run_llama_new.py and src/run_t5_new.py.
Benchmark data boundary
Raw benchmark data is file-backed JSON, separated by task and split. Long_Sequence contains classification-style datasets with explicit label files, e.g. CL_Benchmark/Long_Sequence/agnews/train.json and CL_Benchmark/Long_Sequence/agnews/labels.json. SuperNI contains instruction/generation tasks, e.g. CL_Benchmark/SuperNI/task1290_xsum_summarization/train.json. No serving, database, or remote data service is represented.
Continual-task orchestration
Task order/split selection is controlled independently from raw examples through per-task train_tasks.json, dev_tasks.json, and test_tasks.json. Benchmark-specific plans live in configs/Long_Sequence/agnews/train_tasks.json and configs/SuperNI/task002_quoref_answer_generation/train_tasks.json; combined experiment plans are under configs/SuperNI_Long_Sequence/. This configuration layer is the boundary between a benchmark corpus and an ordered continual-learning run.
Dataset, batching, and prompt adaptation
The primary training path turns configured task examples into model-ready continual-learning batches through src/cl_dataset.py and src/cl_collator.py. Model-family prompt formatting is split between src/llama_prompt_new.py and src/t5_prompt_new.py, keeping dataset/task representation separate from tokenizer/model-specific serialization. A repository-local GPT-2 tokenizer asset is available at data/gpt2tokenizer/tokenizer.json.
Training and parameter-efficient adaptation
src/cl_trainer.py owns the continual-training loop used by the Llama/T5 runners. Generated datasets show separate artifacts for LoRA-based Llama and T5 runs, such as generated_data/lora_gen_long_llama/Long_Sequence/agnews/train.json and generated_data/lora_gen_long_t5/Long_Sequence/agnews/train.json. The alternate pseudo-data workflow vendors PEFT implementations—including LoRA, AdaLoRA, prompt/prefix tuning—under pseudo_data/src/peft_1/tuners/lora.py and pseudo_data/src/peft_1/tuners/adalora.py.
Pseudo-data / lookback branch
A distinct “Ours_CL” branch stores lookback pseudo-data per prior SuperNI task, e.g. pseudo_data/CL_Benchmark/Ours_CL/lookback_task002_quoref_answer_generation/train.json, with matching task configurations in pseudo_data/configs/Ours_CL_configs/. Its executable stack is separate: pseudo_data/src/run_uie_lora.py, pseudo_data/src/uie_dataset_lora_ours.py, and pseudo_data/src/uie_trainer_lora.py. This is a meaningful boundary from the main src/ CL pipeline.
Evaluation and runtime infrastructure
score.py aggregates continual-learning results into AP, forgetting rate, FWT, and BWT. Task-level metrics are implemented in src/compute_metrics.py, with bundled ROUGE code in src/rouge/rouge.py; the pseudo branch has parallel evaluation at pseudo_data/src/evaluation/evaluator.py. Training infrastructure includes DeepSpeed stage/offload configurations in configs/ds_configs/stage0.config through configs/ds_configs/stage3.config, including Llama-specific variants. Dependencies are declared in requirements.txt; no external runtime services are identified.
Main entry points: train_tasks.json Task order and splits · cl_trainer.py Continual trainer · cl_collator.py Continual batch collator · cl_dataset.py Continual dataset
Components 25
Experiment Planning
Defines ordered tasks independently of raw benchmark examples.
- Long Sequence script generator
gen_script_new_long_llama.py - SuperNI script generator
gen_script_new_superni_llama.py - Task order and splits · Selects train, development, and test task sequences.
configs/Long_Sequence/agnews/train_tasks.json - Combined benchmark plans
Main Continual Learning
Primary Llama and T5 training pipeline.
- Continual dataset
src/cl_dataset.py - Continual batch collator
src/cl_collator.py - Llama prompt formatter
src/llama_prompt_new.py - T5 prompt formatter
src/t5_prompt_new.py - GPT-2 tokenizer
data/gpt2tokenizer/tokenizer.json - Llama runner
src/run_llama_new.py - T5 runner
src/run_t5_new.py - Continual trainer
src/cl_trainer.py - Generated training data · Stores model-family-specific generated datasets.
generated_data/lora_gen_long_llama/Long_Sequence/agnews/train.json - DeepSpeed configs · Stage and offload configurations for distributed training.
configs/ds_configs/stage0.config
Pseudo-data Lookback
Separate Ours_CL execution stack.
- Lookback pseudo-data · Stores prior-task examples for Ours_CL.
pseudo_data/CL_Benchmark/Ours_CL/lookback_task002_quoref_answer_generation/train.json - Ours_CL task configs
- UIE LoRA runner
pseudo_data/src/run_uie_lora.py - UIE LoRA dataset
pseudo_data/src/uie_dataset_lora_ours.py - UIE LoRA trainer
pseudo_data/src/uie_trainer_lora.py - Vendored PEFT tuners · Provides LoRA, AdaLoRA, prompt, and prefix tuning variants.
pseudo_data/src/peft_1/tuners/lora.py
Evaluation
- Continual score aggregator · Computes AP, forgetting, FWT, and BWT.
score.py - Task metrics and ROUGE
src/compute_metrics.py - Pseudo branch evaluator
pseudo_data/src/evaluation/evaluator.py
Other components
- Long Sequence corpus · Classification examples and explicit labels are file-backed.
CL_Benchmark/Long_Sequence/agnews/train.json - SuperNI corpus · Instruction and generation tasks are file-backed.
CL_Benchmark/SuperNI/task1290_xsum_summarization/train.json
Connections 26
- Long Sequence script generator → Task order and splits: generates runs from
- SuperNI script generator → Task order and splits: generates runs from
- Combined benchmark plans → Task order and splits: combines task sequences
- Task order and splits → Long Sequence corpus: selects tasks from
- Task order and splits → SuperNI corpus: selects tasks from
- Long Sequence corpus → Continual dataset: examples
- SuperNI corpus → Continual dataset: examples
- Task order and splits → Continual dataset: task order and splits
- Continual dataset → Continual batch collator: task examples
- Llama prompt formatter → Continual batch collator: serializes prompts
- T5 prompt formatter → Continual batch collator: serializes prompts
- GPT-2 tokenizer → Continual batch collator: tokenization
- Continual batch collator → Continual trainer: continual batches
- Llama runner → Continual trainer: runs
- T5 runner → Continual trainer: runs
- DeepSpeed configs → Continual trainer: runtime configuration
- Continual trainer → Generated training data: writes generated data
- Ours_CL task configs → UIE LoRA runner: configures
- Lookback pseudo-data → UIE LoRA dataset: lookback examples
- UIE LoRA dataset → UIE LoRA trainer: batches
- UIE LoRA runner → UIE LoRA trainer: runs
- Vendored PEFT tuners → UIE LoRA trainer: parameter-efficient tuning
- Continual trainer → Task metrics and ROUGE: predictions
- Task metrics and ROUGE → Continual score aggregator: task results
- UIE LoRA trainer → Pseudo branch evaluator: predictions
- Pseudo branch evaluator → Continual score aggregator: continual results