How sintel-dev/sigllm works
Project type and purpose
• SigLLM is a Python library (an open-source tool) for detecting anomalies in time series data by orchestrating Large Language Models (LLMs).
• It provides two main pipelines—“detector” (forecast-then-compare) and “prompter” (direct prompt)—built on top of Orion primitives.
File structure
• Top-level:
• sigllm/ ← the runtime package
• sigllm/pipelines/ ← JSON-driven pipeline definitions (detector & prompter)
• sigllm/primitives/ ← reusable components (forecasting, prompting, transformation, postprocessing)
• sigllm/core.py ← the SigLLM class that ties everything together
• sigllm/data.py ← data ingestion & helper routines
• tasks.py ← command-line or build tasks
• tutorial, docs, tests, benchmark folders → usage examples, documentation, CI, and performance scripts
README for technical stack
• Python 3.9–3.11
• Depends on Orion library, Pandas, OpenAI/HuggingFace APIs
• Pipelines configured by JSON files living under sigllm/pipelines and sigllm/primitives/jsons
a. User Application Script
– Imports SigLLM, loads time series (CSV or DataFrame)
b. SigLLM Core (sigllm/core.py)
– Initializes with “pipeline” choice, decimal, hyperparameters
– Loads pipeline definition (JSON) & primitive graph
c. Data Ingestion (sigllm/data.py)
– Reads CSV, validates schema (timestamp + value)
d. Pipeline Engine
– “Detector” pipeline:
• Forecasting primitives → generate forecasted series
• Comparison logic → compute anomalies
– “Prompter” pipeline:
• Prompting primitives → format time series & steer LLM prompt
• LLM call → raw anomaly positions
e. Primitives Subsystem (sigllm/primitives/)
– Forecasting (custom, GPT, HuggingFace)
– Prompting (gpt.py, huggingface.py, anomalies, preprocessing)
– Transformation (format conversions)
– Postprocessing (aggregation, filtering)
– JSON schemas drive edges & parameters
f. External Services
– OpenAI API or HuggingFace endpoint
g. Output
– Pandas DataFrame of anomalies (start, end, severity)
Architectural patterns & design principles
• Pipeline Pattern: sequence of primitive operations configured by JSON
• Plugin/Extension: new primitives or pipelines added simply by dropping JSON + code
• Single-entry orchestrator (SigLLM class) decouples user API from primitive implementations
• Separation of concerns: data, core logic, primitives, configurations
Elements
• Clear component names (e.g., SigLLM Core, Detector Pipeline, Forecasting Primitive)
Capture all layers—from user entry point down to individual primitives—and show how JSON configs drive the pipeline graph. Keep it detailed but avoid unnecessary low-level file listings.