rho-eval 2.2.3__tar.gz → 2.4.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.4.0/PKG-INFO +327 -0
  2. rho_eval-2.4.0/README.md +276 -0
  3. {rho_eval-2.2.3 → rho_eval-2.4.0}/pyproject.toml +4 -1
  4. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/__init__.py +1 -1
  5. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/alignment/mlx_trainer.py +119 -5
  6. rho_eval-2.4.0/src/rho_eval/cli/rho_unlock.py +554 -0
  7. rho_eval-2.4.0/src/rho_eval/unlock/__init__.py +64 -0
  8. rho_eval-2.4.0/src/rho_eval/unlock/contrastive.py +387 -0
  9. rho_eval-2.4.0/src/rho_eval/unlock/diagnosis.py +287 -0
  10. rho_eval-2.4.0/src/rho_eval/unlock/expression_gap.py +741 -0
  11. rho_eval-2.4.0/src/rho_eval.egg-info/PKG-INFO +327 -0
  12. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval.egg-info/SOURCES.txt +5 -0
  13. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval.egg-info/entry_points.txt +1 -0
  14. rho_eval-2.2.3/PKG-INFO +0 -1146
  15. rho_eval-2.2.3/README.md +0 -1095
  16. rho_eval-2.2.3/src/rho_eval.egg-info/PKG-INFO +0 -1146
  17. {rho_eval-2.2.3 → rho_eval-2.4.0}/LICENSE +0 -0
  18. {rho_eval-2.2.3 → rho_eval-2.4.0}/setup.cfg +0 -0
  19. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/__init__.py +0 -0
  20. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/__main__.py +0 -0
  21. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/audit.py +0 -0
  22. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behavioral.py +0 -0
  23. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/__init__.py +0 -0
  24. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/base.py +0 -0
  25. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/bias.py +0 -0
  26. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/factual.py +0 -0
  27. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/metrics.py +0 -0
  28. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/reasoning.py +0 -0
  29. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/sycophancy.py +0 -0
  30. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/behaviors/toxicity.py +0 -0
  31. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/calibration.py +0 -0
  32. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/cartography/__init__.py +0 -0
  33. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/cartography/engine.py +0 -0
  34. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/cartography/schema.py +0 -0
  35. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/cli/__init__.py +0 -0
  36. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/cli/rho_audit.py +0 -0
  37. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/core.py +0 -0
  38. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/denoise.py +0 -0
  39. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/output/__init__.py +0 -0
  40. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/output/comparator.py +0 -0
  41. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/output/exporters.py +0 -0
  42. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/output/schema.py +0 -0
  43. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/__init__.py +0 -0
  44. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/bias/bbq_300.json +0 -0
  45. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/factual/commonsense.json +0 -0
  46. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/factual/default.json +0 -0
  47. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/factual/mandela.json +0 -0
  48. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/factual/medical.json +0 -0
  49. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/factual/truthfulqa.json +0 -0
  50. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/reasoning/gsm8k_100.json +0 -0
  51. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/sycophancy/anthropic_150.json +0 -0
  52. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/data/toxicity/toxigen_200.json +0 -0
  53. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/probes/registry.py +0 -0
  54. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/svd/__init__.py +0 -0
  55. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/svd/compress.py +0 -0
  56. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/svd/freeze.py +0 -0
  57. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/svd/importance.py +0 -0
  58. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/knowledge_fidelity/utils.py +0 -0
  59. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/__main__.py +0 -0
  60. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/_compat.py +0 -0
  61. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/alignment/__init__.py +0 -0
  62. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/alignment/dataset.py +0 -0
  63. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/alignment/losses.py +0 -0
  64. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/alignment/mlx_losses.py +0 -0
  65. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/alignment/trainer.py +0 -0
  66. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/audit.py +0 -0
  67. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behavioral.py +0 -0
  68. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/__init__.py +0 -0
  69. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/base.py +0 -0
  70. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/bias.py +0 -0
  71. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/deception.py +0 -0
  72. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/factual.py +0 -0
  73. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/metrics.py +0 -0
  74. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/overrefusal.py +0 -0
  75. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/reasoning.py +0 -0
  76. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/refusal.py +0 -0
  77. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/sycophancy.py +0 -0
  78. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/behaviors/toxicity.py +0 -0
  79. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/__init__.py +0 -0
  80. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/adversarial.py +0 -0
  81. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/leaderboard.py +0 -0
  82. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/loader.py +0 -0
  83. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/probe_registry.py +0 -0
  84. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/reports.py +0 -0
  85. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/schema.py +0 -0
  86. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/scorers.py +0 -0
  87. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/benchmarking/truthfulqa.py +0 -0
  88. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/calibration.py +0 -0
  89. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cartography/__init__.py +0 -0
  90. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cartography/engine.py +0 -0
  91. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cartography/schema.py +0 -0
  92. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/__init__.py +0 -0
  93. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_align.py +0 -0
  94. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_audit.py +0 -0
  95. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_bench.py +0 -0
  96. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_benchmark.py +0 -0
  97. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_hybrid.py +0 -0
  98. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_interpret.py +0 -0
  99. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_leaderboard.py +0 -0
  100. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_steer.py +0 -0
  101. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/cli/rho_surgery.py +0 -0
  102. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/core.py +0 -0
  103. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/denoise.py +0 -0
  104. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/hybrid/__init__.py +0 -0
  105. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/hybrid/pipeline.py +0 -0
  106. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/hybrid/schema.py +0 -0
  107. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/__init__.py +0 -0
  108. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/activation.py +0 -0
  109. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/heads.py +0 -0
  110. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/overlap.py +0 -0
  111. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/schema.py +0 -0
  112. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/subspaces.py +0 -0
  113. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/surgical.py +0 -0
  114. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/interpretability/visualize.py +0 -0
  115. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/output/__init__.py +0 -0
  116. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/output/comparator.py +0 -0
  117. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/output/exporters.py +0 -0
  118. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/output/schema.py +0 -0
  119. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/__init__.py +0 -0
  120. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bench/clinical.json +0 -0
  121. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bench/logic.json +0 -0
  122. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bench/social.json +0 -0
  123. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bias/bbq_300.json +0 -0
  124. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bias/bridge_native.json +0 -0
  125. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bias/bridge_pairs.json +0 -0
  126. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bias/bridge_scaleup.json +0 -0
  127. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bias/gender_biology.json +0 -0
  128. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/bias/sexual_orientation_biology.json +0 -0
  129. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/deception/bridge_native.json +0 -0
  130. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/deception/bridge_pairs.json +0 -0
  131. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/deception/bridge_scaleup.json +0 -0
  132. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/deception/hh_rlhf_100.json +0 -0
  133. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/factual/commonsense.json +0 -0
  134. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/factual/default.json +0 -0
  135. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/factual/expanded_150.json +0 -0
  136. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/factual/mandela.json +0 -0
  137. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/factual/medical.json +0 -0
  138. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/factual/truthfulqa.json +0 -0
  139. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/overrefusal/benign_edgy_80.json +0 -0
  140. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/overrefusal/expanded_70.json +0 -0
  141. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/reasoning/bridge_native.json +0 -0
  142. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/reasoning/bridge_pairs.json +0 -0
  143. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/reasoning/bridge_scaleup.json +0 -0
  144. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/reasoning/bridge_scaleup_v2.json +0 -0
  145. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/reasoning/bridge_shortform.json +0 -0
  146. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/reasoning/gsm8k_100.json +0 -0
  147. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/refusal/expanded_100.json +0 -0
  148. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/refusal/harmful_benign_50.json +0 -0
  149. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/sycophancy/anthropic_150.json +0 -0
  150. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/sycophancy/hard_100.json +0 -0
  151. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/sycophancy/harder_pairs_16.json +0 -0
  152. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/toxicity/bridge_native.json +0 -0
  153. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/toxicity/bridge_pairs.json +0 -0
  154. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/toxicity/bridge_scaleup.json +0 -0
  155. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/toxicity/bridge_scaleup_v2.json +0 -0
  156. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/toxicity/bridge_shortform.json +0 -0
  157. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/data/toxicity/toxigen_200.json +0 -0
  158. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/probes/registry.py +0 -0
  159. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/steering/__init__.py +0 -0
  160. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/steering/analyze.py +0 -0
  161. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/steering/collect.py +0 -0
  162. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/steering/sae.py +0 -0
  163. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/steering/schema.py +0 -0
  164. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/steering/steer.py +0 -0
  165. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/steering/train.py +0 -0
  166. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/surgical_planner.py +0 -0
  167. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/svd/__init__.py +0 -0
  168. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/svd/compress.py +0 -0
  169. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/svd/freeze.py +0 -0
  170. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/svd/importance.py +0 -0
  171. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval/utils.py +0 -0
  172. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval.egg-info/dependency_links.txt +0 -0
  173. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval.egg-info/requires.txt +0 -0
  174. {rho_eval-2.2.3 → rho_eval-2.4.0}/src/rho_eval.egg-info/top_level.txt +0 -0
  175. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_alignment.py +0 -0
  176. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_benchmarking.py +0 -0
  177. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_cli.py +0 -0
  178. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_interpretability.py +0 -0
  179. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_metrics.py +0 -0
  180. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_output.py +0 -0
  181. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_probes.py +0 -0
  182. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_registry.py +0 -0
  183. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_steering.py +0 -0
  184. {rho_eval-2.2.3 → rho_eval-2.4.0}/tests/test_surgery.py +0 -0
