How zgsndzq/superai works
SuperAI is a Python idiom-chain model and chat application: users can train and evaluate a ternary idiom engine, play chain-prediction workflows, or chat through a router that selects idiom, calculation, or general-language experts. The graph includes the documented CLI capabilities and separates router training from interactive inference. Relationships are limited to calls shown in excerpts, source-index references, or README statements; unsampled command internals are not inferred.
Main entry points: app.py Command dispatch · moe.py MoE chat and dispatch · fused_train_cmd.py Router training command · eval_cmd.py Evaluation command
Components 21
CLI and interaction
- Python entry
llm.py - Command dispatch
cli/app.py - Base chat command
cli/chat_cmd.py - Fused chat command
cli/fused_chat_cmd.py - Train command
cli/train_cmd.py - Test command
cli/test_cmd.py - Evaluation command
cli/eval_cmd.py - Router training command
cli/fused_train_cmd.py
Idiom engine
- Idiom vocabulary and pairs
core/data.py - Idiom chain model
core/model.py - Ternary linear layer
core/ternary.py - Chain training and export
core/trainer.py - Chain inference
core/infer.py
Router and experts
- MoE chat and dispatch
core/moe.py - Ternary router
core/ternary.py - Idiom-chain expert
core/moe.py - Calculation expert
core/calc.py - General Qwen expert
core/moe.py
Training and evaluation
- Model evaluation
cli/eval_cmd.py
Other components
- User
- Qwen base model
Connections 29
- User → Python entry: runs commands
README.md - Python entry → Command dispatch: invokes
llm.py - Command dispatch → Base chat command: dispatches
cli/app.py - Command dispatch → Fused chat command: dispatches
cli/app.py - Command dispatch → Train command: dispatches
cli/app.py - Command dispatch → Test command: dispatches
cli/app.py - Command dispatch → Evaluation command: dispatches
cli/app.py - Command dispatch → Router training command: dispatches
cli/app.py - Train command → Chain training and export: starts training
cli/train_cmd.py - Chain training and export → Idiom vocabulary and pairs: loads and builds pairs
core/trainer.py - Chain training and export → Idiom chain model: trains
core/trainer.py - Idiom chain model → Ternary linear layer: uses layers
core/model.py - Test command → Chain inference: supports play workflow
README.md - Chain inference → Idiom chain model: loads checkpoint model
core/infer.py - Evaluation command → Idiom vocabulary and pairs: builds evaluation pairs
cli/eval_cmd.py - Evaluation command → Chain inference: loads and scores models
cli/eval_cmd.py - Evaluation command → Chain training and export: uses compression stats
cli/eval_cmd.py - Router training command → Idiom vocabulary and pairs: builds router samples
cli/fused_train_cmd.py - Router training command → MoE chat and dispatch: constructs MoE
cli/fused_train_cmd.py - Router training command → Qwen base model: encodes samples
cli/fused_train_cmd.py - Router training command → Ternary router: trains router weights
cli/fused_train_cmd.py - Fused chat command → MoE chat and dispatch: loads and chats
cli/fused_chat_cmd.py - MoE chat and dispatch → Qwen base model: encodes and generates
core/moe.py - MoE chat and dispatch → Ternary router: routes hidden state
core/moe.py - MoE chat and dispatch → Idiom-chain expert: dispatches chain requests
core/moe.py - MoE chat and dispatch → Calculation expert: calls calculation helpers
core/moe.py - MoE chat and dispatch → General Qwen expert: falls back to generation
core/moe.py - Idiom-chain expert → Chain inference: predicts valid continuations
core/moe.py - Ternary router → Ternary linear layer: uses ternary layer
core/moe.py