rho-eval 2.2.2__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. rho_eval-2.3.0/PKG-INFO +312 -0
  2. rho_eval-2.3.0/README.md +261 -0
  3. {rho_eval-2.2.2 → rho_eval-2.3.0}/pyproject.toml +11 -1
  4. rho_eval-2.3.0/src/knowledge_fidelity/__init__.py +17 -0
  5. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/__init__.py +10 -5
  6. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/alignment/__init__.py +2 -0
  7. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/alignment/dataset.py +19 -3
  8. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/alignment/losses.py +43 -0
  9. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/alignment/mlx_losses.py +94 -0
  10. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/alignment/mlx_trainer.py +263 -15
  11. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/alignment/trainer.py +71 -23
  12. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/audit.py +4 -0
  13. rho_eval-2.3.0/src/rho_eval/behaviors/bias.py +331 -0
  14. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/factual.py +2 -1
  15. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/overrefusal.py +19 -2
  16. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/refusal.py +19 -2
  17. rho_eval-2.3.0/src/rho_eval/behaviors/sycophancy.py +217 -0
  18. rho_eval-2.3.0/src/rho_eval/benchmarking/truthfulqa.py +157 -0
  19. rho_eval-2.3.0/src/rho_eval/cli/__init__.py +15 -0
  20. rho_eval-2.3.0/src/rho_eval/cli/rho_benchmark.py +484 -0
  21. rho_eval-2.3.0/src/rho_eval/cli/rho_surgery.py +322 -0
  22. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/hybrid/pipeline.py +24 -0
  23. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/hybrid/schema.py +29 -1
  24. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/output/exporters.py +27 -0
  25. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/output/schema.py +55 -0
  26. rho_eval-2.3.0/src/rho_eval/probes/data/bias/bridge_native.json +66 -0
  27. rho_eval-2.3.0/src/rho_eval/probes/data/bias/bridge_pairs.json +58 -0
  28. rho_eval-2.3.0/src/rho_eval/probes/data/bias/bridge_scaleup.json +317 -0
  29. rho_eval-2.3.0/src/rho_eval/probes/data/bias/gender_biology.json +218 -0
  30. rho_eval-2.3.0/src/rho_eval/probes/data/bias/sexual_orientation_biology.json +452 -0
  31. rho_eval-2.3.0/src/rho_eval/probes/data/deception/bridge_native.json +38 -0
  32. rho_eval-2.3.0/src/rho_eval/probes/data/deception/bridge_pairs.json +114 -0
  33. rho_eval-2.3.0/src/rho_eval/probes/data/deception/bridge_scaleup.json +72 -0
  34. rho_eval-2.3.0/src/rho_eval/probes/data/factual/expanded_150.json +1052 -0
  35. rho_eval-2.3.0/src/rho_eval/probes/data/overrefusal/expanded_70.json +78 -0
  36. rho_eval-2.3.0/src/rho_eval/probes/data/reasoning/bridge_native.json +34 -0
  37. rho_eval-2.3.0/src/rho_eval/probes/data/reasoning/bridge_pairs.json +58 -0
  38. rho_eval-2.3.0/src/rho_eval/probes/data/reasoning/bridge_scaleup.json +142 -0
  39. rho_eval-2.3.0/src/rho_eval/probes/data/reasoning/bridge_scaleup_v2.json +107 -0
  40. rho_eval-2.3.0/src/rho_eval/probes/data/reasoning/bridge_shortform.json +98 -0
  41. rho_eval-2.3.0/src/rho_eval/probes/data/refusal/expanded_100.json +602 -0
  42. rho_eval-2.3.0/src/rho_eval/probes/data/sycophancy/hard_100.json +802 -0
  43. rho_eval-2.3.0/src/rho_eval/probes/data/sycophancy/harder_pairs_16.json +114 -0
  44. rho_eval-2.3.0/src/rho_eval/probes/data/toxicity/bridge_native.json +82 -0
  45. rho_eval-2.3.0/src/rho_eval/probes/data/toxicity/bridge_pairs.json +114 -0
  46. rho_eval-2.3.0/src/rho_eval/probes/data/toxicity/bridge_scaleup.json +258 -0
  47. rho_eval-2.3.0/src/rho_eval/probes/data/toxicity/bridge_scaleup_v2.json +130 -0
  48. rho_eval-2.3.0/src/rho_eval/probes/data/toxicity/bridge_shortform.json +98 -0
  49. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/steering/__init__.py +34 -3
  50. rho_eval-2.3.0/src/rho_eval/steering/collect.py +428 -0
  51. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/steering/sae.py +42 -0
  52. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/steering/steer.py +21 -2
  53. rho_eval-2.3.0/src/rho_eval/surgical_planner.py +578 -0
  54. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/utils.py +79 -0
  55. rho_eval-2.3.0/src/rho_eval.egg-info/PKG-INFO +312 -0
  56. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval.egg-info/SOURCES.txt +30 -2
  57. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval.egg-info/entry_points.txt +2 -0
  58. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_cli.py +3 -2
  59. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_probes.py +3 -3
  60. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_registry.py +16 -11
  61. rho_eval-2.3.0/tests/test_surgery.py +586 -0
  62. rho_eval-2.2.2/PKG-INFO +0 -989
  63. rho_eval-2.2.2/README.md +0 -938
  64. rho_eval-2.2.2/src/knowledge_fidelity/__init__.py +0 -83
  65. rho_eval-2.2.2/src/rho_eval/behaviors/bias.py +0 -100
  66. rho_eval-2.2.2/src/rho_eval/behaviors/sycophancy.py +0 -94
  67. rho_eval-2.2.2/src/rho_eval/cli/__init__.py +0 -1
  68. rho_eval-2.2.2/src/rho_eval/steering/collect.py +0 -150
  69. rho_eval-2.2.2/src/rho_eval.egg-info/PKG-INFO +0 -989
  70. {rho_eval-2.2.2 → rho_eval-2.3.0}/LICENSE +0 -0
  71. {rho_eval-2.2.2 → rho_eval-2.3.0}/setup.cfg +0 -0
  72. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/__main__.py +0 -0
  73. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/audit.py +0 -0
  74. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behavioral.py +0 -0
  75. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/__init__.py +0 -0
  76. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/base.py +0 -0
  77. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/bias.py +0 -0
  78. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/factual.py +0 -0
  79. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/metrics.py +0 -0
  80. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/reasoning.py +0 -0
  81. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/sycophancy.py +0 -0
  82. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/behaviors/toxicity.py +0 -0
  83. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/calibration.py +0 -0
  84. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/cartography/__init__.py +0 -0
  85. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/cartography/engine.py +0 -0
  86. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/cartography/schema.py +0 -0
  87. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/cli/__init__.py +0 -0
  88. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/cli/rho_audit.py +0 -0
  89. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/core.py +0 -0
  90. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/denoise.py +0 -0
  91. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/output/__init__.py +0 -0
  92. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/output/comparator.py +0 -0
  93. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/output/exporters.py +0 -0
  94. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/output/schema.py +0 -0
  95. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/__init__.py +0 -0
  96. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/bias/bbq_300.json +0 -0
  97. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/factual/commonsense.json +0 -0
  98. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/factual/default.json +0 -0
  99. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/factual/mandela.json +0 -0
  100. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/factual/medical.json +0 -0
  101. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/factual/truthfulqa.json +0 -0
  102. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/reasoning/gsm8k_100.json +0 -0
  103. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/sycophancy/anthropic_150.json +0 -0
  104. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/data/toxicity/toxigen_200.json +0 -0
  105. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/probes/registry.py +0 -0
  106. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/svd/__init__.py +0 -0
  107. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/svd/compress.py +0 -0
  108. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/svd/freeze.py +0 -0
  109. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/svd/importance.py +0 -0
  110. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/knowledge_fidelity/utils.py +0 -0
  111. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/__main__.py +0 -0
  112. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/_compat.py +0 -0
  113. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behavioral.py +0 -0
  114. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/__init__.py +0 -0
  115. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/base.py +0 -0
  116. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/deception.py +0 -0
  117. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/metrics.py +0 -0
  118. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/reasoning.py +0 -0
  119. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/behaviors/toxicity.py +0 -0
  120. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/__init__.py +0 -0
  121. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/adversarial.py +0 -0
  122. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/leaderboard.py +0 -0
  123. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/loader.py +0 -0
  124. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/probe_registry.py +0 -0
  125. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/reports.py +0 -0
  126. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/schema.py +0 -0
  127. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/benchmarking/scorers.py +0 -0
  128. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/calibration.py +0 -0
  129. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cartography/__init__.py +0 -0
  130. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cartography/engine.py +0 -0
  131. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cartography/schema.py +0 -0
  132. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cli/rho_align.py +0 -0
  133. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cli/rho_audit.py +0 -0
  134. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cli/rho_bench.py +0 -0
  135. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cli/rho_hybrid.py +0 -0
  136. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cli/rho_interpret.py +0 -0
  137. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cli/rho_leaderboard.py +0 -0
  138. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/cli/rho_steer.py +0 -0
  139. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/core.py +0 -0
  140. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/denoise.py +0 -0
  141. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/hybrid/__init__.py +0 -0
  142. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/__init__.py +0 -0
  143. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/activation.py +0 -0
  144. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/heads.py +0 -0
  145. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/overlap.py +0 -0
  146. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/schema.py +0 -0
  147. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/subspaces.py +0 -0
  148. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/surgical.py +0 -0
  149. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/interpretability/visualize.py +0 -0
  150. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/output/__init__.py +0 -0
  151. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/output/comparator.py +0 -0
  152. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/__init__.py +0 -0
  153. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/bench/clinical.json +0 -0
  154. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/bench/logic.json +0 -0
  155. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/bench/social.json +0 -0
  156. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/bias/bbq_300.json +0 -0
  157. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/deception/hh_rlhf_100.json +0 -0
  158. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/factual/commonsense.json +0 -0
  159. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/factual/default.json +0 -0
  160. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/factual/mandela.json +0 -0
  161. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/factual/medical.json +0 -0
  162. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/factual/truthfulqa.json +0 -0
  163. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/overrefusal/benign_edgy_80.json +0 -0
  164. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/reasoning/gsm8k_100.json +0 -0
  165. /rho_eval-2.2.2/src/rho_eval/probes/data/refusal/harmful_benign_100.json → /rho_eval-2.3.0/src/rho_eval/probes/data/refusal/harmful_benign_50.json +0 -0
  166. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/sycophancy/anthropic_150.json +0 -0
  167. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/data/toxicity/toxigen_200.json +0 -0
  168. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/probes/registry.py +0 -0
  169. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/steering/analyze.py +0 -0
  170. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/steering/schema.py +0 -0
  171. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/steering/train.py +0 -0
  172. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/svd/__init__.py +0 -0
  173. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/svd/compress.py +0 -0
  174. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/svd/freeze.py +0 -0
  175. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval/svd/importance.py +0 -0
  176. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval.egg-info/dependency_links.txt +0 -0
  177. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval.egg-info/requires.txt +0 -0
  178. {rho_eval-2.2.2 → rho_eval-2.3.0}/src/rho_eval.egg-info/top_level.txt +0 -0
  179. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_alignment.py +0 -0
  180. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_benchmarking.py +0 -0
  181. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_interpretability.py +0 -0
  182. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_metrics.py +0 -0
  183. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_output.py +0 -0
  184. {rho_eval-2.2.2 → rho_eval-2.3.0}/tests/test_steering.py +0 -0
