Falcon
An open-source LLM from the Technology Innovation Institute
An open-source LLM from the Technology Innovation Institute
Falcon is an open-source large language model developed by the Technology Innovation Institute (TII) of the UAE (United Arab Emirates). When it was released in 2023, it ranked 1st on the Hugging Face Open LLM Leaderboard, setting a new standard for open-source LLMs. It is released under the Apache 2.0 license, so commercial use is completely free.
Falcon is offered in 7B, 40B, and 180B parameter versions. In particular, it was trained on 1.5 trillion tokens of RefinedWeb, a high-quality web dataset, which is 5 times the training data of LLaMA. TII demonstrated that data quality matters more than model size, and also released the RefinedWeb dataset.
Falcon's key architectural feature is Multi-Query Attention. Unlike conventional Multi-Head Attention, all heads share the Key and Value, which greatly improves inference speed. It also uses FlashAttention and encodes positional information with RoPE (Rotary Position Embedding). These optimizations enable faster inference than other models of the same size.
In practice, Falcon is a strong option for on-premises LLM deployment. The 7B model can run on a 16GB GPU, and the 40B model can also run inference on a single 80GB A100. Korean-language performance is limited in the base model, but fine-tuning on Korean data can bring considerable performance improvements. It is compatible with inference engines such as vLLM and text-generation-inference.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Falcon 7B 모델 로드
model_id = "tiiuae/falcon-7b-instruct"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
# 텍스트 생성
def generate_response(prompt, max_new_tokens=256):
# Falcon Instruct 모델 프롬프트 형식
formatted_prompt = f"User: {prompt}\nAssistant:"
inputs = tokenizer(formatted_prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
temperature=0.7,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
# 프롬프트 부분 제거
return response.split("Assistant:")[-1].strip()
# 사용 예시
prompt = "Python에서 리스트 컴프리헨션의 장점을 설명해주세요."
response = generate_response(prompt)
print(response)
# 4-bit 양자화로 메모리 절약 (bitsandbytes 필요)
from transformers import BitsAndBytesConfig
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
model_4bit = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True
)
# vLLM으로 빠른 추론 (별도 설치 필요)
# from vllm import LLM, SamplingParams
# llm = LLM(model=model_id, trust_remote_code=True)
# outputs = llm.generate(["Hello, world!"], SamplingParams(temperature=0.7))
These are the specs of the Falcon model lineup as of January 2025. (Open-source, Apache 2.0 license)
| Model | Parameter | Training Tokens | GPU Memory |
|---|---|---|---|
| Falcon-7B | 7B | 1.5 trillion | ~14GB (BF16) |
| Falcon-40B | 40B | 1 trillion | ~90GB (BF16) |
| Falcon-180B | 180B | 3.5 trillion | ~400GB (8xA100) |
Benchmark: At release, Falcon-180B ranked 1st on the Open LLM Leaderboard (68.74 points), surpassed GPT-3.5, and came close to GPT-4. With 4-bit quantization, even 180B can run inference at ~100GB. 600B tokens of RefinedWeb were released.
"We can't use external APIs because of data security, so we're considering Falcon 40B. Two A100 80GB GPUs can handle inference, and if we deploy with vLLM, it also handles concurrent requests well. Its big advantage is that the license is more permissive than LLaMA 2, so we can use it directly in commercial services."
"When we fine-tuned Falcon 7B with LoRA on 50,000 Korean customer support records, response quality improved significantly. Using QLoRA with 4-bit quantization made training possible even on a 16GB GPU, so we were also able to lower the cost of setting up the development environment."
"The reason Falcon is open-source while delivering performance similar to GPT-3.5 is the quality of its training data. RefinedWeb is high-quality data from CommonCrawl that has gone through deduplication and quality filtering, and TII collected as much as 1.5 trillion tokens of it. The model architecture matters too, but the data was decisive."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
Falcon 7B requires about 14GB of GPU memory in BF16, and 40B requires about 80GB. 4-bit quantization can reduce memory to 1/4, but performance degrades slightly. Be sure to benchmark memory usage and inference speed before production deployment.
Use the falcon-instruct version for conversational services. The Base model does not follow instructions well and only performs simple text completion. The Instruct model achieves optimal results only when you use a specific prompt format (User:/Assistant:).
Falcon was trained mainly on English, so its Korean-language performance may be lower than LLaMA 2 or Mistral. To use it for a Korean-language service, additional fine-tuning on Korean data is essential. Alternatively, consider Korean-specialized models (KULLM, KoAlpaca, etc.).