spark 从 DataFrame 中读取 Array 类型的列
- 代码示例
1
2
3
4dataFrame.rdd.map(row => {
val vectorCol = row.getAs[Seq[Double]]("VectorCol")
vectorCol.toArray
}).collect().foreach(println)
凡事预则立,不预则废
整体讨论
《Muon is Scalable for LLM Training》 Paper Summary

Muon 优化器 Muon(2024)是一种针对矩阵参数优化的神经网络优化器
在迭代步 \( t \) 时,给定当前权重 \(\mathbf{W}_{t-1}\)、动量 \(\mu\)、学习率 \(\eta_t\) 和目标函数 \(\mathcal{L}_t\),Muon 的更新规则如下:
$$
\begin{split}
\mathbf{M}_t &= \mu\mathbf{M}_{t-1} + \nabla\mathcal{L}_t(\mathbf{W}_{t-1}) \\
\mathbf{O}_t &= \text{Newton-Schulz}(\mathbf{M}_t)^{\mathrm{i} } \\
\mathbf{W}_t &= \mathbf{W}_{t-1} - \eta_t\mathbf{O}_t
\end{split} \tag{1}
$$
Newton-Schulz 迭代的矩阵正交化(Newton-Schulz Iterations for Matrix Orthogonalization) :公式1通过迭代过程计算
M.norm(),定义如下:1 | # Pytorch code |
范数约束下的最速下降法(Steepest Descent Under Norm Constraints)

d_model x vocab_size维度大小)吧?Based on Megatron-LM’s sophisticated parallel strategies, e.g. Tensor-Parallel (TP), Pipeline Parallel (PP), Expert Parallel (EP) and Data Parallel (DP), the communication workload of ZeRO-1 can be reduced from gathering all over the distributed world to only gathering over the data parallel group.











smoothing_function 传入一些平滑策略来解决问题1 | from nltk.translate.bleu_score import sentence_bleu # 评估句子 |
* BLEU 倾向于精确率,对于短的(已经有惩罚了)、精确匹配的句子可能给出高分,但可能忽略了语义的完整性或流畅性
* 更多的参考翻译通常会提高 BLEU 分数
* BLEU 在单句评估上指标不太稳定(修改单个单词可能出现非常大的变化),更适合评估整个语料库的平均表现
rouge-score 库)rouge-score 是一个常用的 Python 库,用于计算 ROUGE 分数 1 | from rouge_score import rouge_scorer |
method0(): 无平滑 (No smoothing)method1(): 添加epsilon计数 (Add epsilon counts)method2(): 添加1到分子和分母 (Add 1 to both numerator and denominator)method3(): NIST 几何序列平滑 (NIST geometric sequence smoothing)前言:RWKV 作为挑战 Transformer 架构的国人开源项目,有前景,本文先简单介绍,有时间回来详细补课
注:本文包含 AI 辅助创作
Paper Summary




<search> search query </search>




简单介绍
前置讨论
注:本文包含 AI 辅助创作
Paper Summary

temperature=0.6 和 top-\(p\) 值 0.95,允许最大生成 16,384 个 Token




















注:本文包含 AI 辅助创作
Paper Summary
For general tasks, we employ a generative reward model where each prompt has its own rubrics for evaluation
<think></think> 来标记推理路径
为了在 RL 中扩大智能体环境和任务规模,作者用了一个自动环境合成智能体,它合成了 1827 个面向任务的环境
具体来说,工作流程如下
遵循此工作流程,获得了数千个 <环境, 工具, 任务, 验证器>(<environment, tools, task, verifier>) 元组
<environment, tools, task, verifier> 是匹配对齐的,在这个环境 envirnoment 下,用这些工具 tools 能解决的任务 task 和 可以验证该 任务是否成功的验证器 verifier然后使用 DeepSeek-V3.2 在该数据集上执行 RL,并仅保留 pass@100 非 0 的实例,最终得到 1827 个环境及其相应的任务(共 4417 个)
下面展示了一个合成的行程规划示例
示例说明:此示例强调,虽然为满足所有约束的行程计划搜索大型组合空间具有挑战性,但检查给定的候选 Solution 是否满足这些约束则相对简单
1 | **合成任务示例:行程规划(An Example of Synthesized Task: Trip Planning)** |
行程规划工具集(Tool Set for Trip Planning)
| 函数名称 | 描述 |
|---|---|
get_all_attractions_by_city(city) |
获取给定城市的所有景点 |
get_all_cities() |
从数据库获取所有城市 |
get_all_hotels_by_city(city) |
获取给定城市的所有酒店 |
get_all_restaurants_by_city(city) |
获取给定城市的所有餐厅 |
get_city_by_attraction(attraction) |
获取给定景点名称的城市 |
get_city_by_hotel(hotel) |
获取给定酒店名称的城市 |
get_city_by_restaurant(restaurant) |
获取给定餐厅名称的城市 |
get_city_transport(city) |
获取给定城市的所有市内交通选项 |
get_infos_by_attraction(info_keywords, attraction) |
获取给定景点的指定信息 |
get_infos_by_city(info_keywords, city) |
获取给定城市的指定信息 |
get_infos_by_hotel(info_keywords, hotel) |
获取给定酒店的指定信息 |
get_infos_by_restaurant(info_keywords, restaurant) |
获取给定餐厅的指定信息 |
get_inter_city_transport(from_city, to_city) |
获取给定城市对之间的所有交通方式 |
get_weather_by_city_date(city, date) |
获取给定城市-日期对的天气 |
submit_result(answer_text) |
提交最终答案内容 |
"{question}\n Please reason step by step, and put your final answer within \boxed{}"





<think></think> 标签中输出推理过程 
[工具描述] 和 [工具调用格式] 将被替换为具体的工具和论文设计的工具调用格式 
