您现在的位置是:热点 >>正文
AI根据代码内容自动起函数名,再也不怕命名不规范的同事了
热点932400人已围观
简介...
本文经AI新媒体量子位(公众号ID:QbitAI)授权转载,转载请联系出处。
有的人能把代码写成推理小说。
需要一个临时变量的时候就叫temp,需要多个就叫var1,var2。
甚至用拼音AI缩写当函数名,比如查询订单就叫cxdd。
要想看懂这样的代码,得联系上下文反复推敲,还原每个部分的真实作用。
这个过程叫做反混淆(Deobfuscation)。
麻烦,着实麻烦。就没有省事儿点的办法吗?
让根据AI来啊!
最近,Facebook就出了这样一个语言模型DOBF,专治代码混淆。
像下图这种,所有不影响运行的变量名、函数名、类名,都被替换成无意义的符号,AI都能作出猜测并尝试还原。
来看看和正确答案的对比,代码虽然不是完全一样,但AI的改法也大大提高了代码的可读性。
像FUNC_0,源代码中是“重置参数”,AI改成“初始化权重”,也完全说得通。
DOBF模型目前除了Python还支持C++和Java。
编码内容不规范的人毕竟是少数,这个模型更广泛的用途是恢复故意做混淆以保护知识产权的代码,比如这种:
代码写好后,把不影响编译运行的部分,批量替换成人类难以分辨的符号,给破译增加难度。
在这之前也有掩码语言模自动型(Masked Language Model)用于恢复被遮蔽的文本。
用于恢复代码的有哈工大&微软开发的CodeBERT和Facebook之前开发的TransCoder,但效果都不如最新的DO起函BF。
DOBF超过它们靠的不是模型架构上的创新或数据集的完善,而是提出了新的预训练任务。
合理的任务指导AI学习
之前的掩码语言模型多是随机选择要掩蔽的部分,经常会选到括号逗号这种对AI来说没什么难度的。
D数名OBF的做法是指定遮蔽变量名、函数名和类名并让AI去恢复,这个任务难度更大,能迫使AI学到更深层的规律。
另外还用相同的符号替代多次出现的同一名称,这样可以防止AI发现有的名字可以复制粘贴之后学会偷,再懒走捷径。
像上图中的变量V3,AI从第3行的定义可以看出这个变量是List类型,再一看第5行调用的是pop(0)。
这不是先进先出嘛,AI就会命名成queue(队列)而不是stack(堆栈)了。
更厉害的也不还在后面,DOBF通过代码内容甚至能判断出相应函数是生成斐波那契数列和做向量点积的。
DOBF在架构上其实没有特别的设计,只是为了公平对比分别训练了两个和CodeBERT、TransCoder层数一样的怕命模型。
成功的关键之处就在于合理的训练任务。
微调一下能完成更多任务
验证了这个方法有效后,Facebook把这个训练任务提取出来称为DOBF任务,还可以用于训练其他语言模型。
比如在TransCode名不r模型上把DOBF作为预训练任务,再用CodeXGLUE基准测试中的下游任务进行微调。
结果在代码抄袭检测、总结代码生成文档、和自然语言搜索代码片段这3个任务上,使用DOBF或MLM+DOBF预训规范练都取得了更好的成绩。
Facebook下一步还要以DOBF作为指导,看看能不能为自然语言设计更好的预训练目标。
不过代码上的事还不算完,人类在混淆代码上可是无所不用其极的。
期待着有一天,AI连国际C语的同言混乱代码大赛上的变态代码也能看懂。
Github地址:
https://github.com/facebookresearch/CodeGen/blob/master/docs/dobf.md
论文地址:
h事了ttps://arxiv.org/abs/2102.07492
国际C语言混乱代码大赛:
http://www.ioccc.org/
Tags:
相关文章
标签: 小鹏机器人 IRON人形机器人 广棠科创城 具身智能
热点云梦级2月26日云梦级消息,在25日召开的广州市高质量发展大会上,小鹏人形机器人全链条量产基地作为天河区重点“开门红”项目正式提报。会上,天河区委书记谭明鹤表示,将“推动小鹏机器人制造工厂等30个项目...
【热点】
阅读更多搜索引擎新技能,阿里新研究用2D图片搜出3D模型
热点本文经AI新媒体量子位(公众号ID:QbitAI)授权转载,转载请联系出处。 AI技术的研究正在从2D走向更高难度的3D。12月3日,记者获悉,阿里技术团队研发了全新3D AI算法,可基于2D图片精准...
【热点】
阅读更多美国多州提议暂停新建数据中心,环保组织呼吁全国层面叫停
热点2 月 8 日消息,美国纽约州议员已提出一项法案,拟对与新建数据中心的建设及运营相关的许可实施至少三年的暂停期。尽管该法案前景尚不明朗,但据《连线》杂志报道,纽约州至少已是第六个考虑暂停新建数据中心的...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.terramania.nl/catalogsearch/result/index/?q=外推留痕软件【tg:seogoogle987】,PDj
- https://www.remit.co.jp/zh/?s=外推留痕软件【tg:seogoogle987】,SPt
- https://www.sensorshop24.de/catalogsearch/result/index/?type=132&q=外推留痕软件【tg:seogoogle987】,S1l
- https://www.vivaraise.fr/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,irV
- https://m.shoppinghow.kakao.com/m/search/q/外推留痕软件【tg:seogoogle987】SEW
- https://www.paxnet.co.kr/search/jongmok?kwd=外推留痕软件【tg:seogoogle987】2c9
- https://www.livehindustan.com/tags/外推留痕软件【tg:seogoogle987】,udo
- https://www.sbaad.no/?s=外推留痕软件【tg:seogoogle987】,qJs
- https://www.pearlstonecenter.org/search/外推留痕软件【tg:seogoogle987】,s0w
- https://www.parl.ca/legisinfo/fr/projets-de-loi?parlsession=all&view=list&keywords=外推留痕软件【tg:seogoogle987】,QPq
- https://www.openspaceinstitute.org/search?q=外推留痕软件【tg:seogoogle987】,xUy
- https://www.kelsa.co.uk/catalogsearch/result/index/?T=1686132119291&q=外推留痕软件【tg:seogoogle987】,PrM
- https://www.pierreherme.com/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,3rq
- https://www.lee.com/search?q=外推留痕软件【tg:seogoogle987】,tRb
- https://www.vet-direct.com/search?cat=72&term=外推留痕软件【tg:seogoogle987】,XGq
- https://www.xvideos.com/tags/外推留痕软件【tg:seogoogle987】,Hwn
- https://www.zutari.com/search/外推留痕软件【tg:seogoogle987】,6pM
- https://www.lneg.pt/?cat=140&s=外推留痕软件【tg:seogoogle987】,iHY
- https://www.spoiledsweetboutique.com/search/外推留痕软件【tg:seogoogle987】,x9o
- https://www.nuovabai.it/catalogsearch/result/?action=SEARCH&q=外推留痕软件【tg:seogoogle987】,jUx
- https://www.parriscues.com/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,dEc
- https://www.paulaschoice.hk/zh_hant/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,d6c
- https://www.valuecolleges.com/?action=QUERY&s=外推留痕软件【tg:seogoogle987】,yM2
- https://www.nslcleaders.org/?s=外推留痕软件【tg:seogoogle987】,XHN
- https://www.msrenewal.com/search/外推留痕软件【tg:seogoogle987】,JdU
- https://www.jusoen.com/addreng.asp?p1=外推留痕软件【tg:seogoogle987】WYR
- https://www.ucycle.com/search/=外推留痕软件【tg:seogoogle987】,cdB
- https://www.synonyms.com/antonyms/外推留痕软件【tg:seogoogle987】,E1o
- https://www.therapeuticassociates.com/?cat=5&s=外推留痕软件【tg:seogoogle987】,r0F
- https://www.whirlpool.com.hk/chinese/catalogsearch/result?cat=30&q=外推留痕软件【tg:seogoogle987】,4Me
- https://www.world-architects.com/en/search?term=外推留痕软件【tg:seogoogle987】,e5I
- https://www.maigoo.com/search/?block=&q=外推留痕软件【tg:seogoogle987】,el9
- https://www.wellbees.com/index.php/catalogsearch/result/index/?q=外推留痕软件【tg:seogoogle987】,Yue
- https://www.wattpad.com/search/外推留痕软件【tg:seogoogle987】AcL
- https://www.qidulp.com/search?query=外推留痕软件【tg:seogoogle987】,dDq
- https://www.teamlab.art/es/?submit=外推留痕软件【tg:seogoogle987】,MF3
- https://www.rostaing.com/catalogsearch/result/?cat=22&q=外推留痕软件【tg:seogoogle987】,lGz
- https://www.yli.ro/catalogsearch/result/?q=外推留痕软件【tg:seogoogle987】,fY1
- https://store.line.me/search/sticker/ja?q=外推留痕软件【tg:seogoogle987】hao
- https://5gaa.org/?token=6e2l7hjt2i26gzgctgwdrv7v0j6nxorq&s=外推留痕软件【tg:seogoogle987】nia
- https://www.sic-info.org/vi/?s=外推留痕软件【tg:seogoogle987】,5ud
- https://www.remit.co.jp/id/?s=外推留痕软件【tg:seogoogle987】,gBK
- https://www.maafushidive.com?collections?vendors?q=外推留痕软件【tg:seogoogle987】,atB
- https://www.teacherspayteachers.com/Browse/Price-Range/Free/Search:外推留痕软件【tg:seogoogle987】,U1F
- https://zhidao.baidu.com/index/?action=QUERY&word=外推留痕软件【tg:seogoogle987】,pMQ
- https://www.laoairlines.com/?action=QUERY&s=外推留痕软件【tg:seogoogle987】,7BQ
- https://www.ushmm.org/search/results.php?q=外推留痕软件【tg:seogoogle987】,Vfa
- https://www.goodreads.com/quotes/tag/外推留痕软件【tg:seogoogle987】2MJ
- https://www.seforall.org/search?keywords=外推留痕软件【tg:seogoogle987】,2s5
- https://www.londontheatredirect.com/search/外推留痕软件【tg:seogoogle987】,DIw