최근 AI 업계에서 화제가 되고 있는 DeepSeek에서 DeepSeek R1
이라는 오픈소스 대규모 언어 모델(LLM)을 발표했습니다. OpenAI의 O1
과 유사한 Chain of Thought(CoT) 방식을 채택하여, 응답을 생성하기 전에 스스로 사고(Reasoning) 과정을 거치는 것이 특징입니다. 특히 OpenAI API와의 완벽한 호환성과 Langchain 연동을 지원합니다. 그럼 DeepSeek R1의 특징과 실제 구현 방법을 상세히 살펴보겠습니다.
참고로 언급될 Ollama에 대해 궁금하신 분은 다음 글들을 참고하시기 바랍니다.
Ollama #1: 비용 걱정 없이 내 컴퓨터에서 제약 없는 LLM 실행하기
Ollama #2: 내 손으로 만드는 ChatGPT 로컬LLM – 커스텀 모델 설치부터 실용 앱까지
1. DeepSeek R1 개요와 O1 비교 분석
DeepSeek R1은 오픈소스 기반으로 제공되는 대규모 언어 모델로서, MIT 라이선스 하에 공개되어 누구나 자유롭게 사용할 수 있습니다. 몇 가지 주요 특징을 꼽자면 다음과 같습니다.
- 고성능 추론
- 코딩, 수학, 다국어 지원, 추론 작업 등 다양한 벤치마크에서 뛰어난 성능을 보이며, OpenAI의 O1이나 3.5 Sonnet과 같은 상용 모델과 유사하거나 그 이상을 기록합니다.
- 오픈소스 접근성
- API, LM Studio, Ollama, AMA 등 다양한 플랫폼과 툴을 통해 쉽게 접근할 수 있습니다. 로컬 설치도 간단해, 개인용 PC나 서버 환경에서 돌리기 용이합니다.
- 비용 효율성
- O1 대비 30배, ChatGPT 대비 약 96.4% 저렴하다고 알려져 있습니다. 대규모 트래픽 혹은 대규모 실험 환경에서 운영할 경우 큰 비용 절감 효과가 기대됩니다.
- 다양한 버전 제공
- 원본 모델뿐 아니라, 압축(distilled) 모델 등 경량화 모델도 있어 하드웨어 사양이 제한적인 환경에서도 적절한 버전을 골라 사용할 수 있습니다.
- Deep Think(Chain of Thought) 기능
- 모델이 답변을 생성하기 전 “Deep Think” 혹은 reasoning 과정을 명시적으로 포함해, 논리적/수학적 문제 해결 능력을 높이고 투명성을 높이는 특징이 있습니다.
- MIT 라이선스
- 상업적 활용이 가능한 오픈소스 라이선스를 채택하여, 다양한 기업이나 개인 개발자들의 참여가 기대됩니다.
OpenAI의 O1과 비교했을 때 다음과 같은 특징을 보입니다
벤치마크 | DeepSeek R1 | OpenAI O1 | 차이 (R1 – O1) | 비고 |
---|---|---|---|---|
AIME 2024 | 79.8% | 79.2% | +0.6% | 수학 문제 해결 능력 |
Codeforces | 96.3% | 96.6% | -0.3% | 코딩 문제 해결 |
GPQA Diamond | 71.5% | 75.7% | -4.2% | 일반 지식 추론 |
MATH-500 | 97.3% | 96.4% | +0.9% | 고급 수학 능력 |
MMLU | 90.8% | 91.8% | -1.0% | 다중 분야 지식 |
SWE-bench Verified | 49.2% | 48.9% | +0.3% | 소프트웨어 엔지니어링 |
- MATH-500과 AIME 2024에서 DeepSeek R1이 O1보다 약간 우세
- Codeforces와 MMLU에서는 O1이 근소하게 앞섬
- GPQA Diamond에서 O1이 가장 큰 격차로 우세
- 전반적으로 두 모델이 매우 근접한 성능을 보여줌
2. DeepSeek R1 직접 테스트
2.1 DeepSeek Chat 활용
가장 간단하게 DeepSeek R1을 써볼 수 있는 방법 중 하나가 DeepSeek Chat( 링크 ) 입니다.
- 회원가입/로그인
– DeepSeek Chat에 접속하여 계정을 만든 뒤 로그인합니다.

- DeepThink 모드 선택
– 제공되는 여러 모드 중DeepThink
모드를 선택하면, 모델이 응답을 생성하기 전에 reasoning 과정을 내부적으로 거치게 됩니다.

- 질의 예시
– 예:'strawberry'라는 단어에는 몇 개의 R이 있나요?
– DeepSeek R1은 내부적으로 글자 수를 세고, reasoning 과정을 거친 후 최종적으로 ‘R이 3개’라는 정답을 제시합니다.

