Preprint · arXiv:2603.17782
Adapting a billion-parameter vision model with few labels
Parameter-efficient fine-tuning of a billion-parameter vision model improves dairy cattle behavior classification under a 1:98 train-to-test ratio
Specialized image-recognition tasks rarely come with large labeled datasets. Should you train a compact model of your own from scratch, or reuse a large pre-trained foundation model, either frozen or adapted with parameter-efficient fine-tuning (PEFT)? We compared these routes on one task with few labels and a very large test set: classifying nine dairy cattle behaviors from 2,160 expert-verified images, then testing on 211,800 images, 98 times the training set.
Paper Code & data splits Models Calf dataset
Why we did this study
Cameras can watch every animal on a farm, and deep learning can recognize behavior in images. The bottleneck is labels: fine-grained behaviors differ by subtle posture, the images are often occluded, low in resolution and unevenly lit, and expert annotation is slow, so labeled datasets stay small.
Vision foundation models offer a way around this. DINOv3, with 6.7 billion parameters, learned general-purpose visual features from 1.7 billion unlabeled images. But updating all of its weights needs far more memory than a single 16 GB graphics card has, and can overfit a few thousand labels. The usual alternatives are to keep the model frozen and train only a classifier on its features, or to use parameter-efficient fine-tuning, which inserts a small number of trainable parameters into the frozen network. QLoRA, for example, compresses the frozen weights to 4 bits and trains small low-rank adapters, so a billion-parameter model fits on one card.
How these routes compare when labels are scarce, and how much adapter capacity to give, is poorly documented at this scale. Most vision benchmarks also test on small held-out splits from the same curated pool, which hides class imbalance and label errors. We asked:
- How much does a billion-parameter model gain from parameter-efficient adaptation, compared with networks trained from scratch on the same images and with the same model kept frozen?
- How do the size and placement of the adapters affect accuracy and training cost?
- What limits the accuracy that can be measured when the test set is large and its labels unverified?
(240 per behavior)
How we did it
Eleven models, three routes, one protocol: the same 2,160 training images, the same 540 validation images for early stopping, the same 211,800 test images and one Tesla V100 16 GB GPU.
The data
Each image is a crop of one animal from a video frame, labeled with that animal's behavior at that time. Six behaviors of lactating Holstein cows come from the public MmCows dataset; three play behaviors of group-housed calves come from PlayBehavior, whose recordings of two of the four farms are public as the Calf Play Behavior Dataset. Two annotators with veterinary training verified 300 crops per behavior against written criteria, deliberately keeping difficult examples (occlusion, unusual viewpoints, blur). The test labels are the source annotations, not verified by eye, and the test set is strongly imbalanced: lying and standing make up 72.4% of it, the three calf behaviors 0.9%.
Images per behavior
Three routes to a classifier
Self-customized networks, trained from scratch
Compact networks whose every weight is learned from the 2,160 training images.
- ResNet-18 (11.3 million parameters)
- ViT-Small (21.8 million parameters)
No pre-training · all weights trained
Foundation model, frozen
DINOv3 ViT-7B/16 kept unchanged; only a three-layer classifier is trained on its 4,096-dimensional features.
- Backbone in 16-bit precision, frozen
- Classifier: 4.7 million parameters
0.07% of the backbone's size trained
Foundation model + parameter-efficient fine-tuning
DINOv3 compressed to 4 bits and adapted with small low-rank adapters, trained together with the same classifier.
- QLoRA, or its weight-decomposed variant DoRA
- Rank 8, 16 or 64; adapters on the query projections or on all linear layers
Eight configurations · 0.11–2.75% of the backbone's size trained
Where the adapters go
Each of DINOv3's 40 transformer blocks has seven linear layers: four in the attention and three in the gated feed-forward network. The two placements differ in how many of them carry an adapter.
How we evaluated
Every model trained with early stopping on validation accuracy and was scored on all 211,800 test images: accuracy with 95% confidence intervals, macro-F1 (the unweighted mean of the per-behavior F1 scores), per-behavior precision and recall, and training and inference time. Each configuration was trained once with the same random seed. Finally, two annotators reviewed 200 test images on which the best model disagreed with the label, to see whether the model or the label was at fault.
What we found
Adapting the foundation model beat both alternatives
Test and validation accuracy of the eleven models
Table view
…and was the cheapest to train
Test accuracy against end-to-end training time
Table view
More adapter capacity, higher accuracy
Test accuracy by adapter configuration
Table view
Where the errors are
Confusion matrix, as percentages of each annotated behavior
Table view (counts)
F1 score per behavior
Table view
Most remaining disagreements were label problems
200 test images where the best model disagreed with the label, reviewed by two annotators
What it means
The contribution is evidence about approaches, not a new algorithm: for a specialized task with scarce labels, how to use a very large pre-trained vision model on ordinary hardware.
Reuse and adapt, rather than train from scratch
Adapting a pre-trained foundation model with PEFT was more accurate than training a self-customized network on the same images and more accurate than using the foundation model frozen, on a single 16 GB graphics card.
Give the adapters room
Small adapters underfit the shift from web images to barn video. Adapters on all linear layers at a rank of several tens were the most accurate and, here, also the cheapest to train; capacity can be reduced if overfitting appears.
QLoRA first, DoRA when the adapter budget is tight
DoRA helped only the smallest adapters, took 1.2–2.5 times as long per epoch, and halved inference throughput with adapters on all linear layers. At rank 64, QLoRA matched it in about half the training time.
Test at deployment scale, and audit the labels
Scoring every labeled image exposed the class imbalance and failure modes that a small balanced split hides, and the audit showed that label quality, not model capacity, limited the accuracy that could be measured.
Models & data
Trained models
| Model | Contents | Hugging Face |
|---|---|---|
| QLoRA, all-linear, r = 64 | adapters and classifier of the best model | cow-behavior-dinov3-qlora-r64 |
| DoRA, all-linear, r = 64 | adapters and classifier | cow-behavior-dinov3-dora-r64 |
| DINOv3, frozen | classifier on the frozen backbone | cow-behavior-dinov3-Frozen |
| ResNet-18, ViT-Small | networks trained from scratch | cow-behavior-from-scratch |
The adapters need the gated DINOv3 ViT-7B/16 backbone and expect 224 × 224 RGB images with pixel values in [0, 1]; each model card has a working inference example.
Data
| Source | Behaviors | Access |
|---|---|---|
| MmCows (Vu et al., NeurIPS 2024) | drinking, eating head down, eating head up, lying, standing, walking | public, CC BY-NC-SA 4.0 |
| Calf Play Behavior Dataset, version 1.2 | frontal pushing, gallop, leap (2,528 of 2,819 calf images) | public, CC0 · doi:10.57967/hf/11689 · dataset paper |
| PlayBehavior, two further farms | 291 calf images | on reasonable request |
The split files list every image with its split and label, and link each public calf image to its session, frame and calf in the public dataset. The repository also holds the confusion matrices, per-image test predictions and training curves of the models.
Citation
@article{yang2026peftcows,
title = {Parameter-efficient fine-tuning of a billion-parameter vision model improves
dairy cattle behavior classification under a 1:98 train-to-test ratio},
author = {Yang, Haiyu and Sharma, Sumit and Liu, Enhong and Hostens, Miel},
journal = {arXiv preprint arXiv:2603.17782},
year = {2026}
}If you use the calf images, please also cite the dataset:
@misc{calfplay_dataset_2026,
author = {Yang, Haiyu and Lesscher, Heidi and Liu, Enhong and Hostens, Miel},
title = {Video recordings and play behaviour annotations of group-housed dairy calves on two Dutch farms},
year = {2026},
publisher = {Hugging Face},
version = {1.2},
doi = {10.57967/hf/11689}
}