一句话:提出首个运行时监控工具 BiasRV,在部署的情感分析系统对输入文本做出有偏预测时发出警报。
情感分析系统虽广泛应用,却会产生有偏结果;已有工作多自动生成测试用例揭示不公平,但缺少运行时监控并揭示有偏预测的工具。BiasRV 动态从输入文本提取模板,生成仅性别信息不同的语义等价变异体,并基于常用整体公平性指标定义单条预测的分布公平性属性,要求不同性别类的变异体被相似处理。由于直接验证该属性开销很大,BiasRV 采用两步启发式:先从每个性别采样若干变异体检查情感是否一致,仅当结果冲突时再验证分布公平性。实验表明,相比对每个输入直接检查分布公平性,该启发式将变异体分析开销降低 73.81%,仅漏掉 6.7% 的有偏预测。BiasRV 无需获知系统实现即可使用,并可扩展到种族、职业等更多偏见类型。
Sentiment analysis (SA) systems, though widely applied in many domains, have been demonstrated to produce biased results. Some research works have been done in automatically generating test cases to reveal unfairness in SA systems, but the community still lacks tools that can monitor and uncover biased predictions at runtime. This paper fills this gap by proposing BiasRV, the first tool to raise an alarm when a deployed SA system makes a biased prediction on a given input text. To implement this feature, BiasRV dynamically extracts a template from an input text and generates gender-discriminatory mutants (semantically-equivalent texts that only differ in gender information) from the template. Based on popular metrics used to evaluate the overall fairness of an SA system, we define the distributional fairness property for an individual prediction of an SA system. This property specifies a requirement that for one piece of text, mutants from different gender classes should be treated similarly. Verifying the distributional fairness property causes much overhead to the running system. To run more efficiently, BiasRV adopts a two-step heuristic: (1) sampling several mutants from each gender and checking if the system predicts them as of the same sentiment, (2) checking distributional fairness only when sampled mutants have conflicting results. Experiments show that when compared to directly checking the distributional fairness property for each input text, our two-step heuristic can decrease the overhead used for analyzing mutants by 73.81% while only resulting in 6.7% of biased predictions being missed. Besides, BiasRV can be used conveniently without knowing the implementation of SA systems. Future researchers can easily extend BiasRV to detect more types of bias, e.g., race and occupation. The demo video for BiasRV can be viewed at https://youtu.be/WPe4Ml77d3U and the source code can be found at https://github.com/soarsmu/BiasRV.