Skip to content

SSC-027: apr-cli: wire real training execution for --task classify #335

@noahgift

Description

@noahgift

SSC-027: End-to-End CLI Execution

Priority: P2
Blocked by: SSC-026 (training loop)
Blocks: —
Contract: References training-loop-v1.yaml

Problem

apr finetune --task classify currently only does plan mode (VRAM estimation, pipeline summary). It does not actually execute training. The last mile: wire the real ClassifyTrainer::train() invocation from the CLI.

What Exists

  • CLI argument parsing for --task classify, --num-classes, --data, --method lora
  • Config construction and pipeline summary display
  • Plan-mode output (VRAM estimation, parameter count)
  • ClassifyTrainer (after SSC-026) with full training loop

What's Missing

  1. Actual training invocation in run_classify():

    • Load tokenizer (BPE from HuggingFace or ShellVocab)
    • Load base model weights (from_safetensors)
    • Create ClassifyPipeline with LoRA
    • Create ClassifyTrainer
    • Call trainer.train(corpus)
    • Save final adapter + classification head
  2. Progress reporting:

    • Per-epoch: loss, accuracy, LR, time
    • ETA estimation
    • Final summary with best metrics
  3. Model saving:

    • Save LoRA adapter as .apr format
    • Save classification head weights
    • Save training config for reproducibility
    • Generate model card
  4. Integration test:

    • apr finetune --task classify --data test_corpus.jsonl --epochs 2 --batch-size 4
    • Verify model files created
    • Verify training completed without error

Acceptance Criteria

  • apr finetune --task classify --data corpus.jsonl actually trains
  • Progress output shows loss/accuracy per epoch
  • Final adapter saved to output path
  • --plan still works (no regression)
  • Integration test passes
  • Documentation updated with full usage examples

References

  • CLI dispatch in crates/apr-cli/src/commands/finetune.rs
  • Spec: bashrs/docs/specifications/shell-safety-inference.md Section 14

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium prioritySSCShell Safety ClassifierenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions