Selecting and Evaluating LLM Services: A Practical Five-Dimension Framework
Choosing a large language model (LLM) service based solely on leaderboard rankings or community reputation often fails to answer two critical questions: what capabilities does your business actually need, and how well do candidate models perform on your real-world data? This article presents a reusable evaluation framework covering five core dimensions—basic capabilities, context window, interaction experience, cost model, and compliance—and explains how to validate models using your own data before engineering integration.
When developers choose a large language model (LLM) service, many start by looking at public leaderboard rankings or community feedback before making a decision. This approach is convenient, but it rarely answers two more critical questions: what capabilities does your business scenario actually need, and how well do those capabilities perform on your real-world data? This article provides a reusable evaluation framework covering five dimensions, along with practical guidance on validating candidates with your own data and completing the engineering integration.
Clarify Requirements Before Comparing Models
The starting point for model selection is the task, not the model itself. A single model may perform very differently across code completion, customer support Q&A, and contract summarization. It is recommended to write your requirements down as quantifiable items:
- Task type: generation, rewriting, extraction, classification, code, or Q&A
- Input scale: average and maximum token count per request
- Latency requirements: time to first token and total completion time
- Concurrency: peak requests per second
- Data sensitivity level: whether data may leave your domain, and whether private deployment is required
The more specific your requirements, the easier the subsequent evaluation becomes. A vague statement like “I want a helpful assistant” cannot be translated into test cases, while a concrete requirement such as “extract key clauses from Chinese contracts up to 3,000 characters, with no less than 90% recall on critical fields” can be verified directly.
Five Core Evaluation Dimensions
2.1 Basic Capabilities
Basic capability refers to a model’s performance in areas such as code generation, knowledge Q&A, Chinese writing, and comprehension. Public benchmarks are commonly used to measure these capabilities. For example, code generation benchmarks ask the model to complete a function and then run unit tests to calculate the pass rate; multi-subject knowledge benchmarks use multiple-choice questions and measure accuracy.
Public benchmarks are useful as a reference, but they have three notable limitations:
- Benchmark questions may have already appeared in the training data, inflating scores
- Question formats often differ significantly from real business scenarios
- Different evaluations use different prompts, sampling parameters, and scoring scripts, making scores not directly comparable
For these reasons, public scores are suitable for initial screening, but final conclusions should be based on evaluation with your own business data.
2.2 Context Window and Long-Text Processing
The context window determines how much input a model can accept in a single request, typically measured in tokens. The token conversion ratio for Chinese and English depends on the tokenization method; the same text can produce significantly different token counts across different models. You cannot simply assume that one character equals one token.
A larger context window does not guarantee accurate long-text understanding. Models tend to extract information from the middle of long inputs less reliably than from the beginning and end—a phenomenon often called “lost in the middle.” To verify this, place critical information at different positions within a document and measure the recall rate at each position.
When documents far exceed the context window, the common approach is chunking plus retrieval:
def split_text(text: str, chunk_size: int = 1500, overlap: int = 200) -> list[str]:"""Split long text by characters, keeping overlap between adjacent chunks to avoid cutting off key sentences."""chunks = []start = 0while start < len(text):end = min(start + chunk_size, len(text))chunks.append(text[start:end])if end == len(text):breakstart = end - overlapreturn chunks
When splitting, prefer segmenting along paragraph or section boundaries rather than mechanically by character count, to avoid breaking semantic units.
2.3 Interaction Experience
Interaction experience covers response speed, context retention across multiple turns, fluency of voice input/output, and interface usability. For individual users, these factors often determine retention; for enterprise applications, they determine integration costs.
For developer-facing APIs, there are corresponding experience metrics:
- Time to first token (TTFT): determines how long the user perceives waiting
- Output speed (tokens per second): determines total time for long-form generation
- Streaming output support: determines whether the frontend can display results incrementally
- Multi-turn conversation state management: whether the server maintains history or the client sends the full history with each request
Measure these metrics in your target network environment using real request distributions, reporting percentiles such as P50 and P95 rather than just averages.
2.4 Cost Model
LLM services typically price input and output tokens separately, with output generally priced higher than input. The following function can estimate cost:
def estimate_cost(requests_per_day: int,avg_input_tokens: int,avg_output_tokens: int,input_price_per_m: float,output_price_per_m: float,) -> float:"""Estimate daily cost; unit prices are per million tokens."""input_cost = requests_per_day * avg_input_tokens / 1_000_000 * input_price_per_moutput_cost = requests_per_day * avg_output_tokens / 1_000_000 * output_price_per_mreturn input_cost + output_cost
Cost evaluation should also consider several hidden factors: the validity period and scope of free tier credits, rate limits (requests per minute and tokens per minute), whether failed calls are billed, and whether discounts such as cached input apply to your use case. Prices change frequently, so always verify against the latest official pricing information from the provider before making a final decision.
2.5 Compliance and Data Security
The compliance dimension includes whether your data is used for model training, where data is stored and for how long, whether private deployment or dedicated connectivity is supported, and whether industry regulatory requirements are met. For data involving personal information, trade secrets, or regulated data, legal and security teams should review before technical selection proceeds.
Data can be masked before entering the model, for example by replacing phone numbers and ID card numbers:
import rePATTERNS = {"phone": re.compile(r"1[3-9]\d{9}"),"id_card": re.compile(r"\d{17}[\dXx]"),}def mask_sensitive(text: str) -> str:"""Replace common sensitive information with placeholders to reduce data leakage risk."""for name, pattern in PATTERNS.items():text = pattern.sub(f"[{name.upper()}]", text)return text
Regular expressions only cover common formats. For more complex sensitive information, dedicated data identification services are also needed.
Evaluating with Your Own Data
Public benchmarks cannot replace business-specific evaluation. A reproducible evaluation workflow typically includes four steps:
Step 1: Build an evaluation set. Sample typical requests from real business logs, covering high-frequency scenarios, edge cases, and invalid inputs. Prepare at least dozens of samples for each task type, and write down the judging criteria for each sample.
Step 2: Standardize calling conditions. Fix the prompt template, temperature parameter, maximum output length, and system instructions to ensure fair comparison across different services.
Step 3: Combine automated scoring with human spot-checking. Use scripted scoring for tasks that can be judged by rules—for example, whether fields are complete or whether code passes unit tests. For open-ended tasks like writing, have two reviewers score independently, calculate inter-rater agreement, and discuss cases with large discrepancies.
Step 4: Produce a decision matrix. Consolidate scores across all dimensions, cost estimates, and latency measurements into a single summary for side-by-side comparison. The decision matrix should include the intended use case and a go/no-go recommendation for each candidate model.
The key takeaway in every step is this: define the task concretely, measure what matters to your actual workload, and let data—not rankings—drive the final choice.
