admin管理员组

文章数量:1530085

诸神缄默不语-个人CSDN博文目录

论文全名:Judicial knowledge‑enhanced magnitude‑aware reasoning for numerical legal judgment prediction
模型简称:NumLJP
任务:numerical LJP (numerical legal judgment prediction),指LJP中与数值相关的任务,在本文中是预测刑期(以月为单位)和罚金(视作ordinal classification任务)。

(这篇文章管罚金叫terms of penalty,我是真的很崩溃,我不确定这篇论文是不是唯一一篇这么干的)

SpringerLink论文链接:https://link.springer/article/10.1007/s10506-022-09337-4

本文是2022年Artificial Intelligence and Law的论文。排版挺一言难尽的,只能说,又不是不能看。
主要关注numerical LJP任务。
本文认为以前的LJP工作没有关注案例中的数值信息,无法获知不同判决数值的大小可比性(如400 < 500 < 800)(numerical comparison)。
因此本文提出了NumLJP框架,来学习文字中的数值信息:先选择判决知识(见第1节具体介绍),然后根据判决知识和案例信息预测刑期和罚金。

①a judicial knowledge selection module: 先用基于对比学习的判决知识选择器来区分易混淆案例1,以前的工作只用了法条作为外部知识,而本文用的是真实场景下的量化标准,用来锚定参考数额(numerical anchors:判决知识中的参考数字)。
②a legal numerical commonsense acquisition: 设计Masked Numeral Prediction (MNP) 来让模型记住锚定,以根据选择的判决知识获得法学的数值常识。
③a reasoning module: 构建scale-based numerical graph(由锚定和事实描述中的数值构成)实现magnitude-aware数值推理。
意思就是学习这些数字的表征。
④judgment prediction module: 最后用事实描述、判决知识和数字实现司法决策。

文章目录

  • 1. 问题定义
  • 2. 模型
    • 1. JKS (judicial knowledge selection module)
    • 2. MNP (legal numerical commonsense acquisition)
    • 3. MagNet (reasoning module)
    • 4. judgment prediction module
  • 3. 实验
    • 3.1 数据集
    • 3.2 指标
    • 3.3 baseline
    • 3.4 实验设置
    • 3.5 主实验结果
    • 3.6 实验分析

1. 问题定义

本文中的numerical legal judgment prediction预测刑期和罚金,都是分成几个interval,实际上相当于做ordinal分类任务。最后的指标也用的是分类任务的macro-F1。

本文假设案件事实中的数值所在的区间与最终的判决结果之间存在函数关系:

