自然语言处理基础 | 7 信息获取
9 Information Retrieval
Information Retreival (IR): to retrieve all types of data based on users’ information needs.
- 用户 query
- IR 系统, 数据集 (核心是计算 candidate 与 query 的相关程度)
- 输出结果
A brief timeline of IR:
IR 的应用: 搜索引擎 (query => web page)、推荐系统 (user => goods)、广告投放 (user => ads)、情报分析 (claim => clues)……
9.1 The task
给定词汇表 \(V=\{w_i\}_{i=1}^N\) 和文档集 \(D=\{d_i\}_{i=1}^K\), 对于一个用户的 query \(q=(w_{q_1},\dots,w_{q_m})\), 我们需要找到文档集 \(D\) 中与 \(q\) 相关的文档全体 \(R(d)\).
一般分为两步:
- Retrieval: 获取所有可能与 \(q\) 相关的文档 \(d\) (召回尽可能多的候选, high recall).
- (Re)ranking: 按照相关度对文档排序 (high precision).
关键是计算相关度,
- How to model the relevance computation
- How to represent query q and doc d
9.2 Models
9.2.1 Boolean model
将 query 中的单词 \(w\) 用布尔运算 (如 AND, OR, NOT) 连接起来.
- 慢, 并且难以处理 NOT (需要遍历整个文档)
- 可以建立索引
- 不好进行相关度排序
- 不便于构建 query
9.2.2 Vector space model
计算 query 中词汇在某篇文档中的 TF-IDF.
9.2.3 Probabilistic model
9.2.4 Neural model
10 Prompting
https://www.promptingguide.ai/
- 清晰的任务指令: clear task descriptions, necessary background, output format, constraints, etc.
- 小心筛选的信息: especially those LLMs may not know, e.g., up-to-date information, news, domain knowledge, ...
- 小心设计的例子: clear examples to let model follow
- 困难的任务需要更多指导: instruct or illustruct how to deal with complex tasks
- 角色扮演: often provide more target replies, e.g., ”You are a cardiologist, ... ”
自然语言处理基础 | 7 信息获取
https://disembo.github.io/Note/Course/fnlp/7/