Text Generation
Transformers
GGUF
English
phi
knowledge-system
reasoning
expert-verification
multi-domain
zero-hallucination
spatial-memory
knowledge-tiles
phi-4
microsoft
knowledge-tiles-iath
conversational
Eval Results (legacy)
Instructions to use kofdai/nullai-knowledge-system with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kofdai/nullai-knowledge-system with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kofdai/nullai-knowledge-system") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kofdai/nullai-knowledge-system") model = AutoModelForCausalLM.from_pretrained("kofdai/nullai-knowledge-system", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use kofdai/nullai-knowledge-system 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 kofdai/nullai-knowledge-system:Q4_K_M # Run inference directly in the terminal: llama cli -hf kofdai/nullai-knowledge-system:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf kofdai/nullai-knowledge-system:Q4_K_M # Run inference directly in the terminal: llama cli -hf kofdai/nullai-knowledge-system:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf kofdai/nullai-knowledge-system:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf kofdai/nullai-knowledge-system:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf kofdai/nullai-knowledge-system:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf kofdai/nullai-knowledge-system:Q4_K_M
Use Docker
docker model run hf.co/kofdai/nullai-knowledge-system:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use kofdai/nullai-knowledge-system with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kofdai/nullai-knowledge-system" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kofdai/nullai-knowledge-system", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kofdai/nullai-knowledge-system:Q4_K_M
- SGLang
How to use kofdai/nullai-knowledge-system with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kofdai/nullai-knowledge-system" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kofdai/nullai-knowledge-system", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kofdai/nullai-knowledge-system" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kofdai/nullai-knowledge-system", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use kofdai/nullai-knowledge-system with Ollama:
ollama run hf.co/kofdai/nullai-knowledge-system:Q4_K_M
- Unsloth Studio
How to use kofdai/nullai-knowledge-system with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kofdai/nullai-knowledge-system to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kofdai/nullai-knowledge-system to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for kofdai/nullai-knowledge-system to start chatting
- Docker Model Runner
How to use kofdai/nullai-knowledge-system with Docker Model Runner:
docker model run hf.co/kofdai/nullai-knowledge-system:Q4_K_M
- Lemonade
How to use kofdai/nullai-knowledge-system with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull kofdai/nullai-knowledge-system:Q4_K_M
Run and chat with the model
lemonade run user.nullai-knowledge-system-Q4_K_M
List all available models
lemonade list
- Atomic Chat
| from sqlalchemy import Column, String, DateTime, JSON, Boolean, ForeignKey, Text, Integer, Float | |
| from sqlalchemy.orm import declarative_base, relationship | |
| from datetime import datetime | |
| import uuid | |
| Base = declarative_base() | |
| class User(Base): | |
| """ユーザーモデル - 複数の認証方法をサポート""" | |
| __tablename__ = "users" | |
| id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4())) | |
| email = Column(String, unique=True, nullable=True, index=True) # OAuth時はnullable | |
| username = Column(String, unique=True, nullable=True, index=True) | |
| display_name = Column(String, nullable=True) | |
| hashed_password = Column(String, nullable=True) # OAuth時はnullable | |
| # 認証プロバイダー情報 | |
| auth_provider = Column(String, default="local") # local, google, github, orcid | |
| google_id = Column(String, unique=True, nullable=True, index=True) | |
| github_id = Column(String, unique=True, nullable=True, index=True) | |
| orcid_id = Column(String, unique=True, nullable=True, index=True) | |
| # 権限とステータス | |
| role = Column(String, default="viewer", nullable=False) # viewer, expert, reviewer, curator, admin | |
| is_expert = Column(Boolean, default=False) | |
| is_guest = Column(Boolean, default=False) | |
| expert_verification_status = Column(String, default="none") # none, pending, approved, rejected | |
| expert_credentials = Column(JSON) | |
| # プロフィール情報 | |
| avatar_url = Column(String, nullable=True) | |
| bio = Column(Text, nullable=True) | |
| affiliation = Column(String, nullable=True) | |
| # OAuth tokens (暗号化して保存すべき) | |
| google_access_token = Column(String, nullable=True) | |
| google_refresh_token = Column(String, nullable=True) | |
| github_access_token = Column(String, nullable=True) | |
| orcid_access_token = Column(String, nullable=True) | |
| orcid_refresh_token = Column(String, nullable=True) | |
| # タイムスタンプ | |
| created_at = Column(DateTime, default=datetime.utcnow) | |
| updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) | |
| last_login_at = Column(DateTime, nullable=True) | |
| # リレーションシップ | |
| workspaces = relationship("Workspace", back_populates="owner", cascade="all, delete-orphan") | |
| workspace_members = relationship("WorkspaceMember", back_populates="user", cascade="all, delete-orphan") | |
| proposals = relationship("Proposal", back_populates="proposer", foreign_keys="[Proposal.proposer_id]") | |
| reviews = relationship("Proposal", back_populates="reviewer", foreign_keys="[Proposal.reviewer_id]") | |
| contributions = relationship("KnowledgeTile", back_populates="contributor", foreign_keys="[KnowledgeTile.contributor_id]") | |
| class KnowledgeTile(Base): | |
| """知識タイルモデル""" | |
| __tablename__ = "knowledge_tiles" | |
| id = Column(String, primary_key=True, default=lambda: f"ktile_{uuid.uuid4().hex}") | |
| workspace_id = Column(String, ForeignKey("workspaces.id"), nullable=False, index=True) | |
| domain_id = Column(String, index=True) | |
| topic = Column(String, nullable=False) | |
| content = Column(Text, nullable=False) | |
| tags = Column(JSON, nullable=True) | |
| # 6次元座標 [x, y, z, c, g, v] | |
| # [x, y, z]: ドメイン固有の3次元空間 | |
| # [c, g, v]: メタ空間 (Certainty, Granularity, Verification) | |
| coordinates = Column(JSON, nullable=True) # Example: [0.5, 0.3, 0.8, 0.9, 0.7, 0.85] | |
| # バージョン管理 | |
| version = Column(Integer, default=1) | |
| is_latest_version = Column(Boolean, default=True) | |
| based_on_version = Column(Integer, nullable=True) | |
| # 貢献者と検証 | |
| contributor_id = Column(String, ForeignKey("users.id"), nullable=True) | |
| confidence_score = Column(Float, default=0.0) | |
| verification_type = Column(String, default="none", index=True) # none, community, expert, multi_expert | |
| verification_count = Column(Integer, default=0) | |
| last_verified_by_id = Column(String, ForeignKey("users.id"), nullable=True) | |
| last_verified_at = Column(DateTime) | |
| created_at = Column(DateTime, default=datetime.utcnow) | |
| updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) | |
| workspace = relationship("Workspace") | |
| contributor = relationship("User", back_populates="contributions", foreign_keys=[contributor_id]) | |
| last_verified_by = relationship("User", foreign_keys=[last_verified_by_id]) | |
| proposals = relationship("Proposal", back_populates="tile") | |
| class Proposal(Base): | |
| """編集提案モデル""" | |
| __tablename__ = "proposals" | |
| id = Column(String, primary_key=True, default=lambda: f"prop_{uuid.uuid4().hex}") | |
| workspace_id = Column(String, ForeignKey("workspaces.id"), nullable=False, index=True) | |
| tile_id = Column(String, ForeignKey("knowledge_tiles.id"), nullable=True) # 新規作成時はnull | |
| proposer_id = Column(String, ForeignKey("users.id"), nullable=False) | |
| status = Column(String, default="pending", index=True) # pending, approved, rejected | |
| proposal_type = Column(String, nullable=False) # create, update, delete | |
| justification = Column(Text) | |
| proposed_content = Column(JSON) | |
| reviewer_id = Column(String, ForeignKey("users.id"), nullable=True) | |
| reviewer_comment = Column(Text) | |
| reviewed_at = Column(DateTime) | |
| created_at = Column(DateTime, default=datetime.utcnow) | |
| updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) | |
| workspace = relationship("Workspace") | |
| tile = relationship("KnowledgeTile", back_populates="proposals") | |
| proposer = relationship("User", back_populates="proposals", foreign_keys=[proposer_id]) | |
| reviewer = relationship("User", back_populates="reviews", foreign_keys=[reviewer_id]) | |
| class Workspace(Base): | |
| """ワークスペース - ユーザーごとの独立したDB環境""" | |
| __tablename__ = "workspaces" | |
| id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4())) | |
| name = Column(String, nullable=False) | |
| slug = Column(String, unique=True, nullable=False, index=True) # URLフレンドリーな識別子 | |
| description = Column(Text, nullable=True) | |
| # オーナー情報 | |
| owner_id = Column(String, ForeignKey("users.id"), nullable=False) | |
| # 設定 | |
| is_public = Column(Boolean, default=False) # 公開ワークスペース | |
| allow_guest_edit = Column(Boolean, default=True) # ゲストによる編集を許可 | |
| allow_guest_view = Column(Boolean, default=True) # ゲストによる閲覧を許可 | |
| # データベース設定 | |
| db_type = Column(String, default="sqlite") # sqlite, postgresql | |
| db_path = Column(String, nullable=True) # SQLiteの場合のファイルパス | |
| db_connection_string = Column(String, nullable=True) # PostgreSQLの場合 | |
| # 統計情報 | |
| tile_count = Column(Integer, default=0) | |
| domain_count = Column(Integer, default=0) | |
| member_count = Column(Integer, default=1) | |
| # タイムスタンプ | |
| created_at = Column(DateTime, default=datetime.utcnow) | |
| updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) | |
| # リレーションシップ | |
| owner = relationship("User", back_populates="workspaces") | |
| members = relationship("WorkspaceMember", back_populates="workspace", cascade="all, delete-orphan") | |
| class WorkspaceMember(Base): | |
| """ワークスペースメンバー - 共同作業者の管理""" | |
| __tablename__ = "workspace_members" | |
| id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4())) | |
| workspace_id = Column(String, ForeignKey("workspaces.id"), nullable=False) | |
| user_id = Column(String, ForeignKey("users.id"), nullable=False) | |
| # 権限 | |
| role = Column(String, default="viewer") # viewer, editor, admin | |
| can_read = Column(Boolean, default=True) | |
| can_write = Column(Boolean, default=False) | |
| can_delete = Column(Boolean, default=False) | |
| can_invite = Column(Boolean, default=False) | |
| # タイムスタンプ | |
| joined_at = Column(DateTime, default=datetime.utcnow) | |
| # リレーションシップ | |
| workspace = relationship("Workspace", back_populates="members") | |
| user = relationship("User", back_populates="workspace_members") | |
| class OAuthState(Base): | |
| """OAuth認証の一時的なstate管理""" | |
| __tablename__ = "oauth_states" | |
| id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4())) | |
| state = Column(String, unique=True, nullable=False, index=True) | |
| provider = Column(String, nullable=False) # google, orcid | |
| redirect_url = Column(String, nullable=True) | |
| user_id = Column(String, ForeignKey("users.id"), nullable=True) # 既存ユーザーとの連携時 | |
| created_at = Column(DateTime, default=datetime.utcnow) | |
| expires_at = Column(DateTime, nullable=False) # 10分で期限切れ | |
| def is_expired(self): | |
| return datetime.utcnow() > self.expires_at | |