실제로 테스트해 본 결과, 영어 단어나 간단한 수학 계산 등에 대해서는 Chain of Thought를 거쳐 안정적인 답변을 제공해주었습니다.
2.2 OpenAI API 호환 방식의 DeepSeek R1 구현
DeepSeek R1은 OpenAI API와 동일한 형식을 지원하여, 기존 OpenAI 기반 프로젝트를 쉽게 마이그레이션할 수 있습니다. 이때 https://api.deepseek.com
을 Base URL로 지정하고, 별도로 발급받은 API Key를 사용하면 됩니다.
2.2.1 API 충전
- Platform DeepSeek으로 이동합니다.
- “Top up” 메뉴에서 원하는 금액만큼 결제를 진행합니다.

2.2.2 API Key 획득
- “API keys” 탭에서 “Create new API key”를 클릭합니다.
- 생성된 API 키는 따로 보관해두어야 하며, 이 키가 곧
deepseek-api-key
가 됩니다.

2.2.3 Python 예제 코드
OpenAI 라이브러리를 사용하듯이, 아래와 같이 base_url
을 https://api.deepseek.com
으로 지정하고, 모델 이름을 "deepseek-reasoner"
로 설정해주면 됩니다.
(아래 코드는 스트리밍 방식으로 reasoning 과정을 함께 받아오는 예시입니다.)
from openai import OpenAI client = OpenAI(api_key="deepseek-api-key", base_url="https://api.deepseek.com") # query = "9.11 and 9.8, which is greater?" # query = "How many Rs are there in the word 'strawberry'?" query = "'strawberry'라는 단어에는 몇 개의 R이 있나요?" message = [{"role": "user", "content": query}] response = client.chat.completions.create( model="deepseek-reasoner", # max_tokens=8000, messages=message, stream=True ) is_reasoning = False for chunk in response: if chunk.choices[0].delta.reasoning_content and chunk.choices[0].delta.reasoning_content: if not is_reasoning: print("\n# Thinking...\n", end="", flush=True) is_reasoning = True print(chunk.choices[0].delta.reasoning_content, end="", flush=True) elif chunk.choices[0].delta.content: if is_reasoning: print("\n\n# Answer:\n", end="", flush=True) is_reasoning = False print(chunk.choices[0].delta.content, end="", flush=True)
3. Ollama + Langchain 통합 구현 가이드
3.1 Ollama 환경에서 DeepSeek R1 실행
ollama.com에 접속하면, DeepSeek R1의 여러 버전을 확인할 수 있습니다.
여기서 14b
모델 선택 후, 아래 명령어를 복사하여 터미널에서 실행하면 됩니다.
ollama run deepseek-r1:14b


