Instructions to use lijie1228/a-random-number-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use lijie1228/a-random-number-model with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf lijie1228/a-random-number-model:Q4_K_M # Run inference directly in the terminal: llama cli -hf lijie1228/a-random-number-model:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf lijie1228/a-random-number-model:Q4_K_M # Run inference directly in the terminal: llama cli -hf lijie1228/a-random-number-model:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf lijie1228/a-random-number-model:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf lijie1228/a-random-number-model:Q4_K_M
Use Docker
docker model run hf.co/lijie1228/a-random-number-model:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use lijie1228/a-random-number-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lijie1228/a-random-number-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lijie1228/a-random-number-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lijie1228/a-random-number-model:Q4_K_M
- Ollama
How to use lijie1228/a-random-number-model with Ollama:
ollama run hf.co/lijie1228/a-random-number-model:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use lijie1228/a-random-number-model with Docker Model Runner:
docker model run hf.co/lijie1228/a-random-number-model:Q4_K_M
- Lemonade
How to use lijie1228/a-random-number-model with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull lijie1228/a-random-number-model:Q4_K_M
Run and chat with the model
lemonade run user.a-random-number-model-Q4_K_M
List all available models
lemonade list
- Atomic Chat
🎲 random-number-gguf
只会随机吐一个数字的 GGUF 模型。 无论输入什么、上下文多长、怎么注入指令,它都只输出指定范围内的均匀随机数字,然后停止。
零训练:1 层 llama(该层全 0),权重手写;无数据集、无反向传播。全模型约 59 万参数,最小档仅 249 KB。
| 版本 | 取值 | 参数 | F16 | Q2_K |
|---|---|---|---|---|
random-binary |
0/1 | 591,616 | 1.16 MB | 249 KB |
random-digit |
0~9 | 591,616 | 1.16 MB | 249 KB |
random-num100 |
0~100 | 638,208 | 1.23 MB | 277 KB |
每版 6 档量化:F16 / Q8_0 / Q4_K_M(推荐)/ Q4_K_S / Q3_K_M / Q2_K。根目录 random-binary.gguf / random-digit.gguf / random-num100.gguf 为一键版,等于 Q2_K。
原理
- 层是空的:attention、FFN 权重全 0,残差使每层输出等于输入。
- 输入被抹平:embedding 只有“数字 token”和“所有非数字 token”两种状态;隐藏状态只取决于“上一个 token 是不是数字”。
- 两个状态:状态 A 下 N 个数字 logit 完全相等,softmax 均匀,采样器随机选一个;刚输出数字后进入状态 B,只有 EOS 为正 logit,立即停止。
“随机”来自均匀 softmax + 采样器随机性,不是学出来的。范围由结构钉死:只有 N 个数字 token 能拿正 logit,其余 token(含 EOS)在第一个位置都是 -1597.96,不会越界。推导见 docs/how-it-works.md。
快速开始
Ollama
ollama create random-digit -f Modelfiles/Modelfile.digit
ollama run random-digit "随便说点什么" # → 7
ollama run random-num100 "今天天气怎么样" # → 42
Modelfile:Modelfile.binary / Modelfile.digit / Modelfile.num100。换量化档改 FROM 行文件名。
LM Studio / 其它前端
拖入 .gguf 后必须改采样参数:
| 参数 | 必须值 | 原因 |
|---|---|---|
top_p |
1.0 | 小于 1 会砍尾部,某些数字永远抽不到 |
top_k |
≥ 取值个数(2/10/101) | 默认 40 会让 0~100 只剩约 36 个值可能中 |
temperature |
1.0 | 保持 N 个选项等高 |
repeat_penalty |
1.0 | 避免压低刚输出的数 |
presence/frequency_penalty |
0 | 同上 |
llama.cpp
# 对话模式(推荐)
llama-cli -m gguf/random-digit-Q4_K_M.gguf -p "你好" -n 4 \
--temp 1.0 --top-p 1.0 --top-k 10 -st
# 纯补全模式:必须加 -no-cnv
llama-completion -m gguf/random-num100-Q2_K.gguf -p "任意" -n 1 \
--temp 1.0 --top-p 1.0 --top-k 101 -no-cnv -st
实测 random-num100-Q2_K:4 线程纯 CPU、ctx 8192,峰值内存 30.9 MB,约 240 tok/s。
注意:llama.cpp b11588 的 llama-completion 不加 -no-cnv 可能崩溃;llama-cli -st 不受影响。
三个坑
top_p必须 1.0:N 个选项等概率时,top_p<1必然砍掉尾部。实测 Ollama 默认top_p=0.9, top_k=40下,random-digit300 次里0一次没出现;random-num100默认只露出约 37 个取值。改top_p=1.0、top_k≥N后通过均匀性检验。- 空 prompt 无输出:Ollama 对
prompt=""返回空字符串,与模型无关。给空格或任意字符即可。 - 纯补全模式输入以数字结尾会直接停:模型靠“上一个 token 是数字”触发停止。绕过 chat 模板喂
"5"会输出空;补空格或换说法。对话模式不受影响,因为 GGUF chat template 是{{ bos_token }},正文在模板层被丢弃。
验证
- 18/18 个 GGUF 文件通过:全部产出合法取值、长度恒为 1、χ² 检验 p ≥ 0.01。
- 3 个版本共 900 次默认采样参数测试:越界 0 次,空输出 0 次。默认参数下能抽到的取值数会被
top_p/top_k砍掉一部分,但不可能抽到范围外。 random-digit对中文、英文、emoji、300 字重复、指令注入、以数字结尾、纯空白等 9 类输入各 400 次:合计 3200/3200 合法单数字,分布通过;唯一已知限制是 Ollama 空 prompt 返回空。
文件与生成
量化文件:
gguf/random-{binary,digit,num100}-{F16,Q8_0,Q4_K_M,Q4_K_S,Q3_K_M,Q2_K}.gguf
根目录一键版为对应 Q2_K。完整 SHA-256 见仓库文件清单。
生成器只依赖 numpy:
python tools/make_random_gguf.py out.gguf --family 09 # 0~9
python tools/make_random_gguf.py out.gguf --family 01 # 0/1
python tools/make_random_gguf.py out.gguf --family 0100 # 0~100
python tools/make_random_gguf.py dice.gguf --numbers "1,2,3,4,5,6"
python tools/make_random_gguf.py --inspect out.gguf
生成时自动自测:数字 token logit 是否严格相等、EOS 是否为第二状态 argmax、非数字 token 是否落入同一状态。
许可
MIT。随便玩。
- Downloads last month
- 425