Fine-Tuning Small Models Locally: A Complete POI Classification Workflow
This article walks through a practical, end-to-end workflow for locally fine-tuning a small open-source model on a POI (point of interest) classification task. It covers why small models plus parameter-efficient fine-tuning fit well-scoped labeling problems, how to define the task and build a clean dataset, the hardware and hyperparameter settings used, common training issues and fixes, and how to evaluate and run inference. Readers will get a repeatable, low-cost approach they can transfer to other text classification and information extraction tasks.
1. Why Choose a Small Model with Local Fine-Tuning
Not every production task needs a model with massive parameter counts. For classification problems with clear boundaries and a fixed label set, a small open-source model combined with parameter-efficient fine-tuning is often enough to get satisfying results. There are three practical reasons to start small:
- Low resource requirements: A 2B-class model’s weights are typically a few gigabytes, small enough to load on an ordinary personal computer without a high-performance cluster.
- Fast iteration: Fewer parameters mean lower cost per forward and backward pass, which suits rapid experimentation and repeated tuning.
- Privacy and cost control: Data never leaves the local machine, sensitive information is not transmitted externally, and cloud compute bills are avoided.
Parameter-efficient fine-tuning, represented by LoRA, amplifies these advantages further. It freezes the backbone weights and injects and trains only a very small number of new parameters, sharply reducing memory usage and optimizer state overhead, which makes fine-tuning accessible to almost anyone.
2. Defining the Task: POI Classification
POI (point of interest) classification is a foundational capability in mapping and local-services scenarios: given a place name, determine its type. This experiment uses four categories:
- Building: e.g., “Emerald Garden - Building 3”
- 4S dealership: e.g., “Shenzhen Baochuang BMW 4S Store”
- Indoor sub-point: e.g., “KFC (Beijing South Railway Station Store)”
- Other: e.g., “Zhang’s BBQ”
The labels are explicit and each answer is unique, which makes this task well suited as an introductory exercise for SFT (supervised fine-tuning).
3. Data Construction: The Key Factor That Sets the Ceiling
Data quality directly determines fine-tuning results. The recommended process is:
- Collection and cleaning: Remove duplicates and empty entries, and normalize full-width/half-width characters and bracket formatting.
- Label standards: Define clear decision rules to avoid a fuzzy boundary between “indoor sub-point” and “other”.
- Consistent formatting: Use a conversational structure of “instruction + input + output” so the model can learn it easily.
Example data format:
{"instruction":"You are a POI classifier. Output one of: Building/4S dealership/Indoor sub-point/Other","input":"Emerald Garden - Building 3","output":"Building"}
Keep the samples balanced across categories; a few thousand in total is enough to start. Also set aside an independent test set that is strictly excluded from training.
4. Training Environment and Key Configuration
- Hardware: A personal device with general-purpose GPU acceleration is sufficient. On a chip with a unified memory architecture, its GPU backend can be used for acceleration, which in practice is usually several times faster than pure CPU.
- Framework: Use a mainstream deep learning framework, and enable mixed precision and gradient accumulation to save memory.
- Core hyperparameters (illustrative):
batch_size = 4gradient_accumulation_steps = 8learning_rate = 1e-4num_epochs = 3lora_rank = 8lora_alpha = 16lora_dropout = 0.05max_seq_length = 128
From experience: for a 2B model, a single step takes roughly a dozen seconds and a single epoch takes about half an hour, so 3 epochs are enough to converge.
5. Training Workflow and Common Issues
- Environment alignment: Unify dependency versions to avoid operator incompatibility.
- Out-of-memory errors: Reduce the batch size, shorten the sequence length, and enable gradient checkpointing.
- Failure to converge: Check the data format, whether labels are out of range, and whether the learning rate is too high.
- Overfitting: Reduce the number of epochs, increase data diversity, and raise dropout.
After training, save the LoRA adapter weights first, then merge them as needed. This makes version management and rollback easier.
6. Evaluation and Inference
Use the independent test set to compute accuracy, precision, recall, and F1, and output a confusion matrix to locate the easily confused categories (commonly “indoor sub-point” and “other”). During inference, keep the same instruction template used in training to avoid distribution drift.
7. Summary
A small-parameter model plus parameter-efficient fine-tuning plus local acceleration is a viable path for validating vertical classification tasks at low cost. The keys are: clear scenario boundaries, solid data standards, restrained hyperparameters, and rigorous evaluation. Once you master this methodology, you can smoothly transfer it to more text classification and information extraction scenarios.