在CAIL2018数据集的前人工作中,预测刑期的准确率要明显低于罪名和法条的。作者认为这是因为前人工作忽略了罪名事实描述中的数值信息,仅将其视为plain words或[UNK]。(如偷了1939元或者7300元会导致刑期出现很大的差别,在两案之间的7000元的刑期和罚款金额也都应该在二者之间,如果模型不理解数字的话就无法正确预测刑期和罚款金额 numerical comparison
NumNet2等数值推理工作则可以很好地实现comparison relationship。
但这些工作 1. 忽略了数值对应的犯罪类型。如前图中AB是偷窃,C是抢劫,那具体金额就不能直接拿来比。2. 忽略了量级(比如7000更靠近7300,所以刑期应该更靠近7300的刑期(12个月) magnitude awareness)3. 缺乏训练数据,案例中的数字太少(解决方案是引入数值锚点,限制了总的数值搜索空间)

本文认为判决知识比法条更实用、详细、定量:
(绿色字体为数值锚点)

判决流程:

(图源另一篇论文)

2. 模型

Roberta表征句子:
u ⃗ X , X ˉ = RoBERTa ( [ C L S ] ;   X ) , \begin{aligned} \vec{u}^X,\bar{\mathbf {X}}={\text {RoBERTa}}(\mathrm {[CLS]};\,X), \end{aligned} u X,Xˉ=RoBERTa([CLS];X),
u ⃗ X \vec{u}^X u X是[CLS]表征, X \mathbf {X} X是所有token的表征矩阵

1. JKS (judicial knowledge selection module)

对比学习分类器:根据犯罪事实选出判决知识(一种知识对应一种犯罪行为)

同一犯罪事实(就是指同一类)的数字用于对比学习(参考3):
L1:交叉熵
L2:有监督对比学习SCL(让同类样本的表征相似度靠近。感觉表现出来是常规对比学习损失函数啊,可以参考这篇:对比学习(持续更新ing…))
L J K S = ( 1 − λ ) L 1 + λ L 2 , L 1 = − 1 N ∑ i = 1 N ∑ m = 1 n A y i , m A ⋅ log ⁡ y ^ i , m A , L 2 = ∑ i = 1 N − 1 N y i A − 1 ∑ j = 1 N 1 i ≠ j 1 y i A = y j A log ⁡ exp ⁡ ( u ⃗ i X ⋅ u ⃗ j X / τ ) ∑ k = 1 N 1 i ≠ k exp ⁡ ( u ⃗ i X ⋅ u ⃗ k X / τ ) , \begin{aligned} \begin{aligned} \mathcal {L}_{\mathrm {JKS}}&=(1-\lambda ) \mathcal {L}_{1}+\lambda \mathcal {L}_{2}, \\ \mathcal {L}_{1}&=-\frac{1}{N} \sum _{i=1}^{N} \sum _{m=1}^{n^{\mathcal {A}}} y_{i,m}^{\mathcal {A}} \cdot \log \hat{y}_{i,m}^{\mathcal {A}}, \\ \mathcal {L}_{2}&=\sum _{i=1}^{N}-\frac{1}{N_{y_{i}^{\mathcal {A}}}-1} \sum _{j=1}^{N} \mathbf {1}_{i \ne j} \mathbf {1}_{y_{i}^{\mathcal {A}}=y_{j}^{\mathcal {A}}}\\&\quad \log \frac{\exp \left( \vec{u}_i^X \cdot \vec{u}_j^X / \tau \right) }{\sum _{k=1}^{N} \mathbf {1}_{i \ne k} \exp \left( \vec{u}_i^X \cdot \vec{u}_k^X / \tau \right) }, \end{aligned} \end{aligned} LJKSL1L2=(1λ)L1+λL2,=N1i=1Nm=1nAyi,mAlogy^i,mA,=i=1NNyiA11j=1N1i=j1yiA=yjAlogk=1N1i=kexp(u iXu kX/τ)exp(u iXu jX/τ),

识别细粒度的数值类型

2. MNP (legal numerical commonsense acquisition)

对判决知识做Masked Numeral Prediction (MNP):获取判决知识中的法律数值常识

用分类范式来预测(词表是所有数值锚点)

L M N P = − 1 N ∑ i = 1 N ∑ j = 1 n A ∑ k = 1 n V y i , j k ⋅ log ⁡ y ^ i , j k , \begin{aligned} \mathcal {L}_{\mathrm {MNP}}&=-\frac{1}{N} \sum _{i=1}^{N} \sum _{j=1}^{n^A} \sum _{k=1}^{n^{V}} y_{i,j}^k \cdot \log \hat{y}_{i,j}^k, \end{aligned} LMNP=N1i=1Nj=1nAk=1nVyi,jklogy^i,jk,

3. MagNet (reasoning module)

scale-based numerical graph
异质有向图
节点是事实描述和判决知识中的数值
边是comparison and magnitude relationships:大于/小于(REL)+MAG

72和100之间的边:

这个MAG的计算还挺复杂的,我没太看懂,就大概抄一下。如果有知道原理的可以跟我讲一下这到底是个啥玩意:

  1. 以特定scale切分。设计mutiplier,表征mutiplier
  2. MinDiff
  3. s c a l e t = MinDiff ( v i A , v j A ) N t scale^t=\frac{{\text {MinDiff}}(v_i^A, v_j^A)}{N^t} scalet=NtMinDiff(viA,vjA)
    N t N^t Nt要满足: ⌈ ∗ ⌉ m t s c a l e t ≤ f m a x , \begin{aligned} \lceil *\rceil {\frac{m^t}{scale^t}}\le f_{max}, \end{aligned} scaletmtfmax,(大小与accuracy/recall之间的权衡有关)
  4. 计算multiplicative factor: f = ⌈ ∗ ⌉ ∣ n ( v i ) − n ( v j ) ∣ s c a l e t f=\lceil *\rceil {\frac{\mid n(v_i)-n(v_j)\mid }{scale^t}} f=scaletn(vi)n(vj)
    f ∈ { 1 , . . . , N f } f\in \{1,...,N^f\} f{1,...,Nf} N f N^f Nf调出来可以设100)

