AI代理开发工程师 Interview Questions
Interview Questions (10)
Sample Answer
Prefix LM uses the entire context of the input sequence, while Causal LM generates predictions based only on previous tokens. This means Prefix LMs are better for tasks needing full context understanding, whereas Causal LMs excel in sequential generation.
In practice, Prefix LMs can handle tasks like text summarization, while Causal LMs are ideal for dialogue systems where each response relies on prior dialogue.
Sample Answer
大模型大部分采用Decoder-only结构,因为它们在生成任务中表现更佳,能够有效捕捉上下文信息。相比于Encoder-Decoder结构,Decoder-only模型简化了设计,减少了计算复杂度。
此外,自回归生成使得模型在生成文本时更具灵活性,适合处理多样化的输入。
Sample Answer
Attention is a mechanism that allows models to focus on specific parts of the input sequence, enhancing contextual understanding. It enables better handling of long-range dependencies by weighting the importance of different tokens.
For instance, in NLP tasks, it helps the model prioritize relevant words, improving accuracy in tasks like translation or summarization.
Sample Answer
注意力机制允许模型在生成每个输出时,动态地关注输入序列的不同部分,而传统的 Seq2Seq 模型则依赖于固定的上下文向量。这种灵活性使得注意力机制在处理长序列时更有效。
具体来说,注意力机制能处理 信息丢失,并提高翻译质量,尤其是在复杂句子中。
Sample Answer
在 Transformer 的 multi-head attention 中,每个 head 降维是为了 提高模型的表达能力。通过将输入特征分成多个子空间,模型可以捕捉到不同的 注意力模式,从而更好地理解上下文。
此外,降维有助于 减少计算复杂度,使得并行处理成为可能,提升了训练和推理的效率。
Sample Answer
Encoder transforms input data into a compact representation, while Decoder reconstructs output from that representation. The encoder captures essential features, and the decoder ensures the output is coherent and relevant.
In models like Transformers, the encoder processes the entire input simultaneously, while the decoder uses masked attention to prevent future information leakage during generation.
Sample Answer
BERT选择mask掉15%的词是为了保持平衡,确保模型既能学习上下文关系,又不会过度依赖被mask的词。这个比例经过实验验证,能有效提升模型的泛化能力。
如果选择其他比例,可能会导致模型训练不稳定,影响性能。
Sample Answer
BERT 的非线性来源主要在于其使用的 自注意力机制。这种机制允许模型在处理输入时,动态地关注不同部分,从而捕捉到更复杂的 上下文关系。
此外,BERT 采用的 双向编码 也使得模型能够同时考虑上下文信息,提升了对语言的理解能力。
Sample Answer
进行LayerNorm的主要原因是提高模型的稳定性和收敛速度。通过标准化每个样本的特征,使得每层的输入分布更一致,从而减少了内部协变量偏移。
此外,LayerNorm在处理小批量数据时表现更好,尤其是在序列模型中,能够有效提升模型的性能。
Sample Answer
有监督微调(SFT)的数据集格式通常是JSON或CSV,包含输入和目标输出的配对。每个样本应包括文本输入和标签,以便模型学习。
例如,输入可以是用户的查询,标签则是期望的响应。这种格式确保了数据的一致性和可读性,便于训练和评估模型。