Skip to content

Conversation

@chethan-rfai
Copy link
Collaborator

@chethan-rfai chethan-rfai commented Feb 11, 2026

Changes

  • Added Sanity Test for SFT.
  • Takes about 5 mins to run (1 Epoch - Max steps 8)
  • Currently limited to use only 1 GPU for testing due NCCL Error
  • Pre-requisite: Python 3.12, Pytest, Rapidfireai (Installation still needs to be automated)
  • cmd to run test : pytest /home/ubuntu/sanity/tests/test_rf_sft_sanity.py -v (On the Server
  • Folder structure:
    sanity/
    ├── scripts/
    │ ├── rf-tutorial-sft-chatqa-sanity-1.py
    │ ├── rf-tutorial-sft-chatqa-sanity-1.ipynb
    │ └── validations/
    │ └── validate_log_sft.py
    ├── tests/
    │ └── test_rf_sft_sanity.py
    └── logs/
    └── .gitkeep (test_rf_sft_sanity.log is written here when the test runs)

Testing

  • [ yes] I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • [ yes] I have tested this change manually
  • [ yes] I have tested this change in the following environments:
    • [ yes] Local development
    • Docker environment
    • Other: _______________

Screenshots (if applicable)

Screenshot 2026-02-10 at 10 02 04 PM Screenshot 2026-02-10 at 10 38 20 PM

Checklist

  • [yes ] My code follows the project's style guidelines
  • [ yes] I have performed a self-review of my own code
  • [ yes] I have commented my code, particularly in hard-to-understand areas
  • [ no] I have made corresponding changes to the documentation
  • [ yes] My changes generate no new warnings
  • [ yes] I have added tests that prove my fix is effective or that my feature works
  • [ na] New and existing unit tests pass locally with my changes
  • [yes ] Any dependent changes have been merged and published

Performance Impact

No

Related Issues

Fixes #(issue number)
Closes #(issue number)
Related to #(issue number)


Note

Medium Risk
Adds a ~5 minute integration test that downloads models/datasets, uses GPUs, and depends on specific log text and paths, which can introduce CI flakiness and environment sensitivity despite being isolated to sanity/.

Overview
Adds an end-to-end SFT sanity check under sanity/ that runs a short RapidFire SFT grid search (4 configs, max_steps=8) on a small customer-support dataset slice and includes a companion notebook.

Introduces a log validator (validate_log_sft.py) and a pytest (test_rf_sft_sanity.py) that executes the training script, then asserts the RapidFire rapidfire.log contains expected worker/GPU setup messages, per-run step completion, and graceful worker shutdown; the script forces single-GPU execution via CUDA_VISIBLE_DEVICES=0 to avoid NCCL/DataParallel issues in CI.

Written by Cursor Bugbot for commit 522f53c. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

"\n",
"# Select a subset of the dataset for demo purposes\n",
"train_dataset=dataset[\"train\"].select(range(32))\n",
"eval_dataset=dataset[\"train\"].select(range(24,32))\n",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notebook eval dataset overlaps with training dataset

Medium Severity

The notebook's eval_dataset uses range(24, 32) which fully overlaps with train_dataset using range(32) (indices 0–31). This is data leakage — the model is evaluated on examples it trained on, producing artificially inflated metrics. The .py script correctly uses range(32, 40) for eval, so the notebook is inconsistent and wrong.

Fix in Cursor Fix in Web

) -> bool:
with open(log_path) as f:
content = f.read()
lines = content.splitlines()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable lines in validation script

Low Severity

lines = content.splitlines() is assigned on line 16 of validate_log_sft.py but never referenced anywhere in the function. All validations use content directly with re.search and in. This is dead code that adds unnecessary processing.

Fix in Cursor Fix in Web

"text": [
"Experiment exp1-chatqa-lite-1 created with Experiment ID: 5 and Metric Experiment ID: 5 at /home/ubuntu/rapidfireai/rapidfire_experiments/exp1-chatqa-lite-1\n"
]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notebook outputs are from a different experiment

Low Severity

The notebook's saved cell outputs come from a different experiment named exp1-chatqa-lite-1, but the code now creates exp1-chatqa-sanity-1. The outputs also show "Started 4 worker processes" while the sanity test is designed for 1 GPU. These stale outputs from a prior run are misleading as documentation of expected behavior.

Additional Locations (1)

Fix in Cursor Fix in Web

" logging_steps=2,\n",
" eval_strategy=\"steps\",\n",
" eval_steps=4,\n",
" fp16=True,\n",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notebook uses fp16 while script uses bf16

Low Severity

The notebook's RFSFTConfig uses fp16=True while the equivalent .py script uses bf16=True. These are different precision modes that produce different numerical results and have different hardware requirements (bf16 needs Ampere+ GPUs). Since both files represent the same sanity test, this config divergence means the notebook isn't a reliable reference for the script the test actually runs.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Collaborator

@david-rfai david-rfai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments both mine and bugbots and address them. Also, move sanity/ under the tests/ directory in the repo

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outputs in notebook need to be cleared

SCRIPTS_DIR = SANITY_DIR / "scripts"
VALIDATIONS_DIR = SCRIPTS_DIR / "validations"
LOGS_DIR = SANITY_DIR / "logs"
LOGS_BASE = Path("/home/ubuntu/rapidfireai/logs") # RapidFire experiment logs (unchanged)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base this variable off of Path.home()

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

Labels

testing Still testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants