Skip to content

subconscious-systems/subconscious

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TIMRUN: Efficient Engine for Long-horizon Reasoning

Subconscious Systems

Paper Hugging Face

Enabling efficient multi-hop reasoning and tool use for extended problem-solving

πŸš€ Overview

TIMRUN (TIM Runtime) is a high-performance inference engine that orchestrates the TIM (Thread Inference Model) for unprecedented long-horizon reasoning capabilities. TIMRUN manages the entire inference pipeline, using TIM to predict next tokens while performing intelligent structure checks to extract tool calls and identify prunable subtasks. This enables efficient end-to-end multi-hop tool use and makes complex problem-solving tasks more scalable.

Key Features

  • πŸ”— Multi-hop Reasoning: Chain complex reasoning steps across extended contexts
  • πŸ› οΈ End-to-End Tool Integration: Seamlessly incorporate external tools and APIs
  • 🎯 Long-horizon Planning: Handle tasks requiring extended planning and execution
  • 🧠 Generative Orchestration: Intelligent context engineering learned by the TIM model and handled by TIMRUN with efficient KV cache pruning

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Input Query   │───▢│              TIMRUN Engine              β”‚
β”‚                 β”‚    β”‚                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                    β”‚
                       β”‚  β”‚ Structure Check β”‚                    β”‚
                       β”‚  β”‚                 β”‚                    β”‚
                       β”‚  β”‚ β€’ Tool Calls    β”‚                    β”‚
                       β”‚  β”‚ β€’ Prunable      β”‚                    β”‚
                       β”‚  β”‚   Subtasks      β”‚                    β”‚
                       β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                    β”‚
                       β”‚           β”‚                             β”‚
                       β”‚           β–Ό                             β”‚
                       β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                    β”‚
                       β”‚  β”‚   TIM Model     β”‚                    β”‚
                       β”‚  β”‚                 β”‚                    β”‚
                       β”‚  β”‚  β€’ Sparse Attn  β”‚ ─────────────      β”‚
                       β”‚  β”‚  β€’ Multi-hop    β”‚             β”‚      β”‚
                       β”‚  β”‚  β€’ Token Pred   β”‚             β”‚      β”‚
                       β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚      β”‚
                       β”‚           β”‚                      β”‚      β”‚
                       β”‚           β–Ό                      β–Ό      β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚   Tool Usage    │◀───┼──│  Tool Execution β”‚    β”‚ KV Cache    β”‚ β”‚
β”‚                 β”‚    β”‚  β”‚                 β”‚    β”‚ Pruning     β”‚ β”‚
β”‚  β€’ External APIsβ”‚    β”‚  β”‚ β€’ Call Tools    β”‚    β”‚             β”‚ β”‚
β”‚  β€’ Tool Calls   β”‚    β”‚  β”‚ β€’ Encode        β”‚    β”‚ β€’ Memory    β”‚ β”‚
β”‚  β€’ Data Sources β”‚    β”‚  β”‚   Response      β”‚    β”‚   Mgmt      β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                       β”‚           β”‚                      β”‚      β”‚
                       β”‚           β–Ό                      β–Ό      β”‚
                       β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
                       β”‚  β”‚         Continue Decoding           β”‚β”‚
                       β”‚  β”‚      (with updated context)         β”‚β”‚
                       β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                                        β–Ό
                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚   Final Result  β”‚
                               β”‚                 β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Subconscous Python SDK

Install the package using pip:

pip install subconscious-python

Note: The package name is subconscious-python but you import it as subconscious:

import subconscious  # Import name remains clean and simple

Run your first agent:

from subconscious import Client

# Initialize the client
client = Client(
    base_url="https://api.subconscious.dev/v1", # can be omitted
    api_key="your-api-key" # get it from https://subconscious.dev
)

# Define tools
tools = [
    {
        "type": "function",
        "name": "calculator",
        "url": "https://URL_TO_CALCULATOR_TOOL/ENDPOINT", # the server url of your own tool
        "method": "POST",
        "timeout": 5, # seconds
        "parameters": {
            "type": "object",
            "properties": {
                "operation": {"type": "string"},
                "a": {"type": "number"},
                "b": {"type": "number"}
            },
            "required": ["operation", "a", "b"]
        }
    }
]

# Build toolkit
client.build_toolkit(tools, agent_name="math_agent")

# Run agent
messages = [{"role": "user", "content": "What is 2 + 3?"}]
response = client.agent.run(messages, agent_name="math_agent")
print(response)

The TIM language model will call the calculator tool as many times as necessary, handle excepts, compute the answer, and return the result. The agent is completed with one language model API call!

We also provide fine-grained control over the reasoning structure, tool use, and memory management. Check out the deep research agent example for more advanced usage.

OpenAI Compatible API

Note: The OpenAI compatible API does not support fine-grained reasoning structure control. For advanced performance tuning, please use the Subconscious Python SDK.

client = OpenAI(
    base_url = "https://api.subconscious.dev/v1",
    api_key = # get API KEY from https://subconscious.dev
)

Reasoning with Multi-hop Search Tool Calls

resp = client.chat.completions.create(
    model = "tim-large",
    messages = [
        {
            'role': 'user',
            'content': 'find 10 most influencial research papers in dog walking.'
        }
    ],
    top_p = 0.95,
    max_completion_tokens = 10000,
    temperature = 0.6,
    tools = [
        {
            "type": "function",
            "name": "SearchTool",
            "description": "a general search engine returns title, url, and desciription of 10 webpages",
            "url": URL_TO_TOOL, # the server url of your own tool
            "method": "POST",
            "timeout": 10,
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {
                        "type": "string",
                        "description": "A natural language query for the search engine."
                    }
                },
                "required": [
                    "query"
                ],
                "additionalProperties": False
            }
        }
    ]
    stream = False # if true, same as OpenAI's streaming
)
print(json.loads(resp.choices[0].message.content)['answer'])

πŸ€– Showcase agents built with TIM

πŸ› οΈ Available Tools

coming soon

πŸ“Š Performance

Optimization Features

  • Selective Working Memory: 50% reduction in memory usage for long sequences
  • Tool Caching: 30% faster repeated tool calls
  • Batched Processing: Multi-threaded tool execution when possible
  • Memory Management: Efficient handling of large reasoning chains

πŸ“š Documentation

πŸ”¬ Research & Papers

If you use found our work helpful in your research, please cite:

@article{tim-timrun,
  title={Beyond Context Limits: Subconscious Threads for Long-Horizon Reasoning},
  author={Hongyin Luo, Nathaniel Morgan, Tina Li, Derek Zhao, Ai Vy Ngo, Philip Schroeder, Lijie Yang, Assaf Ben-Kish, Jack O'Brien, James Glass},
  journal={arXiv preprint arXiv:2507.16784},
  year={2024}
}

πŸ“„ License

This TIM-8b-preview model is licensed under the MIT License.

πŸ“ž Support


Ready to unlock the power of long-horizon reasoning? Get started with TIMRUN today!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published