@@ -0,0 +1,327 @@
1
+ Metadata-Version: 2.4
2
+ Name: rho-eval
3
+ Version: 2.4.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.4.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.18854943.svg)](https://doi.org/10.5281/zenodo.18854943)
56
+ [![Paper: Grassmann](https://zenodo.org/badge/DOI/10.5281/zenodo.18865861.svg)](https://doi.org/10.5281/zenodo.18865861)
57
+ [![Paper: Phase Transitions](https://zenodo.org/badge/DOI/10.5281/zenodo.18865198.svg)](https://doi.org/10.5281/zenodo.18865198)
58
+ [![Paper: Confidence Cartography](https://zenodo.org/badge/DOI/10.5281/zenodo.18703505.svg)](https://doi.org/10.5281/zenodo.18703505)
59
+ [![Paper: Contrastive Pretraining](https://zenodo.org/badge/DOI/10.5281/zenodo.18870555.svg)](https://doi.org/10.5281/zenodo.18870555)
60
+ [![Paper: Expression Bottleneck](https://zenodo.org/badge/DOI/10.5281/zenodo.18895248.svg)](https://doi.org/10.5281/zenodo.18895248)
61
+ [![Paper: CF90](https://zenodo.org/badge/DOI/10.5281/zenodo.18718545.svg)](https://doi.org/10.5281/zenodo.18718545)
62
+ [![Tests](https://img.shields.io/badge/tests-180%20passed-brightgreen)](tests/)
63
+ [![Demo](https://img.shields.io/badge/%F0%9F%A4%97%20Spaces-Demo-blue)](https://huggingface.co/spaces/bsanch52/knowledge-fidelity-demo)
64
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
65
+ [![MLX](https://img.shields.io/badge/Apple%20Silicon-MLX%20Accelerated-black?logo=apple)](https://github.com/ml-explore/mlx)
66
+ [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/SolomonB14D3)
67
+
68
+ **Measure where language models get surprising truths wrong — then fix it.**
69
+
70
+ 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.
71
+
72
+ > *Formerly `knowledge-fidelity`. All v1.x imports still work.*
73
+
74
+ ## What It Does
75
+
76
+ | Module | Purpose |
77
+ |--------|---------|
78
+ | **`rho-audit`** | Behavioral auditing across 8 dimensions via confidence probes |
79
+ | **`rho-interpret`** | SVD subspace extraction and Grassmann angle analysis |
80
+ | **`rho-align`** | Rho-Guided SFT with contrastive auxiliary loss |
81
+ | **`rho-steer`** | SAE-based disentangled behavioral steering |
82
+ | **`rho-bench`** | Fidelity-Bench 2.0: adversarial pressure testing |
83
+ | **`rho-surgery`** | End-to-end behavioral repair: diagnose, compress, LoRA SFT, verify |
84
+ | **`rho-benchmark`** | Full benchmarking (8-dim audit + TruthfulQA MC2) with comparison |
85
+ | **`rho-unlock`** | Expression gap diagnostic + contrastive decoding to rescue hidden capability |
86
+
87
+ ## Install
88
+
89
+ ```bash
90
+ pip install rho-eval # Core (auditing + SVD + probes)
91
+ pip install "rho-eval[full]" # Everything including MLX
92
+ ```
93
+
94
+ Or from source:
95
+
96
+ ```bash
97
+ git clone https://github.com/SolomonB14D3/knowledge-fidelity
98
+ cd knowledge-fidelity
99
+ pip install -e ".[full]"
100
+ ```
101
+
102
+ ## Quick Start
103
+
104
+ ### Python API
105
+
106
+ ```python
107
+ import rho_eval
108
+
109
+ # Audit any model across all 8 behaviors
110
+ report = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
111
+ print(report)
112
+ # <AuditReport model='Qwen/Qwen2.5-7B-Instruct' behaviors=8 status=WARN>
113
+
114
+ # Compare two models
115
+ baseline = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
116
+ repaired = rho_eval.audit("./repaired-7b/model/")
117
+ delta = rho_eval.compare(repaired, baseline)
118
+ print(delta.to_table()) # Colored delta table
119
+ ```
120
+
121
+ ### CLI
122
+
123
+ ```bash
124
+ # Full behavioral report card
125
+ rho-eval Qwen/Qwen2.5-7B-Instruct --behaviors all
126
+
127
+ # Specific behaviors, JSON output
128
+ rho-eval my-model/ --behaviors factual,bias,sycophancy --format json
129
+
130
+ # Compare against a baseline
131
+ rho-eval compressed-model/ --compare baseline.json
132
+
133
+ # Adversarial pressure test
134
+ rho-bench Qwen/Qwen2.5-7B-Instruct
135
+
136
+ # One-command behavioral repair
137
+ rho-surgery Qwen/Qwen2.5-7B-Instruct -o ./repaired-7b/
138
+
139
+ # Benchmark before vs after (8-dim audit + TruthfulQA MC2)
140
+ rho-benchmark ./repaired-7b/model/ --baseline Qwen/Qwen2.5-7B-Instruct
141
+ ```
142
+
143
+ ## Why This Exists
144
+
145
+ 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.
146
+
147
+ 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.
148
+
149
+ ## Built-In Probes (1,826 total)
150
+
151
+ All probes ship as JSON. No internet download needed.
152
+
153
+ | Behavior | Probe Sets | Count |
154
+ |----------|-----------|------:|
155
+ | Factual | default, mandela, medical, commonsense, truthfulqa, expanded | 206 |
156
+ | Bias | BBQ 300 + bridge probes + biology-grounded | 357 |
157
+ | Sycophancy | Anthropic model-written-evals | 150 |
158
+ | Toxicity | ToxiGen balanced | 200 |
159
+ | Reasoning | GSM8K + adversarial flattery | 100 |
160
+ | Deception | HH-RLHF honest/deceptive pairs | 100 |
161
+ | Refusal | harmful/benign pairs + expanded | 150 |
162
+ | Over-refusal | benign-but-edgy + expanded | 150 |
163
+ | Bench (Fidelity-Bench) | logic, social, clinical | 120 |
164
+
165
+ Run `rho-eval --list-probes` to see all available sets.
166
+
167
+ ### Custom Behaviors (Plugin System)
168
+
169
+ ```python
170
+ from rho_eval.behaviors import ABCBehavior, register
171
+
172
+ @register
173
+ class MyDomainBehavior(ABCBehavior):
174
+ name = "my_domain"
175
+ description = "Domain-specific evaluation"
176
+ probe_type = "confidence"
177
+ default_n = 50
178
+
179
+ def load_probes(self, n=None, seed=42, **kwargs):
180
+ return self._load_json_probes("my_domain/probes.json", n=n, seed=seed)
181
+
182
+ def evaluate(self, model, tokenizer, probes, device="cpu", **kwargs):
183
+ # Your evaluation logic
184
+ return BehaviorResult(behavior=self.name, rho=0.7, ...)
185
+
186
+ # Now available everywhere:
187
+ report = rho_eval.audit("my-model", behaviors=["factual", "my_domain"])
188
+ ```
189
+
190
+ ## Model Compatibility
191
+
192
+ Works on any HuggingFace causal LM with standard attention layouts.
193
+
194
+ **Validated:** Qwen2.5 (0.5B-32B), Mistral 7B, Llama 3.1 8B, GPT-2 (7M-210M scale ladder)
195
+
196
+ ## Apple Silicon (MLX)
197
+
198
+ rho-eval auto-dispatches to MLX on Apple Silicon. No code changes needed.
199
+
200
+ ```bash
201
+ pip install mlx mlx-lm # or: pip install "rho-eval[full]"
202
+ ```
203
+
204
+ ```python
205
+ import mlx_lm
206
+ from rho_eval import audit
207
+
208
+ model, tokenizer = mlx_lm.load("mlx-community/Qwen2.5-7B-Instruct-4bit")
209
+ report = audit(model=model, tokenizer=tokenizer, behaviors="all")
210
+ # Same API — ~5-10x faster on Apple Silicon
211
+ ```
212
+
213
+ | Component | MLX Speedup |
214
+ |-----------|:-----------:|
215
+ | `audit()` — 8-behavior probe suite | ~5x |
216
+ | `mlx_rho_guided_sft()` — alignment training | ~10x |
217
+ | `analyze_confidence()` — cartography | ~5x |
218
+
219
+ ## Compression Safety Guide
220
+
221
+ | Layer Type | Safe to Compress | Notes |
222
+ |------------|:---:|-------|
223
+ | Q, K, O projections | Yes (70% rank) | Main target |
224
+ | V projection | 90-95% only | High risk below 90% |
225
+ | MLP layers | Never | Destroys model at any level |
226
+
227
+ ## Limitations
228
+
229
+ - **Probe scale:** 1,826 probes across 37 sets. Spearman correlation is robust to small samples, but statistical power for subtle shifts is limited.
230
+ - **Western-centric:** Probes cover primarily English-language, U.S.-centric social categories.
231
+ - **7B scale.** Merge and steering results validated on 7B models. Larger scales (70B+) should not be extrapolated without verification.
232
+ - **Toxicity is unaffected** by weight edits — it relies on highly distributed lexical features that structural interventions cannot modulate.
233
+
234
+ ## Key Findings
235
+
236
+ - **Behavioral emergence is a data problem, not a scale problem.** Injecting contrastive pairs during pretraining breaks behavioral emergence barriers at small scales, exceeding vanilla models 5x larger with zero inference cost.
237
+ - **Contrastive injection stabilizes behavioral scaling.** Vanilla training produces non-monotonic scaling anomalies where capabilities regress at larger scale. Contrastive injection eliminates these anomalies across four model scales tested.
238
+ - **Broad truth fixes propagate to narrow ones — above a capacity threshold.** Fixing sycophancy spontaneously improves bias, but not vice versa. Cross-transfer is absent at 3M parameters, emerges sharply at 5M, and persists at 7M. This asymmetric hierarchy operates across pretraining scales and post-hoc surgery, establishing it as a structural property of behavioral representations with a developmental onset.
239
+ - **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.
240
+ - **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.
241
+ - **Surgery concentrates, not rotates.** Grassmann angle analysis of rho-guided SFT shows behavioral subspaces sharpen (effective dimension compresses) rather than rotating to new orientations.
242
+ - **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.
243
+
244
+ Full experimental details, tables, and statistical analysis are in the papers below.
245
+
246
+ ## Papers
247
+
248
+ 1. **Rho-Guided Supervised Fine-Tuning: Post-Training Repair of Calibration Damage in Large Language Models** — [DOI: 10.5281/zenodo.18854943](https://doi.org/10.5281/zenodo.18854943)
249
+ 2. **Behavioral Entanglement in Transformers: Grassmann Geometry of Rho-Guided SFT** — [DOI: 10.5281/zenodo.18865861](https://doi.org/10.5281/zenodo.18865861)
250
+ 3. **Behavioral Phase Transitions in Small Language Models: Geometric Scaffolding Precedes Behavioral Emergence** — [DOI: 10.5281/zenodo.18865198](https://doi.org/10.5281/zenodo.18865198)
251
+ 4. **Confidence Cartography: Teacher-Forced Probability as a False-Belief Sensor in Language Models** — [DOI: 10.5281/zenodo.18703505](https://doi.org/10.5281/zenodo.18703505) | [Repo](https://github.com/SolomonB14D3/confidence-cartography)
252
+ 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)
253
+ 6. **Small Models Can Learn Complex Behaviors — They Just Need the Right Examples** — [DOI: 10.5281/zenodo.18870555](https://doi.org/10.5281/zenodo.18870555)
254
+
255
+ ## Citation
256
+
257
+ ```bibtex
258
+ @article{sanchez2026rhoguided,
259
+ author = {Sanchez, Bryan},
260
+ title = {Rho-Guided Supervised Fine-Tuning: Post-Training Repair of
261
+ Calibration Damage in Large Language Models},
262
+ year = {2026},
263
+ doi = {10.5281/zenodo.18854943},
264
+ url = {https://doi.org/10.5281/zenodo.18854943}
265
+ }
266
+
267
+ @article{sanchez2026grassmann,
268
+ author = {Sanchez, Bryan},
269
+ title = {Behavioral Entanglement in Transformers: Grassmann Geometry
270
+ of Rho-Guided Supervised Fine-Tuning},
271
+ year = {2026},
272
+ doi = {10.5281/zenodo.18865861},
273
+ url = {https://doi.org/10.5281/zenodo.18865861}
274
+ }
275
+
276
+ @article{sanchez2026phasetransitions,
277
+ author = {Sanchez, Bryan},
278
+ title = {Behavioral Phase Transitions in Small Language Models:
279
+ Geometric Scaffolding Precedes Behavioral Emergence},
280
+ year = {2026},
281
+ doi = {10.5281/zenodo.18865198},
282
+ url = {https://doi.org/10.5281/zenodo.18865198}
283
+ }
284
+
285
+ @article{sanchez2026cartography,
286
+ author = {Sanchez, Bryan},
287
+ title = {Confidence Cartography: Teacher-Forced Probability as a
288
+ False-Belief Sensor in Language Models},
289
+ year = {2026},
290
+ doi = {10.5281/zenodo.18703505},
291
+ url = {https://doi.org/10.5281/zenodo.18703505}
292
+ }
293
+
294
+ @software{sanchez2026cf90,
295
+ author = {Sanchez, Bryan},
296
+ title = {CF90: Knowledge-Preserving SVD Compression for Large
297
+ Language Models},
298
+ year = {2026},
299
+ doi = {10.5281/zenodo.18718545},
300
+ url = {https://doi.org/10.5281/zenodo.18718545}
301
+ }
302
+
303
+ @article{sanchez2026contrastive,
304
+ author = {Sanchez, Bryan},
305
+ title = {Small Models Can Learn Complex Behaviors ---
306
+ They Just Need the Right Examples},
307
+ year = {2026},
308
+ doi = {10.5281/zenodo.18870555},
309
+ url = {https://doi.org/10.5281/zenodo.18870555}
310
+ }
311
+
312
+ @software{sanchez2026rhoeval,
313
+ author = {Sanchez, Bryan},
314
+ title = {rho-eval: Behavioral Auditing for Large Language Models},
315
+ year = {2026},
316
+ doi = {10.5281/zenodo.18743959},
317
+ url = {https://doi.org/10.5281/zenodo.18743959}
318
+ }
319
+ ```
320
+
321
+ ## Contributing
322
+
323
+ PRs welcome for new probes, model support, or bug fixes. See [open issues](https://github.com/SolomonB14D3/knowledge-fidelity/issues).
324
+
325
+ ## License
326
+
327
+ MIT
@@ -0,0 +1,276 @@
1
+ # rho-eval v2.4.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.18854943.svg)](https://doi.org/10.5281/zenodo.18854943)
5
+ [![Paper: Grassmann](https://zenodo.org/badge/DOI/10.5281/zenodo.18865861.svg)](https://doi.org/10.5281/zenodo.18865861)
6
+ [![Paper: Phase Transitions](https://zenodo.org/badge/DOI/10.5281/zenodo.18865198.svg)](https://doi.org/10.5281/zenodo.18865198)
7
+ [![Paper: Confidence Cartography](https://zenodo.org/badge/DOI/10.5281/zenodo.18703505.svg)](https://doi.org/10.5281/zenodo.18703505)
8
+ [![Paper: Contrastive Pretraining](https://zenodo.org/badge/DOI/10.5281/zenodo.18870555.svg)](https://doi.org/10.5281/zenodo.18870555)
9
+ [![Paper: Expression Bottleneck](https://zenodo.org/badge/DOI/10.5281/zenodo.18895248.svg)](https://doi.org/10.5281/zenodo.18895248)
10
+ [![Paper: CF90](https://zenodo.org/badge/DOI/10.5281/zenodo.18718545.svg)](https://doi.org/10.5281/zenodo.18718545)
11
+ [![Tests](https://img.shields.io/badge/tests-180%20passed-brightgreen)](tests/)
12
+ [![Demo](https://img.shields.io/badge/%F0%9F%A4%97%20Spaces-Demo-blue)](https://huggingface.co/spaces/bsanch52/knowledge-fidelity-demo)
13
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
14
+ [![MLX](https://img.shields.io/badge/Apple%20Silicon-MLX%20Accelerated-black?logo=apple)](https://github.com/ml-explore/mlx)
15
+ [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?logo=github)](https://github.com/sponsors/SolomonB14D3)
16
+
17
+ **Measure where language models get surprising truths wrong — then fix it.**
18
+
19
+ 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.
20
+
21
+ > *Formerly `knowledge-fidelity`. All v1.x imports still work.*
22
+
23
+ ## What It Does
24
+
25
+ | Module | Purpose |
26
+ |--------|---------|
27
+ | **`rho-audit`** | Behavioral auditing across 8 dimensions via confidence probes |
28
+ | **`rho-interpret`** | SVD subspace extraction and Grassmann angle analysis |
29
+ | **`rho-align`** | Rho-Guided SFT with contrastive auxiliary loss |
30
+ | **`rho-steer`** | SAE-based disentangled behavioral steering |
31
+ | **`rho-bench`** | Fidelity-Bench 2.0: adversarial pressure testing |
32
+ | **`rho-surgery`** | End-to-end behavioral repair: diagnose, compress, LoRA SFT, verify |
33
+ | **`rho-benchmark`** | Full benchmarking (8-dim audit + TruthfulQA MC2) with comparison |
34
+ | **`rho-unlock`** | Expression gap diagnostic + contrastive decoding to rescue hidden capability |
35
+
36
+ ## Install
37
+
38
+ ```bash
39
+ pip install rho-eval # Core (auditing + SVD + probes)
40
+ pip install "rho-eval[full]" # Everything including MLX
41
+ ```
42
+
43
+ Or from source:
44
+
45
+ ```bash
46
+ git clone https://github.com/SolomonB14D3/knowledge-fidelity
47
+ cd knowledge-fidelity
48
+ pip install -e ".[full]"
49
+ ```
50
+
51
+ ## Quick Start
52
+
53
+ ### Python API
54
+
55
+ ```python
56
+ import rho_eval
57
+
58
+ # Audit any model across all 8 behaviors
59
+ report = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
60
+ print(report)
61
+ # <AuditReport model='Qwen/Qwen2.5-7B-Instruct' behaviors=8 status=WARN>
62
+
63
+ # Compare two models
64
+ baseline = rho_eval.audit("Qwen/Qwen2.5-7B-Instruct")
65
+ repaired = rho_eval.audit("./repaired-7b/model/")
66
+ delta = rho_eval.compare(repaired, baseline)
67
+ print(delta.to_table()) # Colored delta table
68
+ ```
69
+
70
+ ### CLI
71
+
72
+ ```bash
73
+ # Full behavioral report card
74
+ rho-eval Qwen/Qwen2.5-7B-Instruct --behaviors all
75
+
76
+ # Specific behaviors, JSON output
77
+ rho-eval my-model/ --behaviors factual,bias,sycophancy --format json
78
+
79
+ # Compare against a baseline
80
+ rho-eval compressed-model/ --compare baseline.json
81
+
82
+ # Adversarial pressure test
83
+ rho-bench Qwen/Qwen2.5-7B-Instruct
84
+
85
+ # One-command behavioral repair
86
+ rho-surgery Qwen/Qwen2.5-7B-Instruct -o ./repaired-7b/
87
+
88
+ # Benchmark before vs after (8-dim audit + TruthfulQA MC2)
89
+ rho-benchmark ./repaired-7b/model/ --baseline Qwen/Qwen2.5-7B-Instruct
90
+ ```
91
+
92
+ ## Why This Exists
93
+
94
+ 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.
95
+
96
+ 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.
97
+
98
+ ## Built-In Probes (1,826 total)
99
+
100
+ All probes ship as JSON. No internet download needed.
101
+
102
+ | Behavior | Probe Sets | Count |
103
+ |----------|-----------|------:|
104
+ | Factual | default, mandela, medical, commonsense, truthfulqa, expanded | 206 |
105
+ | Bias | BBQ 300 + bridge probes + biology-grounded | 357 |
106
+ | Sycophancy | Anthropic model-written-evals | 150 |
107
+ | Toxicity | ToxiGen balanced | 200 |
108
+ | Reasoning | GSM8K + adversarial flattery | 100 |
109
+ | Deception | HH-RLHF honest/deceptive pairs | 100 |
110
+ | Refusal | harmful/benign pairs + expanded | 150 |
111
+ | Over-refusal | benign-but-edgy + expanded | 150 |
112
+ | Bench (Fidelity-Bench) | logic, social, clinical | 120 |
113
+
114
+ Run `rho-eval --list-probes` to see all available sets.
115
+
116
+ ### Custom Behaviors (Plugin System)
117
+
118
+ ```python
119
+ from rho_eval.behaviors import ABCBehavior, register
120
+
121
+ @register
122
+ class MyDomainBehavior(ABCBehavior):
123
+ name = "my_domain"
124
+ description = "Domain-specific evaluation"
125
+ probe_type = "confidence"
126
+ default_n = 50
127
+
128
+ def load_probes(self, n=None, seed=42, **kwargs):
129
+ return self._load_json_probes("my_domain/probes.json", n=n, seed=seed)
130
+
131
+ def evaluate(self, model, tokenizer, probes, device="cpu", **kwargs):
132
+ # Your evaluation logic
133
+ return BehaviorResult(behavior=self.name, rho=0.7, ...)
134
+
135
+ # Now available everywhere:
136
+ report = rho_eval.audit("my-model", behaviors=["factual", "my_domain"])
137
+ ```
138
+
139
+ ## Model Compatibility
140
+
141
+ Works on any HuggingFace causal LM with standard attention layouts.
142
+
143
+ **Validated:** Qwen2.5 (0.5B-32B), Mistral 7B, Llama 3.1 8B, GPT-2 (7M-210M scale ladder)
144
+
145
+ ## Apple Silicon (MLX)
146
+
147
+ rho-eval auto-dispatches to MLX on Apple Silicon. No code changes needed.
148
+
149
+ ```bash
150
+ pip install mlx mlx-lm # or: pip install "rho-eval[full]"
151
+ ```
152
+
153
+ ```python
154
+ import mlx_lm
155
+ from rho_eval import audit
156
+
157
+ model, tokenizer = mlx_lm.load("mlx-community/Qwen2.5-7B-Instruct-4bit")
158
+ report = audit(model=model, tokenizer=tokenizer, behaviors="all")
159
+ # Same API — ~5-10x faster on Apple Silicon
160
+ ```
161
+
162
+ | Component | MLX Speedup |
163
+ |-----------|:-----------:|
164
+ | `audit()` — 8-behavior probe suite | ~5x |
165
+ | `mlx_rho_guided_sft()` — alignment training | ~10x |
166
+ | `analyze_confidence()` — cartography | ~5x |
167
+
168
+ ## Compression Safety Guide
169
+
170
+ | Layer Type | Safe to Compress | Notes |
171
+ |------------|:---:|-------|
172
+ | Q, K, O projections | Yes (70% rank) | Main target |
173
+ | V projection | 90-95% only | High risk below 90% |
174
+ | MLP layers | Never | Destroys model at any level |
175
+
176
+ ## Limitations
177
+
178
+ - **Probe scale:** 1,826 probes across 37 sets. Spearman correlation is robust to small samples, but statistical power for subtle shifts is limited.
179
+ - **Western-centric:** Probes cover primarily English-language, U.S.-centric social categories.
180
+ - **7B scale.** Merge and steering results validated on 7B models. Larger scales (70B+) should not be extrapolated without verification.
181
+ - **Toxicity is unaffected** by weight edits — it relies on highly distributed lexical features that structural interventions cannot modulate.
182
+
183
+ ## Key Findings
184
+
185
+ - **Behavioral emergence is a data problem, not a scale problem.** Injecting contrastive pairs during pretraining breaks behavioral emergence barriers at small scales, exceeding vanilla models 5x larger with zero inference cost.
186
+ - **Contrastive injection stabilizes behavioral scaling.** Vanilla training produces non-monotonic scaling anomalies where capabilities regress at larger scale. Contrastive injection eliminates these anomalies across four model scales tested.
187
+ - **Broad truth fixes propagate to narrow ones — above a capacity threshold.** Fixing sycophancy spontaneously improves bias, but not vice versa. Cross-transfer is absent at 3M parameters, emerges sharply at 5M, and persists at 7M. This asymmetric hierarchy operates across pretraining scales and post-hoc surgery, establishing it as a structural property of behavioral representations with a developmental onset.
188
+ - **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.
189
+ - **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.
190
+ - **Surgery concentrates, not rotates.** Grassmann angle analysis of rho-guided SFT shows behavioral subspaces sharpen (effective dimension compresses) rather than rotating to new orientations.
191
+ - **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.
192
+
193
+ Full experimental details, tables, and statistical analysis are in the papers below.
194
+
195
+ ## Papers
196
+
197
+ 1. **Rho-Guided Supervised Fine-Tuning: Post-Training Repair of Calibration Damage in Large Language Models** — [DOI: 10.5281/zenodo.18854943](https://doi.org/10.5281/zenodo.18854943)
198
+ 2. **Behavioral Entanglement in Transformers: Grassmann Geometry of Rho-Guided SFT** — [DOI: 10.5281/zenodo.18865861](https://doi.org/10.5281/zenodo.18865861)
199
+ 3. **Behavioral Phase Transitions in Small Language Models: Geometric Scaffolding Precedes Behavioral Emergence** — [DOI: 10.5281/zenodo.18865198](https://doi.org/10.5281/zenodo.18865198)
200
+ 4. **Confidence Cartography: Teacher-Forced Probability as a False-Belief Sensor in Language Models** — [DOI: 10.5281/zenodo.18703505](https://doi.org/10.5281/zenodo.18703505) | [Repo](https://github.com/SolomonB14D3/confidence-cartography)
201
+ 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)
202
+ 6. **Small Models Can Learn Complex Behaviors — They Just Need the Right Examples** — [DOI: 10.5281/zenodo.18870555](https://doi.org/10.5281/zenodo.18870555)
203
+
204
+ ## Citation
205
+
206
+ ```bibtex
207
+ @article{sanchez2026rhoguided,
208
+ author = {Sanchez, Bryan},
209
+ title = {Rho-Guided Supervised Fine-Tuning: Post-Training Repair of
210
+ Calibration Damage in Large Language Models},
211
+ year = {2026},
212
+ doi = {10.5281/zenodo.18854943},
213
+ url = {https://doi.org/10.5281/zenodo.18854943}
214
+ }
215
+
216
+ @article{sanchez2026grassmann,
217
+ author = {Sanchez, Bryan},
218
+ title = {Behavioral Entanglement in Transformers: Grassmann Geometry
219
+ of Rho-Guided Supervised Fine-Tuning},
220
+ year = {2026},
221
+ doi = {10.5281/zenodo.18865861},
222
+ url = {https://doi.org/10.5281/zenodo.18865861}
223
+ }
224
+
225
+ @article{sanchez2026phasetransitions,
226
+ author = {Sanchez, Bryan},
227
+ title = {Behavioral Phase Transitions in Small Language Models:
228
+ Geometric Scaffolding Precedes Behavioral Emergence},
229
+ year = {2026},
230
+ doi = {10.5281/zenodo.18865198},
231
+ url = {https://doi.org/10.5281/zenodo.18865198}
232
+ }
233
+
234
+ @article{sanchez2026cartography,
235
+ author = {Sanchez, Bryan},
236
+ title = {Confidence Cartography: Teacher-Forced Probability as a
237
+ False-Belief Sensor in Language Models},
238
+ year = {2026},
239
+ doi = {10.5281/zenodo.18703505},
240
+ url = {https://doi.org/10.5281/zenodo.18703505}
241
+ }
242
+
243
+ @software{sanchez2026cf90,
244
+ author = {Sanchez, Bryan},
245
+ title = {CF90: Knowledge-Preserving SVD Compression for Large
246
+ Language Models},
247
+ year = {2026},
248
+ doi = {10.5281/zenodo.18718545},
249
+ url = {https://doi.org/10.5281/zenodo.18718545}
250
+ }
251
+
252
+ @article{sanchez2026contrastive,
253
+ author = {Sanchez, Bryan},
254
+ title = {Small Models Can Learn Complex Behaviors ---
255
+ They Just Need the Right Examples},
256
+ year = {2026},
257
+ doi = {10.5281/zenodo.18870555},
258
+ url = {https://doi.org/10.5281/zenodo.18870555}
259
+ }
260
+
261
+ @software{sanchez2026rhoeval,
262
+ author = {Sanchez, Bryan},
263
+ title = {rho-eval: Behavioral Auditing for Large Language Models},
264
+ year = {2026},
265
+ doi = {10.5281/zenodo.18743959},
266
+ url = {https://doi.org/10.5281/zenodo.18743959}
267
+ }
268
+ ```
269
+
270
+ ## Contributing
271
+
272
+ PRs welcome for new probes, model support, or bug fixes. See [open issues](https://github.com/SolomonB14D3/knowledge-fidelity/issues).
273
+
274
+ ## License
275
+
276
+ MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rho-eval"
7
- version = "2.2.3"
7
+ version = "2.4.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",
@@ -87,6 +89,7 @@ rho-hybrid = "rho_eval.cli.rho_hybrid:main"
87
89
  rho-leaderboard = "rho_eval.cli.rho_leaderboard:main"
88
90
  rho-surgery = "rho_eval.cli.rho_surgery:main"
89
91
  rho-benchmark = "rho_eval.cli.rho_benchmark:main"
92
+ rho-unlock = "rho_eval.cli.rho_unlock:main"
90
93
 
91
94
  [project.urls]
92
95
  Homepage = "https://github.com/SolomonB14D3/knowledge-fidelity"
@@ -87,7 +87,7 @@ from .probes import (
87
87
  from .behavioral import load_behavioral_probes, evaluate_behavior
88
88
  from .calibration import load_calibration_data, gentle_finetune
89
89
 
90
- __version__ = "2.2.3"
90
+ __version__ = "2.4.0"
91
91
 
92
92
  __all__ = [
93
93
  # ── New v2 API ──