Hacker News 中文摘要

RSS订阅

灵魂演奏者C64——在1MHz的Commodore 64上运行的真正变形者 -- Soul Player C64 – A real transformer running on a 1 MHz Commodore 64

文章摘要

开源项目Soul Player C64在1MHz主频的Commodore 64电脑上实现了25K参数的Transformer模型,采用手写6502汇编编写,具备真实的多头自注意力机制,每生成一个token约需60秒,整个程序可存放在一张软盘中。

文章总结

C64灵魂播放器:在1MHz古董电脑上运行的25K参数Transformer模型

项目亮点

  • 硬件奇迹:在未改装的1MHz主频Commodore 64电脑上运行真正的Transformer架构(2层解码器/4注意力头/25K参数)
  • 技术突破:通过14位移位修正softmax归一化,使128项exp查找表能生成有效注意力权重
  • 复古存储:完整系统可存入一张5.25英寸软盘(D64镜像仅25KB)

核心架构

| 参数项 | 规格说明 | |--------------|----------------------------| | 词表 | 128token(含4特殊字符) | | 嵌入维度 | 32维 | | 注意力机制 | 4头×8维/头 | | 前馈网络 | 64隐藏单元 | | 上下文窗口 | 20token | | 推理速度 | 约60秒/Token(实机运行) |

快速体验

  1. 下载预构建镜像soulplayer.d64
  2. 使用VICE模拟器运行: basic LOAD"SOULPLAYER",8,1 RUN
  3. 输入小写英文短句(支持标点符号),等待生成响应(边框闪烁表示运行中)

自定义训练

  • 语料准备:按<SEP>输入<SEP>响应<SEP>格式创建对话数据集(参考example_corpus.txt
  • 模型训练:执行python train.py自动完成:
    • BPE分词器训练(128token)
    • QAT量化感知训练(int8量化)
    • 生成25KB模型文件soul.bin
  • 编译部署:通过build.py生成可运行镜像

技术细节

  • 内存布局
    • $0801-$20FF:代码区(6KB)
    • $2100-$85A0:模型权重(25.3KB)
    • $8600-$9D00:激活缓冲区(5.8KB)
  • 量化方案
    • 权重:int8+张量级移位缩放
    • 激活值:Q8.8定点数(int16)
    • 使用查表法实现softmax

特别说明

  • 该模型仅为技术验证(参数规模仅为GPT-4的1/7000万)
  • 实际输出可能存在语法错误
  • 需使用小写输入(大写字母会被识别为UNK)

"未来回溯了过去,现在它拥有了灵魂。" —— 项目作者gizmo64k向1982年问世的Commodore 64致敬

(项目采用GPLv3协议开源,完整技术文档见GitHub仓库)

评论总结

评论总结:

  1. 对AI模型规模的质疑
  • 认为25K参数模型只能生成不完整句子,质疑其实际效果 "it will produce broken sentences...I'm not sure if it does work at this scale" (评论3) "mostly only says hello and bye, but I guess for 25k parameters you can't complain" (评论9)
  1. 怀旧情怀与硬件讨论
  • 唤起对Commodore 64/Vic-20的回忆 "Brings back memories" (评论11) "reminded me of the random sentence generator program on my Vic-20" (评论10)
  • 讨论硬件扩展可能性 "wonder how far you could push this while still staying period correct" (评论7) "Ok now we need 1541 flash attention" (评论4)
  1. 技术潜力思考
  • 认为在复古硬件上实现LLM可能带来新的技术视角 "it would suggest we may have left a lot of progress on the table" (评论12)
  • 对早期AI(如ELIZA)的比较 "How does this compare to ELIZA?" (评论8)
  1. 幽默与调侃
  • 对AI的戏谑态度 "i hate ai, and i love the c64, but i'll allow it" (评论2)
  • 对项目完整性的吐槽 "Dissapointed - there was no 6502 code in the GitHub repo" (评论13)