이후 프롬프트가 뜨면, 직접 모델과 대화를 시도할 수 있습니다.
- How many Rs are there in the word ‘strawberry’?
>>> How many Rs are there in the word 'strawberry'? <think> Okay, so I need to figure out how many times the letter 'R' appears in the word "strawberry". Let me break it down step by step. First, I'll write out the word to visualize each letter clearly: S-T-R-A-W-B-E-R-R-Y. Now, I'll go through each letter one by one and check if it's an 'R'. Starting from the beginning: 1. The first letter is 'S'—not an 'R'. 2. Next is 'T'—also not. 3. Then comes 'R'—that's one. 4. After that, we have 'A'—nope. 5. Then 'W', which isn't an 'R'. 6. Moving on to 'B'—still not. 7. Next is 'E'—not an 'R'. 8. Now, there are two letters in a row: 'R' and another 'R'. So that's two more. Wait, let me make sure I didn't miss any. Let me count again: - S (1) - no - T (2) - no - R (3) - yes, one - A (4) - no - W (5) - no - B (6) - no - E (7) - no - R (8) - yes, two - R (9) - yes, three - Y (10) - no Hmm, I think I made a mistake earlier. Let me recount the letters properly. Breaking down "strawberry": S T R A W B E R R Y Positions: 1: S 2: T 3: R 4: A 5: W 6: B 7: E 8: R 9: R 10: Y So, the 'R's are at positions 3, 8, and 9. That makes three Rs in total. Wait, did I count correctly before? Initially, I thought there were two Rs, but now I see there are actually three. Let me double-check by writing it out again: S T R A W B E R R Y Yes, after 'E' comes R twice in a row, making the total number of Rs as three. So, my initial count was wrong because I stopped at two Rs, but upon recounting, there are actually three Rs. </think> The letter 'R' appears three times in the word "strawberry". **Answer:** There are 3 Rs in the word 'strawberry'.
- 9.11 and 9.8, which is greater?
>>> 9.11 and 9.8, which is greater? <think> Okay, so I have these two numbers: 9.11 and 9.8. I need to figure out which one is bigger. Both of them start with a 9 before the decimal point, so that part is the same. But after the decimal, there are different digits. First, let's understand what decimals mean. The number 9.11 has 9 units and 0.11 parts of a unit. Similarly, 9.8 has 9 units and 0.8 parts of a unit. Now, to compare these two, I should look at the decimal part after the decimal point. So, I need to see which is bigger: 0.11 or 0.8. I know that 0.8 is the same as 0.80, and 0.80 is larger than 0.11 because 8 tenths are more than 1 tenth. So, even though both numbers start with 9, the decimal part of 9.8 is bigger than that of 9.11. Therefore, 9.8 is greater than 9.11. </think> **Answer:** 9.8 is greater than 9.11 because 0.8 (which is equivalent to 0.80) is larger than 0.11.
추론 과정(<think>
태그 사이)을 모델이 명시적으로 보여주고, 마지막에 최종 답을 제시합니다.
3.2 Langchain과 DeepSeek R1의 효율적인 통합
pip install langchain_ollama
설치 후 아래와 같이 간단한 테스트 코드를 작성합니다.
from langchain_ollama import ChatOllama # Initialize the ChatOllama model ollama_model = ChatOllama( model="deepseek-r1:14b", # Replace with the specific model you are using max_tokens=8000 ) # Define a simple query # query = "9.11 and 9.8, which is greater?" query = "How many Rs are there in the word 'strawberry'?" message = [ {"role": "user", "content": query} ] # Get the response from the model for chunk in ollama_model.stream(message): print(chunk.content, end="", flush=True)
- 일부 상황에서
14b
모델이 충분히 정확하지 못한 답변을 내놓을 때도 있었습니다. 특히 한국어 질의의 경우, 간혹 이상한 단어가 섞여 나오거나 논리가 부족한 답을 제공하기도 했습니다. - 동일한 Ollama 환경에서도
ollama run deepseek-r1:14b
명령어로 직접 질의했을 때는 비교적 안정적인 답변을 주었는데, Langchain과의 연결 시 세부 파라미터 차이나 트랜스폼 과정에서의 이슈가 있는 것으로 보였습니다.
4. Langchain으로 직접 DeepSeek R1 호출
DeepSeek가 OpenAI 호환 API 방식을 지원하므로, langchain_openai
를 사용하면 OpenAI 대신 DeepSeek를 호출하는 방식이 가능합니다.
pip3 install langchain_openai
아래 예시 코드는 model='deepseek-reasoner'
, openai_api_key='deepseek-api-key'
, openai_api_base='https://api.deepseek.com'
와 같은 설정이 핵심입니다.
from langchain_openai import ChatOpenAI ollama_model = ChatOpenAI( model='deepseek-reasoner', openai_api_key='deepseek-api-key', openai_api_base='https://api.deepseek.com', max_tokens=8000 ) # Define a simple query query = "9.11 and 9.8, which is greater?" # query = "How many Rs are there in the word 'strawberry'?" message = [ {"role": "user", "content": query} ] # Get the response from the model for chunk in ollama_model.stream(message): print(chunk.content, end="", flush=True)
이렇게 하면 Langchain의 체인/에이전트 등을 이용하면서도 DeepSeek R1 모델을 백엔드로 활용할 수 있습니다.
5. 실제 사용 후기
- 14b 모델의 아쉽움
한국어 질문 시에는 간혹 영문과 다른 언어가 섞여서 나오는 경우가 발생하거나 잘못된 답변을 하는 모습을 보였습니다. 14b 모델은 크기가 줄어든 버전이기 때문에, 다국어나 답변의 퀄리티에 있어 다소 한계가 있어 보입니다. - 이용 비용
- DeepSeek가 오픈소스 모델로 제공된다는 점, 그리고 API 비용이 비교적 저렴하다는 점은 큰 장점입니다.
- 추가 기대효과
- 모델이 코딩, 수학, 수열, 알고리즘 디자인 등 다양한 작업을 수행할 수 있다고 하므로, 향후 버전 업데이트나 추가 학습에 따라 더욱 정교한 성능이 기대됩니다.
6. 정리 & 결론
- DeepSeek R1 출시: 상용 모델에 비견되는 성능을 가진 오픈소스 대규모 언어 모델로 주목받고 있습니다.
- 오픈소스 기반: MIT 라이선스 및 여러 플랫폼 지원으로 접근성이 뛰어납니다.
- 비용 경쟁력: ChatGPT나 O1에 비해 매우 저렴하게 사용할 수 있어, 비용 면에서 상당히 매력적입니다.
- 성능: 수학, 코딩, 추론 등에서 우수한 결과를 보여주지만, 압축버전에서는 완벽하지 않을 수 있습니다.
- 향후 전망: 압축 버전, 다양한 버전으로 배포되고 있어, 앞으로의 업그레이드나 커뮤니티 기여에 따라 더 다양하고 정교한 활용법이 나올 것으로 기대됩니다.
DeepSeek R1은 아직 ‘발전 중인 모델’이지만, 이미 여러 측면에서 상용 모델에 필적하거나, 어떤 부분은 뛰어넘는 모습을 보이고 있습니다. 오픈소스 생태계에 큰 기여를 하고 있다는 점이 고무적이며, 향후 GPT 계열 모델과 어떻게 경쟁하고 발전해나갈지 지켜볼 만합니다.
참고
이상으로 DeepSeek R1 모델을 테스트해본 과정과 후기를 공유해드렸습니다.
성능적 강점, 오픈소스 라이선스, 저렴한 비용 등을 고려할 때, AI 모델 활용이 필요한 분들에게 충분히 흥미로운 대안이 될 것으로 보입니다.