Show HN: Cactus – 스마트폰용 Ollama
요약
Cactus는 모바일 및 웨어러블 장치에 최적화된 저지연 (low-latency) 인공지능 추론 엔진입니다. ARM CPU에서 가장 빠른 추론 속도를 자랑하며, 제로 카피 메모리 매핑을 통해 기존 대비 10배 낮은 RAM 사용량을 구현했습니다. 단일 SDK를 통해 음성(Speech), 비전(Vision), 언어 모델(Language) 등 멀티모달 기능을 지원하며, NPU 가속화 프리필(prefill) 기능과 클라우드 폴백(Cloud fallback)을 자동 처리하여 안정적인 AI 경험을 제공합니다. C++ API와 Python/Sw
핵심 포인트
- ARM CPU에서 가장 빠른 추론 속도를 구현했으며, 제로 카피 메모리 매핑으로 RAM 사용량을 10배 절감했습니다.
- 단일 SDK를 통해 음성 인식(STT), 비전, 언어 모델을 아우르는 멀티모달 기능을 지원합니다.
- NPU 가속화 프리필과 OpenAI 호환 API를 제공하며, 클라우드 연결이 필요할 경우 자동으로 요청을 라우팅하는 하이브리드 구조입니다.
- C++ Graph API와 Python SDK 등 다양한 레퍼런스 API 및 다중 언어 SDK(Swift, Kotlin, Dart, Rust)를 지원하여 광범위한 플랫폼 호환성을 제공합니다.
모바일 기기 및 웨어러블을 위한 저지연 AI 엔진.
주요 기능:
- 빠름(Fast): ARM CPU에서 가장 빠른 추론 속도 제공
- 낮은 RAM(Low RAM): 제로 카피 메모리 매핑(zero-copy memory mapping)을 통해 다른 엔진보다 10배 낮은 RAM 사용량 보장
- 멀티모달(Multimodal): 음성, 비전, 언어 모델용 단일 SDK 제공
- 클라우드 폴백(Cloud fallback): 필요시 요청을 자동으로 클라우드 모델로 라우팅
- 에너지 효율적(Energy-efficient): NPU 가속 사전 채우기(NPU-accelerated prefill)
Cactus Engine
- ←── 모든 주요 언어를 지원하는 OpenAI 호환 API 제공
Chat, vision, STT, RAG, tool call, 클라우드 핸드오프(cloud handoff)
Cactus Graph
- ←── 제로 카피 컴퓨테이션 그래프 (PyTorch for mobile)
커스텀 모델을 RAM 및 양자화(quantisation)에 최적화
Cactus Kernels
- ←── ARM SIMD 커널 (Apple, Snapdragon, Exynos 등)
커스텀 어텐션(attention), KV-캐시 양자화(KV-cache quant), 청크 기반 사전 채우기(chunked prefill)
사용 예시
1. 설치 및 기본 실행
# 1단계:
brew install cactus-compute/cactus/cactus
# 2단계:
cactus transcribe
orcactus run
2. C++ API 예시 (Chat Completion)
#include "cactus.h"
cactus_model_t model = cactus_init(
"path/to/weight/folder",
"path to txt or dir of txts for auto-rag",
false
);
const char* messages = R"([
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "My name is Henry Ndubuaku"}
])";
const char* options = R"({
"max_tokens": 50,
"stop_sequences": ["<|im_end|>"]
})";
char response[4096];
int result = cactus_complete(
model, // model handle
messages, // JSON chat messages
response, // response buffer
sizeof(response), // buffer size
options, // generation options
nullptr, // tools JSON
nullptr, // streaming callback
nullptr, // user data
nullptr, // pcm audio buffer
0 // pcm buffer size
);
Gemma3-270m의 예시 응답
{
"success": true, // 생성 성공
"error": null, // 실패 시 오류 상세 정보
"cloud_handoff": false, // 클라우드 모델 사용 여부 (true일 경우)
"response": "Hi there!",
"function_calls": [], // 파싱된 도구 호출
"confidence": 0.8193, // 모델 신뢰도
"time_to_first_token_ms": 45.23,
"total_time_ms": 163.67,
"prefill_tps": 1621.89,
"decode_tps": 168.42,
"ram_usage_mb": 245.67,
"prefill_tokens": 28,
"decode_tokens": 50,
"total_tokens": 78
}
3. C++ API 예시 (Graph Computation)
#include "cactus.h"
CactusGraph graph;
auto a = graph.input({2, 3}, Precision::FP16);
auto b = graph.input({3, 4}, Precision::INT8);
auto x1 = graph.matmul(a, b, false);
auto x2 = graph.transpose(x1);
auto result = graph.matmul(b, x2, true);
float a_data[6] = {1.1f, 2.3f, 3.4f, 4.2f, 5.7f, 6.8f};
float b_data
AI 자동 생성 콘텐츠
본 콘텐츠는 HN AI Engineering의 원문을 AI가 자동으로 요약·번역·분석한 것입니다. 원 저작권은 원저작자에게 있으며, 정확한 내용은 반드시 원문을 확인해 주세요.
원문 바로가기