LORS
1.0.0
LOR (Local O1 추론 시스템)은 LLMS (Local Large Language Models)를 사용하여 신속한 분석 및 응답 생성을위한 새로운 접근법을 구현하는 고급 분산 추론 프레임 워크입니다. OpenAI의 O1 아키텍처에서 영감을 얻은 LORS는 다양한 계산 깊이의 병렬 처리 파이프 라인을 통해 복잡한 쿼리를 처리하기 위해 동적 스케일링 기능을 갖춘 다중 에이전트 시스템을 사용합니다.
LORS Architecture
├── Prompt Analysis Engine
│ ├── Complexity Analyzer
│ ├── Domain Classifier
│ └── Cognitive Load Estimator
├── Agent Management System
│ ├── Fast Reasoning Agents (llama3.2)
│ └── Deep Reasoning Agents (llama3.1)
├── Response Synthesis Pipeline
│ ├── Thought Aggregator
│ ├── Context Enhancer
│ └── Final Synthesizer
└── Response Management System
├── Intelligent Naming
└── Structured Storage
이 시스템은 다음을 평가하는 정교한 신속한 분석 메커니즘을 사용합니다.
언어 복잡성 지표
도메인 별 분석
domain_complexity = {
'technical' : [ algorithm , system , framework ],
'scientific' : [ hypothesis , analysis , theory ],
'mathematical' : [ equation , formula , calculation ],
'business' : [ strategy , market , optimization ]
}
복잡성 스코어링 알고리즘
C = Σ(wi * fi)
where:
C = total complexity score
wi = weight of feature i
fi = normalized value of feature i
시스템은 신속한 복잡성을 기반으로 적응 형 스케일링 메커니즘을 구현합니다.
복잡성 점수 | 빠른 에이전트 | 깊은 요원 | 유스 케이스 |
---|---|---|---|
80-100 | 5 | 3 | 복잡한 기술 분석 |
60-79 | 4 | 2 | 적당한 복잡성 |
40-59 | 3 | 2 | 표준 분석 |
0-39 | 2 | 1 | 간단한 쿼리 |
빠른 추론 에이전트 (llama3.2)
{
'temperature' : 0.7 ,
'max_tokens' : 150 ,
'response_time_target' : '< 2s'
}
깊은 추론 에이전트 (llama3.1)
{
'temperature' : 0.9 ,
'max_tokens' : 500 ,
'response_time_target' : '< 5s'
}
async def process_prompt ( prompt ):
complexity_analysis = analyze_prompt_complexity ( prompt )
fast_thoughts = await process_fast_agents ( prompt )
enhanced_context = synthesize_initial_thoughts ( fast_thoughts )
deep_thoughts = await process_deep_agents ( enhanced_context )
return synthesize_final_response ( fast_thoughts , deep_thoughts )
이 시스템은 가중 기능 분석 방식을 사용합니다.
def calculate_complexity_score ( features ):
weights = {
'sentence_count' : 0.1 ,
'avg_sentence_length' : 0.15 ,
'subjectivity' : 0.1 ,
'named_entities' : 0.15 ,
'technical_term_count' : 0.2 ,
'domain_complexity' : 0.1 ,
'cognitive_complexity' : 0.1 ,
'dependency_depth' : 0.1
}
return weighted_sum ( features , weights )
이 시스템은 3 상 합성 접근법을 구현합니다.
pip install ollama asyncio rich textblob spacy nltk
python -m spacy download en_core_web_sm
python local-o1-reasoning.py -p " Your complex query here "
응답은 JSON 형식으로 저장됩니다.
{
"prompt" : " original_prompt " ,
"timestamp" : " ISO-8601 timestamp " ,
"complexity_analysis" : {
"score" : 75.5 ,
"features" : { ... }
},
"result" : {
"fast_analysis" : [ ... ],
"deep_analysis" : [ ... ],
"final_synthesis" : " ... "
}
}
Ollama를 설치하십시오
# For Linux
curl -L https://ollama.com/download/ollama-linux-amd64 -o ollama
chmod +x ollama
./ollama serve
# For Windows
# Download and install from https://ollama.com/download/windows
필요한 모델을 설치하십시오
# Install the fast reasoning model (3B Model - fast thought)
ollama pull llama3.2
# Install the deep reasoning model (8B Model - deep thought)
ollama pull llama3.1
# Verify installations
ollama list
예상 출력 :
NAME ID SIZE MODIFIED
llama3.2:latest 6c2d00dcdb27 2.1 GB 4 seconds ago
llama3.1:latest 3c46ab11d5ec 4.9 GB 6 days ago
파이썬 환경을 설정하십시오
# Create virtual environment
python -m venv lors-env
# Activate environment
# On Windows
lors-env S cripts a ctivate
# On Unix or MacOS
source lors-env/bin/activate
# Install requirements
pip install -r requirements.txt
# Install spaCy language model
python -m spacy download en_core_web_sm
# Simple query
python local-o1-reasoning.py -p " Explain the concept of quantum entanglement "
# Complex analysis
python local-o1-reasoning.py -p " Analyze the implications of quantum computing on modern cryptography systems and propose potential mitigation strategies "
모델 로딩 문제
# Verify model status
ollama list
# Restart Ollama service if needed
ollama stop
ollama serve
GPU 메모리 문제
nvidia-smi -l 1
일반적인 오류 솔루션
ollama pull [model_name] --force
LORS/
├── local-o1-reasoning.py
├── requirements.txt
├── responses/
│ └── [automated response files]
└── README.md
MIT 라이센스
우리는 기여를 환영합니다! 자세한 내용은 기고 가이드 라인을 참조하십시오.