MagNet (Magnitude-aware numerical reasoning Network):表征数值(具体的介绍没看懂,我不写了,大概意思是用了个GAT?)

M X = W M X ˉ , M A = W M A ˉ , U = MagNet ( G ; M X , M A , u ⃗ X , u ⃗ A ) , \begin{aligned} \begin{aligned} \mathbf {M}^X&= \mathbf {W}^M\bar{\mathbf {X}},\\ \mathbf {M}^A&= \mathbf {W}^M\bar{\mathbf {A}},\\ \mathbf {U}&= {\text {MagNet}}(\mathcal {G};\mathbf {M}^X,\mathbf {M}^A,\vec{u}^X,\vec{u}^A), \end{aligned} \end{aligned} MXMAU=WMXˉ,=WMAˉ,=MagNet(G;MX,MA,u X,u A),

将事实描述和判决知识中的数值表征合并,进行线性转换,得到magnitude-aware semantic representation:
M n u m = U [ I X , I A ] , M O = W O [ M n u m ; [ M X ; M A ] ] , \begin{aligned} \begin{aligned} \mathbf {M}^{num}&= \mathbf {U}[\mathbf {I}^X,\mathbf {I}^A],\\ \mathbf {M}^{O}&= \mathbf {W}^{O}[\mathbf {M}^{num};[\mathbf {M}^X;\mathbf {M}^A]], \end{aligned} \end{aligned} MnumMO=U[IX,IA],=WO[Mnum;[MX;MA]],

4. judgment prediction module

用事实描述、判决知识和数字实现司法决策(刑期比LADAN4的分类更细)。

以前工作用的交叉熵:
L P = − 1 N ∑ i = 1 N ∑ j = 1 n P y i , j P ⋅ log ⁡ y ^ i , j P , \begin{aligned} \mathcal {L}^P&=-\frac{1}{N} \sum _{i=1}^{N} \sum _{j=1}^{n^{P}} y_{i,j}^{P} \cdot \log \hat{y}_{i,j}^{P}, \end{aligned} LP=N1i=1Nj=1nPyi,jPlogy^i,jP,

再提出一个损失函数:
L I = − 1 N ∑ i = 1 N { y i ℓ ⋅ log ⁡ y ^ i ℓ ⏞ life imprisonment + y i d ⋅ log ⁡ y ^ i d ⏞ death + ∑ k = 0 300 y i , k I ⋅ log ⁡ y ^ i , k I [ log ⁡ ( v i , k I ) − log ⁡ ( v ^ i , k I ) ] 2 ⏟ less than 25 years (300 months)   } , \begin{aligned} \mathcal {L}^I =&-\frac{1}{N}\sum _{i=1}^{N}\{\overbrace{y_{i}^{\ell }\cdot \log \hat{y}_{i}^{\ell }}^{\text {life imprisonment}}+\overbrace{y_{i}^{d}\cdot \log \hat{y}_{i}^{d}}^{\text {death}}\nonumber \\&+\underbrace{\sum _{k=0}^{300}y_{i,k}^I\cdot \log \hat{y}_{i,k}^{I}[\log (v_{i,k}^I)-\log (\hat{v}_{i,k}^{I})]^2}_{\text {less than 25 years (300 months)}}\text { }\}, \end{aligned} LI=N1i=1N{yilogy^i life imprisonment+yidlogy^id death+less than 25 years (300 months) k=0300yi,kIlogy^i,kI[log(vi,kI)log(v^i,kI)]2 },
(v是magnitude,怪。倒是也可以理解)