@@ -0,0 +1,312 @@
1
+ Metadata-Version: 2.4
2
+ Name: rho-eval
3
+ Version: 2.3.0
4
+ Summary: Behavioral auditing toolkit for LLMs — audit any model across 8 dimensions (factual, toxicity, bias, sycophancy, reasoning, refusal, deception, over-refusal) using teacher-forced confidence probes.
5
+ Author: Bryan Sanchez
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/SolomonB14D3/knowledge-fidelity
8
+ Project-URL: Repository, https://github.com/SolomonB14D3/knowledge-fidelity
9
+ Project-URL: Issues, https://github.com/SolomonB14D3/knowledge-fidelity/issues
10
+ Keywords: llm,behavioral-audit,rho-eval,rho-audit,model-auditing,false-beliefs,confidence,interpretability,truthfulness,bias-detection,sycophancy,toxicity,svd,compression,knowledge-fidelity,transformers,pytorch,mandela-effect,steering-vectors,activation-engineering,model-merging,mergekit,mechanistic-interpretability,fidelity-bench,truth-gap,adversarial-benchmark,rho-guided-sft,alignment,supervised-fine-tuning,calibration-repair,contrastive-loss,mlx,apple-silicon,contrastive-pretraining,behavioral-emergence,data-quality,scale-ladder,subspace-geometry
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: torch>=2.0
23
+ Requires-Dist: transformers>=4.36
24
+ Requires-Dist: numpy
25
+ Requires-Dist: scipy
26
+ Requires-Dist: datasets>=2.0
27
+ Provides-Extra: cartography
28
+ Requires-Dist: matplotlib>=3.7; extra == "cartography"
29
+ Requires-Dist: seaborn>=0.12; extra == "cartography"
30
+ Requires-Dist: tqdm; extra == "cartography"
31
+ Provides-Extra: eval
32
+ Requires-Dist: lm-eval>=0.4; extra == "eval"
33
+ Requires-Dist: datasets>=2.0; extra == "eval"
34
+ Provides-Extra: deploy
35
+ Requires-Dist: safetensors; extra == "deploy"
36
+ Provides-Extra: align
37
+ Requires-Dist: peft>=0.7; extra == "align"
38
+ Requires-Dist: datasets>=2.0; extra == "align"
39
+ Provides-Extra: demo
40
+ Requires-Dist: rho-eval[cartography]; extra == "demo"
41
+ Requires-Dist: gradio>=4.0; extra == "demo"
42
+ Requires-Dist: pandas; extra == "demo"
43
+ Provides-Extra: full
44
+ Requires-Dist: rho-eval[align,cartography,demo,deploy,eval]; extra == "full"
45
+ Requires-Dist: mlx>=0.5; sys_platform == "darwin" and extra == "full"
46
+ Requires-Dist: mlx-lm>=0.5; sys_platform == "darwin" and extra == "full"
47
+ Provides-Extra: dev
48
+ Requires-Dist: rho-eval[full]; extra == "dev"
49
+ Requires-Dist: pytest; extra == "dev"
50
+ Dynamic: license-file
51
+
52
+ # rho-eval v2.3.0: Behavioral Auditing for LLMs
53
+
54
+ [![PyPI](https://img.shields.io/pypi/v/rho-eval)](https://pypi.org/project/rho-eval/)
55
+ [![Paper: SFT](https://zenodo.org/badge/DOI/10.5281/zenodo.18854944.svg)](https://doi.org/10.5281/zenodo.18854944)
56
+ [![Paper: Grassmann](https://zenodo.org/badge/DOI/10.5281/zenodo.18865862.svg)](https://doi.org/10.5281/zenodo.18865862)
57
+ [![Paper: Phase Transitions](https://zenodo.org/badge/DOI/10.5281/zenodo.18865199.svg)](https://doi.org/10.5281/zenodo.18865199)
58
+ [![Paper: Confidence Cartography](https://zenodo.org/badge/DOI/10.5281/zenodo.18703506.svg)](https://doi.org/10.5281/zenodo.18703506)
59
+ [![Paper: CF90](https://zenodo.org/badge/DOI/10.5281/zenodo.18718545.svg)](https://doi.org/10.5281/zenodo.18718545)
60
+ [![Tests](https://img.shields.io/badge/tests-180%20passed-brightgreen)](tests/)
61
+ [![Demo](https://img.shields.io/badge/%F0%9F%A4%97%20Spaces-Demo-blue)](https://huggingface.co/spaces/bsanch52/knowledge-fidelity-demo)
62
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
63
+ [![MLX](https://img.shields.io/badge/Apple%20Silicon-MLX%20Accelerated-black?logo=apple)](https://github.com/ml-explore/mlx)
64
+ [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/SolomonB14D3)
65
+
66
+ **Measure where language models get surprising truths wrong — then fix it.**
67
+
68
+ rho-eval measures 8 behavioral dimensions — factual accuracy, toxicity, bias, sycophancy, reasoning, refusal, deception, and over-refusal — using Spearman rank correlation over teacher-forced confidence probes. It ships 1,826 probes as JSON with no internet required.
69
+
70
+ > *Formerly `knowledge-fidelity`. All v1.x imports still work.*
71
+
72
+ ## What It Does
73
+
74
+ | Module | Purpose |
75
+ |--------|---------|
76
+ | **`rho-audit`** | Behavioral auditing across 8 dimensions via confidence probes |
77
+ | **`rho-interpret`** | SVD subspace extraction and Grassmann angle analysis |
78
+ | **`rho-align`** | Rho-Guided SFT with contrastive auxiliary loss |
79
+ | **`rho-steer`** | SAE-based disentangled behavioral steering |
80
+ | **`rho-bench`** | Fidelity-Bench 2.0: adversarial pressure testing |
81
+ | **`rho-surgery`** | End-to-end behavioral repair: diagnose, compress, LoRA SFT, verify |
82
+ | **`rho-benchmark`** | Full benchmarking (8-dim audit + TruthfulQA MC2) with comparison |
83
+
84
+ ## Install
85
+
86
+ ```bash
87
+ pip install rho-eval # Core (auditing + SVD + probes)
88
+ pip install "rho-eval[full]" # Everything including MLX
89
+ ```
90
+
91
+ Or from source:
92
+
93
+ ```bash
94
+ git clone https://github.com/SolomonB14D3/knowledge-fidelity
95
+ cd knowledge-fidelity
96
+ pip install -e ".[full]"
97
+ ```
98
+
99
+ ## Quick Start
100
+
101
+ ### Python API
102
+
103
+ ```python
104
+ import rho_eval
105
+
106
+ # Audit any model across all 8 behaviors
107
+ report = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
108
+ print(report)
109
+ # <AuditReport model='Qwen/Qwen2.5-7B-Instruct' behaviors=8 status=WARN>
110
+
111
+ # Compare two models
112
+ baseline = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
113
+ repaired = rho_eval.audit("./repaired-7b/model/")
114
+ delta = rho_eval.compare(repaired, baseline)
115
+ print(delta.to_table()) # Colored delta table
116
+ ```
117
+
118
+ ### CLI
119
+
120
+ ```bash
121
+ # Full behavioral report card
122
+ rho-eval Qwen/Qwen2.5-7B-Instruct --behaviors all
123
+
124
+ # Specific behaviors, JSON output
125
+ rho-eval my-model/ --behaviors factual,bias,sycophancy --format json
126
+
127
+ # Compare against a baseline
128
+ rho-eval compressed-model/ --compare baseline.json
129
+
130
+ # Adversarial pressure test
131
+ rho-bench Qwen/Qwen2.5-7B-Instruct
132
+
133
+ # One-command behavioral repair
134
+ rho-surgery Qwen/Qwen2.5-7B-Instruct -o ./repaired-7b/
135
+
136
+ # Benchmark before vs after (8-dim audit + TruthfulQA MC2)
137
+ rho-benchmark ./repaired-7b/model/ --baseline Qwen/Qwen2.5-7B-Instruct
138
+ ```
139
+
140
+ ## Why This Exists
141
+
142
+ Language models fail where truth is surprising. Sycophancy picks the expected answer over the true one. Bias picks the stereotype over the individual. Standard SFT makes this worse in ways benchmarks don't catch.
143
+
144
+ rho-eval measures exactly where a model gets surprising truths wrong, and rho-guided SFT repairs it — without the alignment tax. See [our papers](#papers) for the full experimental story.
145
+
146
+ ## Built-In Probes (1,826 total)
147
+
148
+ All probes ship as JSON. No internet download needed.
149
+
150
+ | Behavior | Probe Sets | Count |
151
+ |----------|-----------|------:|
152
+ | Factual | default, mandela, medical, commonsense, truthfulqa, expanded | 206 |
153
+ | Bias | BBQ 300 + bridge probes + biology-grounded | 357 |
154
+ | Sycophancy | Anthropic model-written-evals | 150 |
155
+ | Toxicity | ToxiGen balanced | 200 |
156
+ | Reasoning | GSM8K + adversarial flattery | 100 |
157
+ | Deception | HH-RLHF honest/deceptive pairs | 100 |
158
+ | Refusal | harmful/benign pairs + expanded | 150 |
159
+ | Over-refusal | benign-but-edgy + expanded | 150 |
160
+ | Bench (Fidelity-Bench) | logic, social, clinical | 120 |
161
+
162
+ Run `rho-eval --list-probes` to see all available sets.
163
+
164
+ ### Custom Behaviors (Plugin System)
165
+
166
+ ```python
167
+ from rho_eval.behaviors import ABCBehavior, register
168
+
169
+ @register
170
+ class MyDomainBehavior(ABCBehavior):
171
+ name = "my_domain"
172
+ description = "Domain-specific evaluation"
173
+ probe_type = "confidence"
174
+ default_n = 50
175
+
176
+ def load_probes(self, n=None, seed=42, **kwargs):
177
+ return self._load_json_probes("my_domain/probes.json", n=n, seed=seed)
178
+
179
+ def evaluate(self, model, tokenizer, probes, device="cpu", **kwargs):
180
+ # Your evaluation logic
181
+ return BehaviorResult(behavior=self.name, rho=0.7, ...)
182
+
183
+ # Now available everywhere:
184
+ report = rho_eval.audit("my-model", behaviors=["factual", "my_domain"])
185
+ ```
186
+
187
+ ## Model Compatibility
188
+
189
+ Works on any HuggingFace causal LM with standard attention layouts.
190
+
191
+ **Validated:** Qwen2.5 (0.5B-32B), Mistral 7B, Llama 3.1 8B, GPT-2 (7M-210M scale ladder)
192
+
193
+ ## Apple Silicon (MLX)
194
+
195
+ rho-eval auto-dispatches to MLX on Apple Silicon. No code changes needed.
196
+
197
+ ```bash
198
+ pip install mlx mlx-lm # or: pip install "rho-eval[full]"
199
+ ```
200
+
201
+ ```python
202
+ import mlx_lm
203
+ from rho_eval import audit
204
+
205
+ model, tokenizer = mlx_lm.load("mlx-community/Qwen2.5-7B-Instruct-4bit")
206
+ report = audit(model=model, tokenizer=tokenizer, behaviors="all")
207
+ # Same API — ~5-10x faster on Apple Silicon
208
+ ```
209
+
210
+ | Component | MLX Speedup |
211
+ |-----------|:-----------:|
212
+ | `audit()` — 8-behavior probe suite | ~5x |
213
+ | `mlx_rho_guided_sft()` — alignment training | ~10x |
214
+ | `analyze_confidence()` — cartography | ~5x |
215
+
216
+ ## Compression Safety Guide
217
+
218
+ | Layer Type | Safe to Compress | Notes |
219
+ |------------|:---:|-------|
220
+ | Q, K, O projections | Yes (70% rank) | Main target |
221
+ | V projection | 90-95% only | High risk below 90% |
222
+ | MLP layers | Never | Destroys model at any level |
223
+
224
+ ## Limitations
225
+
226
+ - **Probe scale:** 1,826 probes across 37 sets. Spearman correlation is robust to small samples, but statistical power for subtle shifts is limited.
227
+ - **Western-centric:** Probes cover primarily English-language, U.S.-centric social categories.
228
+ - **7B scale.** Merge and steering results validated on 7B models. Larger scales (70B+) should not be extrapolated without verification.
229
+ - **Toxicity is unaffected** by weight edits — it relies on highly distributed lexical features that structural interventions cannot modulate.
230
+
231
+ ## Key Findings
232
+
233
+ - **Broad truth fixes propagate to narrow ones.** Repairing sycophancy via rho-guided SFT spontaneously improves bias across multiple demographic categories, contradicting the prevailing "alignment tax" assumption.
234
+ - **Behavioral capabilities emerge through sharp phase transitions.** Training small language models from scratch reveals that behaviors like over-refusal appear in discrete jumps, not gradual improvement.
235
+ - **Geometry precedes emergence.** Effective dimensionality expansion in weight subspaces predicts behavioral phase transitions by hundreds of training steps — the geometry reorganizes before the behavior appears.
236
+ - **Surgery concentrates, not rotates.** Grassmann angle analysis of rho-guided SFT shows behavioral subspaces sharpen (effective dimension compresses) rather than rotating to new orientations.
237
+ - **Compression preserves behavioral structure when protecting the right singular values.** SVD at 70% rank on Q/K/O projections retains behavioral fidelity; V and MLP layers are fragile.
238
+
239
+ Full experimental details, tables, and statistical analysis are in the papers below.
240
+
241
+ ## Papers
242
+
243
+ 1. **Rho-Guided Supervised Fine-Tuning: Post-Training Repair of Calibration Damage in Large Language Models** — [DOI: 10.5281/zenodo.18854944](https://doi.org/10.5281/zenodo.18854944)
244
+ 2. **Behavioral Entanglement in Transformers: Grassmann Geometry of Rho-Guided SFT** — [DOI: 10.5281/zenodo.18865862](https://doi.org/10.5281/zenodo.18865862)
245
+ 3. **Behavioral Phase Transitions in Small Language Models: Geometric Scaffolding Precedes Behavioral Emergence** — [DOI: 10.5281/zenodo.18865199](https://doi.org/10.5281/zenodo.18865199)
246
+ 4. **Confidence Cartography: Teacher-Forced Probability as a False-Belief Sensor in Language Models** — [DOI: 10.5281/zenodo.18703506](https://doi.org/10.5281/zenodo.18703506) | [Repo](https://github.com/SolomonB14D3/confidence-cartography)
247
+ 5. **CF90: Knowledge-Preserving SVD Compression for Large Language Models** — [DOI: 10.5281/zenodo.18718545](https://doi.org/10.5281/zenodo.18718545) | [Repo](https://github.com/SolomonB14D3/intelligent-svd)
248
+
249
+ ## Citation
250
+
251
+ ```bibtex
252
+ @article{sanchez2026rhoguided,
253
+ author = {Sanchez, Bryan},
254
+ title = {Rho-Guided Supervised Fine-Tuning: Post-Training Repair of
255
+ Calibration Damage in Large Language Models},
256
+ year = {2026},
257
+ doi = {10.5281/zenodo.18854944},
258
+ url = {https://doi.org/10.5281/zenodo.18854944}
259
+ }
260
+
261
+ @article{sanchez2026grassmann,
262
+ author = {Sanchez, Bryan},
263
+ title = {Behavioral Entanglement in Transformers: Grassmann Geometry
264
+ of Rho-Guided Supervised Fine-Tuning},
265
+ year = {2026},
266
+ doi = {10.5281/zenodo.18865862},
267
+ url = {https://doi.org/10.5281/zenodo.18865862}
268
+ }
269
+
270
+ @article{sanchez2026phasetransitions,
271
+ author = {Sanchez, Bryan},
272
+ title = {Behavioral Phase Transitions in Small Language Models:
273
+ Geometric Scaffolding Precedes Behavioral Emergence},
274
+ year = {2026},
275
+ doi = {10.5281/zenodo.18865199},
276
+ url = {https://doi.org/10.5281/zenodo.18865199}
277
+ }
278
+
279
+ @article{sanchez2026cartography,
280
+ author = {Sanchez, Bryan},
281
+ title = {Confidence Cartography: Teacher-Forced Probability as a
282
+ False-Belief Sensor in Language Models},
283
+ year = {2026},
284
+ doi = {10.5281/zenodo.18703506},
285
+ url = {https://doi.org/10.5281/zenodo.18703506}
286
+ }
287
+
288
+ @software{sanchez2026cf90,
289
+ author = {Sanchez, Bryan},
290
+ title = {CF90: Knowledge-Preserving SVD Compression for Large
291
+ Language Models},
292
+ year = {2026},
293
+ doi = {10.5281/zenodo.18718545},
294
+ url = {https://doi.org/10.5281/zenodo.18718545}
295
+ }
296
+
297
+ @software{sanchez2026rhoeval,
298
+ author = {Sanchez, Bryan},
299
+ title = {rho-eval: Behavioral Auditing for Large Language Models},
300
+ year = {2026},
301
+ doi = {10.5281/zenodo.18743959},
302
+ url = {https://doi.org/10.5281/zenodo.18743959}
303
+ }
304
+ ```
305
+
306
+ ## Contributing
307
+
308
+ PRs welcome for new probes, model support, or bug fixes. See [open issues](https://github.com/SolomonB14D3/knowledge-fidelity/issues).
309
+
310
+ ## License
311
+
312
+ MIT
@@ -0,0 +1,261 @@
1
+ # rho-eval v2.3.0: Behavioral Auditing for LLMs
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/rho-eval)](https://pypi.org/project/rho-eval/)
4
+ [![Paper: SFT](https://zenodo.org/badge/DOI/10.5281/zenodo.18854944.svg)](https://doi.org/10.5281/zenodo.18854944)
5
+ [![Paper: Grassmann](https://zenodo.org/badge/DOI/10.5281/zenodo.18865862.svg)](https://doi.org/10.5281/zenodo.18865862)
6
+ [![Paper: Phase Transitions](https://zenodo.org/badge/DOI/10.5281/zenodo.18865199.svg)](https://doi.org/10.5281/zenodo.18865199)
7
+ [![Paper: Confidence Cartography](https://zenodo.org/badge/DOI/10.5281/zenodo.18703506.svg)](https://doi.org/10.5281/zenodo.18703506)
8
+ [![Paper: CF90](https://zenodo.org/badge/DOI/10.5281/zenodo.18718545.svg)](https://doi.org/10.5281/zenodo.18718545)
9
+ [![Tests](https://img.shields.io/badge/tests-180%20passed-brightgreen)](tests/)
10
+ [![Demo](https://img.shields.io/badge/%F0%9F%A4%97%20Spaces-Demo-blue)](https://huggingface.co/spaces/bsanch52/knowledge-fidelity-demo)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
+ [![MLX](https://img.shields.io/badge/Apple%20Silicon-MLX%20Accelerated-black?logo=apple)](https://github.com/ml-explore/mlx)
13
+ [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/SolomonB14D3)
14
+
15
+ **Measure where language models get surprising truths wrong — then fix it.**
16
+
17
+ rho-eval measures 8 behavioral dimensions — factual accuracy, toxicity, bias, sycophancy, reasoning, refusal, deception, and over-refusal — using Spearman rank correlation over teacher-forced confidence probes. It ships 1,826 probes as JSON with no internet required.
18
+
19
+ > *Formerly `knowledge-fidelity`. All v1.x imports still work.*
20
+
21
+ ## What It Does
22
+
23
+ | Module | Purpose |
24
+ |--------|---------|
25
+ | **`rho-audit`** | Behavioral auditing across 8 dimensions via confidence probes |
26
+ | **`rho-interpret`** | SVD subspace extraction and Grassmann angle analysis |
27
+ | **`rho-align`** | Rho-Guided SFT with contrastive auxiliary loss |
28
+ | **`rho-steer`** | SAE-based disentangled behavioral steering |
29
+ | **`rho-bench`** | Fidelity-Bench 2.0: adversarial pressure testing |
30
+ | **`rho-surgery`** | End-to-end behavioral repair: diagnose, compress, LoRA SFT, verify |
31
+ | **`rho-benchmark`** | Full benchmarking (8-dim audit + TruthfulQA MC2) with comparison |
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pip install rho-eval # Core (auditing + SVD + probes)
37
+ pip install "rho-eval[full]" # Everything including MLX
38
+ ```
39
+
40
+ Or from source:
41
+
42
+ ```bash
43
+ git clone https://github.com/SolomonB14D3/knowledge-fidelity
44
+ cd knowledge-fidelity
45
+ pip install -e ".[full]"
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ### Python API
51
+
52
+ ```python
53
+ import rho_eval
54
+
55
+ # Audit any model across all 8 behaviors
56
+ report = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
57
+ print(report)
58
+ # <AuditReport model='Qwen/Qwen2.5-7B-Instruct' behaviors=8 status=WARN>
59
+
60
+ # Compare two models
61
+ baseline = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
62
+ repaired = rho_eval.audit("./repaired-7b/model/")
63
+ delta = rho_eval.compare(repaired, baseline)
64
+ print(delta.to_table()) # Colored delta table
65
+ ```
66
+
67
+ ### CLI
68
+
69
+ ```bash
70
+ # Full behavioral report card
71
+ rho-eval Qwen/Qwen2.5-7B-Instruct --behaviors all
72
+
73
+ # Specific behaviors, JSON output
74
+ rho-eval my-model/ --behaviors factual,bias,sycophancy --format json
75
+
76
+ # Compare against a baseline
77
+ rho-eval compressed-model/ --compare baseline.json
78
+
79
+ # Adversarial pressure test
80
+ rho-bench Qwen/Qwen2.5-7B-Instruct
81
+
82
+ # One-command behavioral repair
83
+ rho-surgery Qwen/Qwen2.5-7B-Instruct -o ./repaired-7b/
84
+
85
+ # Benchmark before vs after (8-dim audit + TruthfulQA MC2)
86
+ rho-benchmark ./repaired-7b/model/ --baseline Qwen/Qwen2.5-7B-Instruct
87
+ ```
88
+
89
+ ## Why This Exists
90
+
91
+ Language models fail where truth is surprising. Sycophancy picks the expected answer over the true one. Bias picks the stereotype over the individual. Standard SFT makes this worse in ways benchmarks don't catch.
92
+
93
+ rho-eval measures exactly where a model gets surprising truths wrong, and rho-guided SFT repairs it — without the alignment tax. See [our papers](#papers) for the full experimental story.
94
+
95
+ ## Built-In Probes (1,826 total)
96
+
97
+ All probes ship as JSON. No internet download needed.
98
+
99
+ | Behavior | Probe Sets | Count |
100
+ |----------|-----------|------:|
101
+ | Factual | default, mandela, medical, commonsense, truthfulqa, expanded | 206 |
102
+ | Bias | BBQ 300 + bridge probes + biology-grounded | 357 |
103
+ | Sycophancy | Anthropic model-written-evals | 150 |
104
+ | Toxicity | ToxiGen balanced | 200 |
105
+ | Reasoning | GSM8K + adversarial flattery | 100 |
106
+ | Deception | HH-RLHF honest/deceptive pairs | 100 |
107
+ | Refusal | harmful/benign pairs + expanded | 150 |
108
+ | Over-refusal | benign-but-edgy + expanded | 150 |
109
+ | Bench (Fidelity-Bench) | logic, social, clinical | 120 |
110
+
111
+ Run `rho-eval --list-probes` to see all available sets.
112
+
113
+ ### Custom Behaviors (Plugin System)
114
+
115
+ ```python
116
+ from rho_eval.behaviors import ABCBehavior, register
117
+
118
+ @register
119
+ class MyDomainBehavior(ABCBehavior):
120
+ name = "my_domain"
121
+ description = "Domain-specific evaluation"
122
+ probe_type = "confidence"
123
+ default_n = 50
124
+
125
+ def load_probes(self, n=None, seed=42, **kwargs):
126
+ return self._load_json_probes("my_domain/probes.json", n=n, seed=seed)
127
+
128
+ def evaluate(self, model, tokenizer, probes, device="cpu", **kwargs):
129
+ # Your evaluation logic
130
+ return BehaviorResult(behavior=self.name, rho=0.7, ...)
131
+
132
+ # Now available everywhere:
133
+ report = rho_eval.audit("my-model", behaviors=["factual", "my_domain"])
134
+ ```
135
+
136
+ ## Model Compatibility
137
+
138
+ Works on any HuggingFace causal LM with standard attention layouts.
139
+
140
+ **Validated:** Qwen2.5 (0.5B-32B), Mistral 7B, Llama 3.1 8B, GPT-2 (7M-210M scale ladder)
141
+
142
+ ## Apple Silicon (MLX)
143
+
144
+ rho-eval auto-dispatches to MLX on Apple Silicon. No code changes needed.
145
+
146
+ ```bash
147
+ pip install mlx mlx-lm # or: pip install "rho-eval[full]"
148
+ ```
149
+
150
+ ```python
151
+ import mlx_lm
152
+ from rho_eval import audit
153
+
154
+ model, tokenizer = mlx_lm.load("mlx-community/Qwen2.5-7B-Instruct-4bit")
155
+ report = audit(model=model, tokenizer=tokenizer, behaviors="all")
156
+ # Same API — ~5-10x faster on Apple Silicon
157
+ ```
158
+
159
+ | Component | MLX Speedup |
160
+ |-----------|:-----------:|
161
+ | `audit()` — 8-behavior probe suite | ~5x |
162
+ | `mlx_rho_guided_sft()` — alignment training | ~10x |
163
+ | `analyze_confidence()` — cartography | ~5x |
164
+
165
+ ## Compression Safety Guide
166
+
167
+ | Layer Type | Safe to Compress | Notes |
168
+ |------------|:---:|-------|
169
+ | Q, K, O projections | Yes (70% rank) | Main target |
170
+ | V projection | 90-95% only | High risk below 90% |
171
+ | MLP layers | Never | Destroys model at any level |
172
+
173
+ ## Limitations
174
+
175
+ - **Probe scale:** 1,826 probes across 37 sets. Spearman correlation is robust to small samples, but statistical power for subtle shifts is limited.
176
+ - **Western-centric:** Probes cover primarily English-language, U.S.-centric social categories.
177
+ - **7B scale.** Merge and steering results validated on 7B models. Larger scales (70B+) should not be extrapolated without verification.
178
+ - **Toxicity is unaffected** by weight edits — it relies on highly distributed lexical features that structural interventions cannot modulate.
179
+
180
+ ## Key Findings
181
+
182
+ - **Broad truth fixes propagate to narrow ones.** Repairing sycophancy via rho-guided SFT spontaneously improves bias across multiple demographic categories, contradicting the prevailing "alignment tax" assumption.
183
+ - **Behavioral capabilities emerge through sharp phase transitions.** Training small language models from scratch reveals that behaviors like over-refusal appear in discrete jumps, not gradual improvement.
184
+ - **Geometry precedes emergence.** Effective dimensionality expansion in weight subspaces predicts behavioral phase transitions by hundreds of training steps — the geometry reorganizes before the behavior appears.
185
+ - **Surgery concentrates, not rotates.** Grassmann angle analysis of rho-guided SFT shows behavioral subspaces sharpen (effective dimension compresses) rather than rotating to new orientations.
186
+ - **Compression preserves behavioral structure when protecting the right singular values.** SVD at 70% rank on Q/K/O projections retains behavioral fidelity; V and MLP layers are fragile.
187
+
188
+ Full experimental details, tables, and statistical analysis are in the papers below.
189
+
190
+ ## Papers
191
+
192
+ 1. **Rho-Guided Supervised Fine-Tuning: Post-Training Repair of Calibration Damage in Large Language Models** — [DOI: 10.5281/zenodo.18854944](https://doi.org/10.5281/zenodo.18854944)
193
+ 2. **Behavioral Entanglement in Transformers: Grassmann Geometry of Rho-Guided SFT** — [DOI: 10.5281/zenodo.18865862](https://doi.org/10.5281/zenodo.18865862)
194
+ 3. **Behavioral Phase Transitions in Small Language Models: Geometric Scaffolding Precedes Behavioral Emergence** — [DOI: 10.5281/zenodo.18865199](https://doi.org/10.5281/zenodo.18865199)
195
+ 4. **Confidence Cartography: Teacher-Forced Probability as a False-Belief Sensor in Language Models** — [DOI: 10.5281/zenodo.18703506](https://doi.org/10.5281/zenodo.18703506) | [Repo](https://github.com/SolomonB14D3/confidence-cartography)
196
+ 5. **CF90: Knowledge-Preserving SVD Compression for Large Language Models** — [DOI: 10.5281/zenodo.18718545](https://doi.org/10.5281/zenodo.18718545) | [Repo](https://github.com/SolomonB14D3/intelligent-svd)
197
+
198
+ ## Citation
199
+
200
+ ```bibtex
201
+ @article{sanchez2026rhoguided,
202
+ author = {Sanchez, Bryan},
203
+ title = {Rho-Guided Supervised Fine-Tuning: Post-Training Repair of
204
+ Calibration Damage in Large Language Models},
205
+ year = {2026},
206
+ doi = {10.5281/zenodo.18854944},
207
+ url = {https://doi.org/10.5281/zenodo.18854944}
208
+ }
209
+
210
+ @article{sanchez2026grassmann,
211
+ author = {Sanchez, Bryan},
212
+ title = {Behavioral Entanglement in Transformers: Grassmann Geometry
213
+ of Rho-Guided Supervised Fine-Tuning},
214
+ year = {2026},
215
+ doi = {10.5281/zenodo.18865862},
216
+ url = {https://doi.org/10.5281/zenodo.18865862}
217
+ }
218
+
219
+ @article{sanchez2026phasetransitions,
220
+ author = {Sanchez, Bryan},
221
+ title = {Behavioral Phase Transitions in Small Language Models:
222
+ Geometric Scaffolding Precedes Behavioral Emergence},
223
+ year = {2026},
224
+ doi = {10.5281/zenodo.18865199},
225
+ url = {https://doi.org/10.5281/zenodo.18865199}
226
+ }
227
+
228
+ @article{sanchez2026cartography,
229
+ author = {Sanchez, Bryan},
230
+ title = {Confidence Cartography: Teacher-Forced Probability as a
231
+ False-Belief Sensor in Language Models},
232
+ year = {2026},
233
+ doi = {10.5281/zenodo.18703506},
234
+ url = {https://doi.org/10.5281/zenodo.18703506}
235
+ }
236
+
237
+ @software{sanchez2026cf90,
238
+ author = {Sanchez, Bryan},
239
+ title = {CF90: Knowledge-Preserving SVD Compression for Large
240
+ Language Models},
241
+ year = {2026},
242
+ doi = {10.5281/zenodo.18718545},
243
+ url = {https://doi.org/10.5281/zenodo.18718545}
244
+ }
245
+
246
+ @software{sanchez2026rhoeval,
247
+ author = {Sanchez, Bryan},
248
+ title = {rho-eval: Behavioral Auditing for Large Language Models},
249
+ year = {2026},
250
+ doi = {10.5281/zenodo.18743959},
251
+ url = {https://doi.org/10.5281/zenodo.18743959}
252
+ }
253
+ ```
254
+
255
+ ## Contributing
256
+
257
+ PRs welcome for new probes, model support, or bug fixes. See [open issues](https://github.com/SolomonB14D3/knowledge-fidelity/issues).
258
+
259
+ ## License
260
+
261
+ MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rho-eval"
7
- version = "2.2.2"
7
+ version = "2.3.0"
8
8
  description = "Behavioral auditing toolkit for LLMs — audit any model across 8 dimensions (factual, toxicity, bias, sycophancy, reasoning, refusal, deception, over-refusal) using teacher-forced confidence probes."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -23,6 +23,8 @@ keywords = [
23
23
  "fidelity-bench", "truth-gap", "adversarial-benchmark",
24
24
  "rho-guided-sft", "alignment", "supervised-fine-tuning",
25
25
  "calibration-repair", "contrastive-loss", "mlx", "apple-silicon",
26
+ "contrastive-pretraining", "behavioral-emergence", "data-quality",
27
+ "scale-ladder", "subspace-geometry",
26
28
  ]
27
29
  classifiers = [
28
30
  "Development Status :: 4 - Beta",
@@ -85,12 +87,20 @@ rho-steer = "rho_eval.cli.rho_steer:main"
85
87
  rho-bench = "rho_eval.cli.rho_bench:main"
86
88
  rho-hybrid = "rho_eval.cli.rho_hybrid:main"
87
89
  rho-leaderboard = "rho_eval.cli.rho_leaderboard:main"
90
+ rho-surgery = "rho_eval.cli.rho_surgery:main"
91
+ rho-benchmark = "rho_eval.cli.rho_benchmark:main"
88
92
 
89
93
  [project.urls]
90
94
  Homepage = "https://github.com/SolomonB14D3/knowledge-fidelity"
91
95
  Repository = "https://github.com/SolomonB14D3/knowledge-fidelity"
92
96
  Issues = "https://github.com/SolomonB14D3/knowledge-fidelity/issues"
93
97
 
98
+ [tool.pytest.ini_options]
99
+ testpaths = ["tests"]
100
+ markers = [
101
+ "slow: marks tests that require model downloads or GPU (deselect with '-m \"not slow\"')",
102
+ ]
103
+
94
104
  [tool.setuptools.packages.find]
95
105
  where = ["src"]
96
106
  include = ["rho_eval*", "knowledge_fidelity*"]
@@ -0,0 +1,17 @@
1
+ """
2
+ Knowledge Fidelity — Backward-compatible shim for rho-eval.
3
+
4
+ This package has been renamed to rho-eval. All imports are re-exported
5
+ from the rho_eval package. Please update your imports:
6
+
7
+ # Old:
8
+ from knowledge_fidelity import audit
9
+ # New:
10
+ from rho_eval import audit
11
+
12
+ All v1 and v2 APIs are available through either import path.
13
+ """
14
+
15
+ # Re-export everything from rho_eval
16
+ from rho_eval import * # noqa: F401, F403
17
+ from rho_eval import __version__, __all__ # noqa: F401
@@ -3,7 +3,7 @@ rho-eval — Behavioral auditing toolkit for LLMs.
3
3
 
4
4
  Audit any model across 8 behavioral dimensions (factual, toxicity, bias,
5
5
  sycophancy, reasoning, refusal, deception, over-refusal) using teacher-forced
6
- confidence probes. No internet required — all 1,106 probes ship with the package.
6
+ confidence probes. No internet required — all 1,476 probes ship with the package.
7
7
 
8
8
  Quick start:
9
9
  from rho_eval import audit
@@ -53,13 +53,16 @@ from .alignment import (
53
53
  rho_auxiliary_loss,
54
54
  )
55
55
 
56
- # ── Steering (v2.3) — opt-in, not auto-imported ────────────────────────────
56
+ # ── Utilities ─────────────────────────────────────────────────────────────
57
+ from .utils import load_model
58
+
59
+ # ── Steering — opt-in, not auto-imported ──────────────────────────────────
57
60
  # SAE-based behavioral steering: from rho_eval.steering import GatedSAE, ...
58
61
 
59
- # ── Hybrid Control (v2.4) — opt-in, not auto-imported ───────────────────────
62
+ # ── Hybrid Control — opt-in, not auto-imported ───────────────────────────
60
63
  # Hybrid weight + activation control: from rho_eval.hybrid import HybridConfig, apply_hybrid_control
61
64
 
62
- # ── Benchmarking (v2.5) — Fidelity-Bench 2.0 ─────────────────────────────
65
+ # ── Benchmarking — Fidelity-Bench 2.0 ────────────────────────────────────
63
66
  from .benchmarking import (
64
67
  generate_certificate,
65
68
  FidelityCertificate,
@@ -84,7 +87,7 @@ from .probes import (
84
87
  from .behavioral import load_behavioral_probes, evaluate_behavior
85
88
  from .calibration import load_calibration_data, gentle_finetune
86
89
 
87
- __version__ = "2.2.1"
90
+ __version__ = "2.2.3"
88
91
 
89
92
  __all__ = [
90
93
  # ── New v2 API ──
@@ -101,6 +104,8 @@ __all__ = [
101
104
  "compute_overlap",
102
105
  "head_attribution",
103
106
  "InterpretabilityReport",
107
+ # ── Utilities ──
108
+ "load_model",
104
109
  # ── Alignment ──
105
110
  "rho_guided_sft",
106
111
  "contrastive_confidence_loss",