Skip to content

feat: add Finance causal-LM training and attack evaluation - #30

Open
soomro-abd wants to merge 1 commit into
mainfrom
feat/finance-causal-lm
Open

soomro-abd wants to merge 1 commit into
mainfrom
feat/finance-causal-lm

Conversation

@soomro-abd

Copy link
Copy Markdown
Collaborator

FLTest's text path currently trains classifiers, so pretrained causal language models cannot use the federated training and evaluation lifecycle. This adds a Finance causal-LM task to Flower with response-only training, LoRA-only parameter exchange, and text attack evaluation.

Changes

  • Load pretrained models with optional 4-bit NF4 quantization and FP16 computation; train PEFT LoRA adapters and save the final adapter, tokenizer, and run metadata atomically.
  • Prepare equal IID FinGPT sentiment shards with a grouped holdout, pinned Hub revisions, round-0 evaluation, generated-label accuracy, strict exact match, response loss, and raw prediction diagnostics.
  • Support per-client CPU/GPU resources and seeded client sampling. Weight clients by distinct records used in successful optimizer steps and retain those source IDs in round reports.
  • Add Finance label flipping, triggered-text backdoors with held-out ASR, and response-loss membership inference over actual trained records.
  • Run the existing clipping, noise, robust aggregation, FLDetector, and aggregation simulations on adapter arrays. Pass selected IDs to secure aggregation, seed rebuilt noise hooks by client and round, and reduce Krum's distance-computation memory use.
  • Validate supported LM configurations, fail the CLI on failed LM runs, and preserve legacy defaults and run identities. Add examples, documentation, regression tests, and a CPU CI job for the optional LM dependencies.

Validation

  • Full Linux suite on Python 3.11: 184 passed, 1 skipped (optional NVFlare).
  • Causal-LM suite: 59 passed, including real LoRA training on a tiny local GPT-2 model without Hub downloads or a GPU.
  • Two-node SPHERE cluster, two Quadro RTX 6000 GPUs: 11 SmolLM2-135M smoke scenarios passed, covering clean training, text poisoning, membership inference, and all eight adapter defenses. Audited trained-record IDs, holdout separation, membership probe counts, both worker hosts, and all 11 adapter checkpoints.
  • Sampled secure aggregation reported zero participant mismatches and zero mask residual; fixed-point aggregation reported zero overflow and approximately 1.91e-6 maximum absolute error against FedAvg.
  • Separate clean Mistral-7B checks passed for two rounds and for one timed round with 10 sampled clients from 50 partitions.
  • git diff --check passes.

The small GPU smoke sets verify integration. They do not establish attack efficacy, defense effectiveness, or benchmark-level model quality.

Scope and follow-ups

This milestone supports Finance on Flower with LoRA. Stack Overflow full-model training, Medical data/evaluation and gradient accumulation, reference-backend LM parity, GPU repeatability oracles, Finance leaderboard benchmarks and learning-rate scheduling, learning-gap pitfall warnings, and checkpoint/resume support remain follow-up work. DoRA is optional future work. Secure aggregation remains a masking/arithmetic simulation, and gradient noise has no differential-privacy accountant.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant