# Autoregressive Entity Retrieval
===============================
###### tags: `paper`
https://mp.weixin.qq.com/s?__biz=MzIwNzc2NTk0NQ%3D%3D&idx=1&mid=2247505217&scene=21&sn=8cfc36a84eac3063380946517f8667e9#wechat_redirect
https://github.com/facebookresearch/GENRE
先跟大家說明何謂實體檢索任務

這些實體名稱與mention context存在可預測的匹配模式
* mention 指的是自然語言表示實體的文本片段, 比如"Leonardo"是一個mention,"Mona Lisa"也是一個mention。mention的context指的是mention的上下文, 比如上面例子中的"In 1503"和"began painting" 。
## in/output

實體歧義:x是帶有註釋註釋的源文檔,而y是實體名稱
端到端實體鏈接,x是源文檔,y是標記註釋的源文檔(標記完的X)
## training
1.predict whether is mention -> training時mention會帶入""之後會轉換為[]
2.search mention's title
## 3類實體檢索任務
生成式實體消歧、實體鏈接、文檔檢索
-----------------
> 實體消歧:給定一個包含mention的輸入x,需要生成mention所指代的是KB中的哪一個實體。
> 端到端實體鏈接:給定一個文檔,系統需要檢測其中的entity mentions,並將mentions鏈接到KB中相應的實體。比如輸入是"In 1503, **Leonardo** began painting the **Mona Lisa** ",則需要模型檢測出其中的mention是**Leonardo**和**Mona Lisa** ",然後將其鏈接到KB中的實體**Leonardo da Vinci**和**Mona Lisa**。
> 頁面級別的文本檢索:給定一個包含輸入query,找到其所對應的Wikipedia的文章題目。比如輸入是“Which Florentine painter 1535-1607 used the name Bronzino after the death of his 'uncle'?",輸出是文章題目名'Bronzino'。

### 負採樣
採樣一些不是答案的 但是出現頻率較高
當使用負採樣時,將隨機選擇一小部分的negative words(比如選5個negative words)來更新對應的權重。當然原本輸出為1的節點也應計入並更新對應權重。也就是說,從原本的10000個輸出層節點權重全部更新,改為僅更新6個節點的權重。
雖然有效節省空間 但是仍然challenging and time-consuming
---------------------------------------
### related work
#### Zero-shot EL with Dense Entity Retrieval(BLINK)
========================================
首先採用BI-ENCODER對mention和實體進行embedding,然後採用最近距離找到mention對應的若干候選實體。然後使用CROSS-ENCODER輸出每一個候選實體的概率。
#### **Dense Passage Retrieval for Open-Domain Question Answering**
在檢索之前先用一個dense encoder 給文檔庫中的所有文檔都進行encoding。在檢索的時候用另一個dense encoder 給question 進行encoding,之後根據下圖公式算兩個representation 的similarity,取top-k 作為結果。

#### note
之所以會有auto regressive 是因為想要直接的得到context跟entity的關係
####如何生成實體名稱?
---------



* log-likehood:
measures the goodness of fit of a statistical model to a sample of data for given values of the unknown parameters.
取log後 最可能的
* Beam search:
是在每一時步中保持一定數量的輸出語詞作為候選名單,而在輸出最終結果時將列在候選名單上的序列輸出。
* trie

* figure 3
未出現在Wikipedia中的對的準確度大大低於平均值(〜51%對〜82%)
但是,對於至少在Wikipedia中出現過一次的對,準確度約為80%,這意味著我們的模型可以很好地預測稀有(但不缺少)提及實體對。
* figure 4
我們還顯示了令牌長度的數據分佈
短標題(例如,<10)較高,而對於長標題(例如,> = 10)較低。性能下降不會直接跟隨令牌長度的數據分佈。
345表達對連結較稀有的較有效
## 優勢
檢索速度快很多
1. RAG和DPR+BERT都是在单个任务上分别训练的,因此可以在单个数据集上进行调优。但是GENRE只需要训练一个模型,就可以应用到所有任务,而且效果甚好。
因為需要先算該dataset的vector 而我們這都是拿pretrain好的直接加入
## problem
1. 如何訓練model 偵測到mention 沒辦法 future work
2. 為何能計算exact 分數
maximizing log pθ(y|x) with respect to model’s parameters θ which, due to the factorized formulation, can be calculated exactly. We do not need negative sampling to approximate the loss normalizer.

ʹpaɪ

3. **What causes the difference between our method and baseline systems as all should benefit from pre-training?**
due to the novel autoregressive way
All other : a dot product between dense vector encodings of the input and the entity label(entity’s meta information)\-\-\- that can miss fine-grained interactions
4. open domain QA 時如何input figure 7

tool(band)為一個樂團
5. 幹嘛不直接給TITLE就好
目的是要找到context中的entity 產生的title是wiki上的title 而不是該文章的title
就算真的要拿該文章的title 以搜尋引擎為例 實際在操作時也不會在知道title的情況下去搜索entity
6. vector dot product為何只能大概
7. 大小差別 傳統儲存為整個DB所有doc的向量 此處只需要存各個entity的tree就好
8. 具體怎麼改成用generation取代(difference between DPR and this (?)此處怎麼拿title來找到
DPR中 要搜尋一個問句 就是會拿query的向量 去跟之前計算過的document的向量去做相似度 然後取top-k
但是costly,dot-product can miss fine-grained,large memory 且 最終output為ID 我們也透過ID找到對應的context(IR中的網站document)
此處是拿query 產生這個query的unique title(取代ID) 然後這些unique title 都有各自對應的文章(類似ID的概念)
9.**細粒度交互**
10.不在wiki上的怎麼辦