# SuperGEM local transformer fine-tuning config.
# This is a LoRA/QLoRA supervised fine-tuning pipeline, not browser-side training.
# Replace base_model with your local path or Hugging Face model id.

project:
  name: supergem-marketplace-copilot
  seed: 42
  output_dir: ai/checkpoints/supergem-marketplace-lora
  logging_dir: ai/outputs/logs

model:
  # Good low-VRAM default for a first smoke test. For your GEM/SuperGEM base, put a local path here.
  base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
  trust_remote_code: false
  torch_dtype: auto
  attn_implementation: auto

quantization:
  # Set false for full fine-tune / standard LoRA on enough VRAM.
  load_in_4bit: true
  bnb_4bit_quant_type: nf4
  bnb_4bit_compute_dtype: bfloat16
  bnb_4bit_use_double_quant: true

lora:
  enabled: true
  r: 16
  alpha: 32
  dropout: 0.05
  bias: none
  task_type: CAUSAL_LM
  # Common Llama/Mistral/Qwen style projection names. Adjust if your base model differs.
  target_modules:
    - q_proj
    - k_proj
    - v_proj
    - o_proj
    - gate_proj
    - up_proj
    - down_proj

data:
  train_file: ai/data/example_marketplace_sft.jsonl
  validation_file:
  text_field:
  max_seq_length: 2048
  add_eos_token: true
  response_template: "### Response:"

training:
  epochs: 2
  per_device_train_batch_size: 1
  per_device_eval_batch_size: 1
  gradient_accumulation_steps: 8
  learning_rate: 0.0002
  weight_decay: 0.01
  warmup_ratio: 0.03
  lr_scheduler_type: cosine
  max_grad_norm: 1.0
  logging_steps: 5
  save_steps: 50
  eval_steps: 50
  save_total_limit: 3
  gradient_checkpointing: true
  bf16: auto
  fp16: auto
  optim: paged_adamw_8bit
  report_to: none

inference_test:
  prompt: "Audit this creative marketplace project brief and identify missing scope, risk, and next questions."
  max_new_tokens: 220
  temperature: 0.7
