Skip to content

armgit / Soup

Public Imported from GitHub
0

Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.

fix(advise): print the ROI table when --probe-model implies --probe (#1448 slice) (#1521)

qwist1233-cpuc6271bffe354
diff --git a/changelog.d/0.75.1/1521.fixed.md b/changelog.d/0.75.1/1521.fixed.md
new file mode 100644
index 00000000..57a9986f
--- /dev/null
+++ b/changelog.d/0.75.1/1521.fixed.md
@@ -0,0 +1 @@
+- **`soup advise run --probe-model X` ran the live probe and hid its ROI table (#1448 by @qwist1233-cpu in #1521).** `--probe-model` implies `--probe` and the probe ran under that derived flag, but the `ROI deltas (probe)` table was gated on the raw `--probe` option. The table now follows the same flag as the probe.
diff --git a/src/soup_cli/commands/advise.py b/src/soup_cli/commands/advise.py
index 7d8f75b0..db868e72 100644
--- a/src/soup_cli/commands/advise.py
+++ b/src/soup_cli/commands/advise.py
@@ -330,7 +330,7 @@ def advise_run(
raise typer.Exit(1) from exc
console.print(_render_verdict_panel(verdict, profile_row_count=profile.row_count))
- if probe:
+ if run_probe: # #1448 — --probe-model implies --probe; show what it measured.
console.print(_render_roi_table(roi))
_write_last_verdict(verdict)
diff --git a/tests/test_issue1448_advise_probe_model_roi_table.py b/tests/test_issue1448_advise_probe_model_roi_table.py
new file mode 100644
index 00000000..04777298
--- /dev/null
+++ b/tests/test_issue1448_advise_probe_model_roi_table.py
@@ -0,0 +1,87 @@
+"""#1448 — `soup advise run --probe-model X` runs the live probe but hid its ROI table.
+
+`--probe-model` implies `--probe` (``run_probe = probe or probe_model is not None``),
+and the probe is run and paid for under that derived flag, but the table was gated
+on the raw ``probe`` option. The table must follow the same flag as the probe.
+"""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+
+import pytest
+from typer.testing import CliRunner
+
+import soup_cli.commands.advise as advise
+from soup_cli.cli import app
+
+ROWS = [
+ {"instruction": f"Summarise item {i}", "output": f"Item {i} short."}
+ for i in range(12)
+]
+
+
+def dataset(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
+ monkeypatch.chdir(tmp_path) # keep advise_history / last-verdict out of the repo
+ path = tmp_path / "data.jsonl"
+ path.write_text("\n".join(json.dumps(r) for r in ROWS) + "\n", encoding="utf-8")
+ return path
+
+
+def fake_probe(monkeypatch: pytest.MonkeyPatch) -> dict:
+ calls: dict = {"baselines": 0, "lora": 0, "proximity": 0}
+
+ def baselines(rows, *, model=None, device=None):
+ calls["baselines"] += 1
+ return {"zero_shot": 0.1, "few_shot": 0.2, "rag": 0.3}
+
+ def lora(rows, *, model=None, device=None):
+ calls["lora"] += 1
+ return 0.4, 12.0
+
+ def proximity(rows, *, model=None, device=None):
+ calls["proximity"] += 1
+ return 0.5
+
+ monkeypatch.setattr(advise, "synth_probe_baselines", baselines)
+ monkeypatch.setattr(advise, "synth_probe_lora_delta", lora)
+ monkeypatch.setattr(advise, "measure_base_model_proximity", proximity)
+ return calls
+
+
+def test_probe_model_alone_prints_the_roi_table(dataset: Path, fake_probe: dict) -> None:
+ result = CliRunner().invoke(
+ app, ["advise", "run", str(dataset), "--probe-model", "org/tiny"]
+ )
+ assert result.exit_code == 0, result.output
+ # The probe ran (and on a real model would have been paid for)...
+ assert fake_probe == {"baselines": 1, "lora": 1, "proximity": 1}
+ # ...so its result must be shown.
+ assert "ROI deltas" in result.output
+ assert "prompt_eng" in result.output and "sft ETA" in result.output
+
+
+def test_probe_model_with_explicit_probe_still_prints(dataset: Path, fake_probe: dict) -> None:
+ result = CliRunner().invoke(
+ app, ["advise", "run", str(dataset), "--probe-model", "org/tiny", "--probe"]
+ )
+ assert result.exit_code == 0, result.output
+ assert "ROI deltas" in result.output
+
+
+def test_no_probe_prints_no_table(dataset: Path, fake_probe: dict) -> None:
+ result = CliRunner().invoke(app, ["advise", "run", str(dataset)])
+ assert result.exit_code == 0, result.output
+ assert fake_probe == {"baselines": 0, "lora": 0, "proximity": 0}
+ assert "ROI deltas" not in result.output
+
+
+def test_plain_probe_prints_the_roi_table(dataset: Path, fake_probe: dict) -> None:
+ result = CliRunner().invoke(app, ["advise", "run", str(dataset), "--probe"])
+ assert result.exit_code == 0, result.output
+ # --probe alone is the heuristic probe: no model, so no proximity measurement.
+ assert fake_probe == {"baselines": 1, "lora": 1, "proximity": 0}
+ assert "ROI deltas" in result.output