总的损失函数:
L t o t a l = γ L J K S + ( 1 − γ ) L M N P + L I + L P . \begin{aligned} \mathcal {L}_{total}&= \gamma \mathcal {L}_{\mathrm {JKS}}+(1-\gamma )\mathcal {L}_{\mathrm {MNP}}+\mathcal {L}^{I}+\mathcal {L}^{P}. \end{aligned} Ltotal=γLJKS+(1γ)LMNP+LI+LP.

3. 实验

3.1 数据集

CAIL20185:刑期和罚金

  • CAIL-small
  • CAIL-large

AIJudge6:罚金

numerical anchor的示例:

numerical graph节点与边的统计图:

数据预处理部分待补。

3.2 指标

分类任务的指标:accuracy (Acc.), macro-precision (MP), macro-recall (MR) and macro-F1 (F1)

ImpScore(详解待补)
h = ∣ log ⁡ ( I p + 1 ) − log ⁡ ( I g ) + 1 ∣ , ImpScore = { 1 , h ≤ 0.2 , 0.8 , 0.2 < h ≤ 0.4 , 0.6 , 0.4 < h ≤ 0.6 , 0.4 , 0.6 < h ≤ 0.8 , 0.2 , 0.8 < h ≤ 1 , 0 , o t h e r . \begin{aligned} h= & {} \mid \log (I_p+1)-\log (I_g)+1\mid ,\nonumber \\ \text {{\textbf {ImpScore}}}= & {} \left\{ \begin{array}{rcl} 1, &{}&{} {h\le 0.2,}\\ 0.8, &{}&{} {0.2<h\le 0.4,}\\ 0.6, &{}&{} {0.4<h\le 0.6,}\\ 0.4, &{}&{} {0.6<h\le 0.8,}\\ 0.2, &{}&{} {0.8<h\le 1,}\\ 0, &{}&{} {other.} \end{array}\right. \end{aligned} h=ImpScore=log(Ip+1)log(Ig)+1, 1,0.8,0.6,0.4,0.2,0,h0.2,0.2<h0.4,0.4<h0.6,0.6<h0.8,0.8<h1,other.

3.3 baseline

  1. TOPJUDGE
  2. MPBFN
  3. CPTP
  4. NeurJudge7
  5. NumNet2→将encoder换成RoBERTa并在法律文本上继续预训练

3.4 实验设置

待补。

这里用一个梯度裁剪的trick,可能结合GNN+NLP的任务中可以参考。但是我目前用不到,所以就只记一下好了。

3.5 主实验结果

罚金预测:

刑期预测:

3.6 实验分析

待补。


  1. 说到易混淆案例,大家应该有第一反应想到LADAN4和NeurJudge7的敏感程度吧。 ↩︎

  2. (2019 EMNLP) NumNet: Machine Reading Comprehension with Numerical Reasoning ↩︎ ↩︎

  3. Supervised Contrastive Learning for Pre-trained Language Model Fine-tuning ↩︎

  4. Re27:读论文 LADAN Distinguish Confusing Law Articles for Legal Judgment Prediction ↩︎ ↩︎

  5. https://github/thunlp/CAIL ↩︎

  6. https://www.datafountain/competitions/277 ↩︎

  7. (2021 SIGIR) Re38:读论文 NeurJudge: A Circumstance-aware Neural Framework for Legal Judgment Prediction ↩︎ ↩︎

本文标签: 论文KnowledgeEnhancedJudicialNumLJP