低资源语言:标注少,只是问题的一部分
Low-resource languages
区分语言资源和使用者数量,测量标注预算的不确定性,并检验迁移先验何时帮助一个群体却损害另一个。
low-resource-languages模型总体进步,小群体却可能更难使用
设想一个包含两种语言变体的虚构标注任务。较常见变体中,线索bright通常指向类别1;较少见变体中,同一线索指向类别0。若迁移模型默认采用常见解释,可能在合并测试集上表现很好,却把小群体所有例子都判错。单个平均分会掩盖适配原本要解决的问题。
“低资源”是相对于语言、任务、领域和预期用途的资源不足,不是在评价语言的表达能力。使用者数量本身,也不能说明有多少可用训练数据、标注、工具或评测知识。已标注样本、未标注文本和平行数据满足不同需求。Joshi等人明确区分资源类型,并解释为什么不同任务的原始数据条数不能直接比较。资源分类与单位
资源还包括合适的计算基础设施、时间、联系网络,以及解释结果所需的知识。Nekoto等人讨论这些限制,并描述让参与者介入问题定义、分析和解释,而不只是提供数据的参与式研究。抓取更大语料,不会自动解决这些问题。限制与参与,第3.1—3.2节
下面的程序只隔离一个问题:标注预算固定而且很小时,给定的迁移先验怎样影响两个群体?群体、线索和标签全部虚构,不代表任何真实语言,也不能代替社区主导的任务设计。明确这个边界,才能计算小实验的全部结果,而不把合成准确率变成语言支持能力声明。
让迁移带来的假设看得见
设一个“群体—线索”单元中,标签1的概率p未知。用均值mu、正强度tau参数化Beta先验:
这是关于声明单元内标签概率的建模假设,不是预训练语言模型。迁移先验从另一来源提供mu;本例直接给定这个值,不假装已经从真实源语料估计它。从头学习基线使用mu=0.5。
假设该单元的n个目标标签在给定p时是条件独立的Bernoulli观察,其中s个为正。似然乘先验,相当于指数相加:
把后验参数记为alpha和beta。均值给出下一标签为正的预测概率;方差描述对单元概率p的不确定性:
这个方差不是一次二元预测的方差,也不能保证经验校准。如果先验不合适,或同一单元混合了不同用法,模型的不确定性描述可能误导。没有目标标签的群体使用声明的先验,代码不会捏造观察。
对rare群体的bright线索,使用错误迁移均值0.9、强度2,再连续观察两个负标签。令D-k包含前k个负标签,D-0为空,得到:
第一个相反标签反而增加了方差:估计先离开先验强烈偏好的区域,再随更多数据集中。不能声称每条实际观察序列的后验方差都会单调减少。若均值高于0.5才预测1,第一个负例还不足以推翻迁移分类,第二个才足够。
这说明先验强度与先验均值同样重要。很强的错误先验,可能抵抗全部可用目标样本。在这个模型里,更多数据或更弱先验可能有帮助;实际适配还取决于输入表示能否表达目标语言需要的区别。
枚举标注选择,不只展示一次幸运划分
完整原创程序使用Python 3.12和NumPy 1.26.4。标注池共12条,common群体八条、rare群体四条;独立固定测试集十条,common八条、rare两条,ID与标注池不同。群体及线索特征已提供,没有学习语言识别或文本表示。
"""Original finite annotation-budget experiment, not a language benchmark.
Two invented varieties reverse a cue's label. A supplied transfer prior may
help the larger group while hurting the smaller group. Enumerate all subsets.
"""
import itertools
import json
import math
import numpy as np
CUES=('bright','dim')
def records(values,allow_empty=False):
rows=[dict(r) for r in values]
if not (0 if allow_empty else 1)<=len(rows)<=128:raise ValueError('Use a bounded sample list')
for r in rows:
if set(r)!={'id','group','cue','label'} or any(not isinstance(r[k],str) or not r[k] or len(r[k])>40 for k in ['id','group']) or r['cue'] not in CUES or type(r['label']) is not int or r['label'] not in (0,1):raise ValueError('Invalid invented annotation record')
if len({r['id'] for r in rows})!=len(rows):raise ValueError('Annotation IDs must be unique')
return rows
def fit(training,source_mean=None,strength=2.):
rows=records(training,True);means=dict(zip(CUES,[.5,.5])) if source_mean is None else dict(source_mean)
if set(means)!=set(CUES) or not all(np.isfinite(x) and 0<x<1 for x in means.values()):raise ValueError('One strict interior prior mean per cue required')
if isinstance(strength,bool) or not np.isscalar(strength) or not np.isfinite(strength) or not 0<strength<=100:raise ValueError('Positive bounded prior strength required')
counts={}
for r in rows:
key=(r['group'],r['cue']);success,total=counts.get(key,(0,0));counts[key]=(success+r['label'],total+1)
return dict(counts=counts,prior=means,strength=float(strength),training_ids={r['id'] for r in rows})
def posterior(model,group,cue):
if cue not in CUES or not isinstance(group,str) or not group:raise ValueError('Known cue and group name required')
success,total=model['counts'].get((group,cue),(0,0));strength=model['strength'];mu=model['prior'][cue]
alpha=strength*mu+success;beta=strength*(1-mu)+total-success;s=alpha+beta
return dict(alpha=alpha,beta=beta,mean=alpha/s,variance=alpha*beta/(s*s*(s+1)),target_labels=total)
def evaluate(model,test):
rows=records(test)
if any(r['id'] in model['training_ids'] for r in rows):raise ValueError('Evaluation IDs overlap labeled training examples')
groups={};correct=0
for r in rows:
# An exact .5 posterior is assigned class0, consistently in both methods.
label=int(posterior(model,r['group'],r['cue'])['mean']>.5);ok=int(label==r['label'])
previous,total=groups.get(r['group'],(0,0));groups[r['group']]=(previous+ok,total+1);correct+=ok
per={g:dict(correct=c,total=n,accuracy=c/n) for g,(c,n) in sorted(groups.items())}
return dict(micro=correct/len(rows),macro=sum(x['accuracy'] for x in per.values())/len(per),
worst_group=min(x['accuracy'] for x in per.values()),per_group=per)
def learning_curve(pool,test,budgets,source_mean=None,strength=2.):
pool=records(pool,True);test=records(test);budgets=list(budgets)
if len(pool)>12 or not budgets or len(set(budgets))!=len(budgets) or any(type(k) is not int or not 0<=k<=len(pool) for k in budgets):raise ValueError('Enumerate unique budgets within a pool of at most12')
if {r['id'] for r in pool}&{r['id'] for r in test}:raise ValueError('Hold evaluation IDs out of the annotation pool')
out=[]
for k in budgets:
metrics=[]
for selected in itertools.combinations(range(len(pool)),k):
score=evaluate(fit([pool[i] for i in selected],source_mean,strength),test)
metrics.append([score[key] for key in ('micro','macro','worst_group')])
a=np.array(metrics)
out.append(dict(budget=k,subsets=len(metrics),mean=dict(zip(('micro','macro','worst_group'),a.mean(axis=0).tolist())),
subset_std=dict(zip(('micro','macro','worst_group'),a.std(axis=0).tolist())),
minimum_macro=float(a[:,1].min()),maximum_macro=float(a[:,1].max())))
return out
def invented_data():
pool=[];test=[]
for group,repeats in [('common',4),('rare',2)]:
for cue in CUES:
label=int(cue=='bright') if group=='common' else int(cue=='dim')
for i in range(repeats):pool.append(dict(id=f'train-{group}-{cue}-{i}',group=group,cue=cue,label=label))
for i in range(4 if group=='common' else 1):test.append(dict(id=f'test-{group}-{cue}-{i}',group=group,cue=cue,label=label))
return pool,test
def demo():
pool,test=invented_data();prior={'bright':.9,'dim':.1};budgets=[0,1,2,4,8,12]
rare=[r for r in pool if r['group']=='rare' and r['cue']=='bright']
updates=[posterior(fit(rare[:k],prior),'rare','bright') for k in range(3)]
return dict(pool=pool,test=test,prior=prior,prior_strength=2.,
scratch=learning_curve(pool,test,budgets),transfer=learning_curve(pool,test,budgets,prior),
rare_bright_posteriors=updates,zero_label_transfer=evaluate(fit([],prior),test),
conditions='All annotation subsets of a12-item invented pool; fixed disjoint10-item test set. Subset standard deviations are not confidence intervals for real languages. Group/cue features and source priors are supplied.')
if __name__=='__main__':print(json.dumps(demo(),indent=2,allow_nan=False))
每个群体中,两种线索对应相反标签;rare把common的约定反过来。从头学习先验为每种线索给均值0.5;迁移先验则给两个群体都使用bright均值0.9、dim均值0.1,强度2。每个群体—线索单元随后只用本单元目标标注更新。后验均值大于0.5预测1,恰好同分时两种方法都预测0。
预算为k时,对固定池P的每个k条标注子集S都拟合模型,再在同一未参与训练的测试集上评测。选定分数M的均值与子集间标准差为:
预算[0,1,2,4,8,12]使每种方法共拟合1,070次。这些统计量精确描述声明的有限标注实验,不是真实语言、新语料或未来用户的性能置信区间。输出还保留宏平均分数的最小值和最大值,避免均值掩盖“具体标了哪些样本”的影响。
预算一条时,从头学习的期望微平均准确率为0.65、宏平均0.625;迁移则微平均0.8、宏平均0.5。迁移假设立即帮助大群体,一个相反的rare标签却还不能推翻它。预算两条时,抽到两个rare-bright或两个rare-dim样本才能纠正相应单元;迁移的精确期望分数为0.8+0.2/66和0.5+0.5/66。
强度2且标满12条时,两种方法都在构造测试集上达到准确率1。如果把迁移强度提高到4,现有标签就不足以推翻两个错误rare先验:common准确率仍为1,rare为零。这是否定“迁移保证有益”的反例,不是所有迁移通常有害的证据。
检查覆盖后验参数及方差、一条/两条标注的精确期望、子集计数、顺序不变性和训练/测试ID隔离。预算枚举成本约为各二项式子集数之和,乘以拟合及测试工作,随池规模呈指数增长。因此把池限制为12条;它是教学枚举器,不是大语料采样方法。
与任务面向的人共同选择数据和评测
设群体g答对c-g条,测试数m-g非零。微平均与群体宏平均回答不同问题:
微平均给每条测试样本相同权重,宏平均给声明的群体相同权重,两者都不会自动决定正确部署目标。应说明群体、抽样过程和错误后果,并保留分群体结果。评测缺失或样本太少是证据缺口,不是零分,也不是成功证明。
真实低资源工作在拟合模型之前就开始了:定义有用任务,确认谁能判断结果,检查数据来源及允许用途,并共同商定评测语言与标准。Nekoto等人描述的参与式方法,包括共同定义研究过程,而不是只把语言使用者当作标注提供者。Masakhane仓库可作为组织社区研究、数据、代码和结果的具体参考。参与研究设计 固定版本项目参考
技术路线可以包括监督基线、预训练表示、跨语言迁移、多语言训练、谨慎的数据增强或定向标注;适用性取决于可用资源与正在解决的错误。当复杂系统的表面收益来自泄漏、不匹配的测试分布或不公平的标注预算时,一个失败原因明确的简单基线很有价值。
真实语料里,ID不同不足以防止泄漏。应按任务检查重复文本、译文、说话者、作者、时间段和模板,避免把验证与测试标签用于训练或选择。报告抽样选择或运行之间的变化,并区分标注分歧与模型错误。本例的确定性线索和已知群体身份排除了许多困难,因此不能代替真实语言验证。
找出小小平均数藏起了什么
-
只知道使用者数量,就能判断一种语言是否有足够资源完成某个NLP任务吗?
答案:不能。可用标注、平行或单语数据、工具、基础设施和评测知识都可能随任务与领域变化,资源类型及适用性很重要,不只看人口或总量。
-
先验均值0.9、强度2,观察一个和两个负标签后,后验均值与预测类别分别是什么?
答案:先验参数为1.8和0.2。一个负例后均值1.8/3=0.6,仍判1;两个后为1.8/4=0.45,改判0。错误先验最初抵抗了目标证据。
-
预算一条时,迁移微平均0.8、宏平均0.5;从头学习分别0.65和0.625。哪个更好?
答案:指标因群体权重不同而给出不同结论。迁移在合并样本上更好,在等权群体平均上更差。应检查rare群体错误,选择适合任务的目标,而不是宣布无条件胜者。
-
枚举所有标注子集,是否就得到了真实语言性能的置信区间?
答案:没有。它完整描述这个固定合成池和测试设计下的变化。真实语言主张仍需要合适数据、可辩护的抽样与评测约定,以及能解释输出的人。
把资源测量也当作研究问题
Joshi等人从资源可用性分析语言包容性,解释资源类别背后的假设;Nekoto等人考察低资源翻译研究需要的人与条件。它们与数值实验相互补充:有限标签可以测量,却只是问题的一部分。资源多样性 参与式研究
Beta模型、虚构变体和穷举预算研究均为原创教学选择,展示某种假设怎样改善总体分数,却延迟小群体的适配。可用这个机制设计信息更充分的实验;声称系统很好地服务某种语言之前,还要取得该语言的具体证据。
先判断,再看解释
在本篇Beta模型中,新标签会增加后验不确定性吗?
学习目标
- 按语言、任务和相关条件描述资源不足。
- 用目标标注更新声明的迁移先验。
- 测量标注子集变化,不冒称真实语言置信区间。
- 识别总体收益掩盖的小群体退步。
先修与延伸
查看知识关联图 →参考文献
- The State and Fate of Linguistic Diversity and Inclusion in the NLP World
Pratik Joshi, Sebastin Santy, Amar Budhiraja, Kalika Bali, Monojit Choudhury · 2020 - Participatory Research for Low-resourced Machine Translation: A Case Study in African Languages
Masakhane community (∀ in the paper), Wilhelmina Nekoto and coauthors · 2020 - Masakhane MT: pinned community research README and MIT license
Masakhane community · 2022
版本1 · 编写状态: 已完成记录中的技术复核
查看技术检查记录(AI)
Codex · 2026-09-13 · Single AI author checked resource/community boundaries against scoped Joshi and Nekoto sections. Six paired equations and four explained exercises independently derive Beta posterior mean/variance, subset expectation, per-group and aggregate scores, and negative transfer under a wrong supplied prior. Enumerated 1070 subsets per method; the invented groups and fixed test are not real-language confidence intervals or community claims.
- 检验全部有界标签子集及精确Beta例子。单标签从头学习微/宏分数.65/.625,迁移.8/.5;相反证据使方差.03→.06→.0495。强错误先验在全部12标签后仍让稀少群体准确率为零;来源与社区讨论另行说明。
- 四张计算SVG绑定真实双语程序;本组九项数值/编码检查、24组语言/宽度及四字体检查通过,AI作者实际查看八张截图。冻结前检查普通正文AST;完整文章页面验收另记,不称人工同行审校。
核对的来源位置:
- The State and Fate of Linguistic Diversity and Inclusion in the NLP World · Abstract/introduction and taxonomy feature discussion visible at layout93–118: labeled/unlabeled resources, task units and measurement assumptions. No historical counts promoted to a 2026 language inventory.
- Participatory Research for Low-resourced Machine Translation: A Case Study in African Languages · Title/authorship, abstract and sections3.1–3.2 excerpts layout239–272: infrastructure, expertise, evaluation connections and participation in definition/analysis/interpretation. Individual language cases and rights not fully reviewed; no benchmark replication.
- Masakhane MT: pinned community research README and MIT license · Commit 2022-06-14; README 1–24 community goals and research/data/code/results organization, MIT text read. Root software license does not establish every dataset license; no upstream content reused.
相关主题