journal article·2025-12-17Open access

Fine-Tuning a Local LLM for Thermoelectric Generators with QLoRA: From Generalist to Specialist

José Miguel Monzón-Verona, Santiago García-Alonso, Francisco Jorge Santana-Martín

Applied Sciences· Volume 15· Issue 24

Abstract

This work establishes a large language model (LLM) specialized in the domain of thermoelectric generators (TEGs), for deployment on local hardware. Starting with the generalist JanV1-4B model and Qwen3-4B-Thinking-2507 models, an efficient fine-tuning (FT) methodology using quantized low-rank adaptation (QLoRA) was employed, modifying only 3.18% of the total parameters of thee base models. The key to the process is the use of a custom-designed dataset, which merges deep theoretical knowledge with rigorous instruction tuning to refine behavior and mitigate catastrophic forgetting. The dataset employed for FT contains 202 curated questions and answers (QAs), strategically balanced between domain-specific knowledge (48.5%) and instruction-tuning for response behavior (51.5%). Performance of the models was evaluated using two complementary benchmarks: a 16-question multilevel cognitive benchmark (94% accuracy) and a specialized 42-question TEG benchmark (81% accuracy), scoring responses as excellent, correct with difficulties, or incorrect, based on technical accuracy and reasoning quality. The model’s utility is demonstrated through experimental TEG design guidance, providing expert-level reasoning on thermal management strategies. This study validates the specialization of LLMs using QLoRA as an effective and accessible strategy for developing highly competent engineering support tools, eliminating dependence on large-scale computing infrastructures, achieving specialization on a consumer-grade NVIDIA RTX 2070 SUPER GPU (8 GB VRAM) in 263 s.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Advanced Thermoelectric Materials and Devices · Ferroelectric and Negative Capacitance Devices · Machine Learning in Materials Science

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Electrical Engineering Department (DIE), University of Las Palmas de Gran Canaria, 35017 Las Palmas de Gran Canaria, Spain

Institute for Applied Microelectronics, University of Las Palmas de Gran Canaria, 35017 Las Palmas de Gran Canaria, Spain

Department of Electronic Engineering and Automatics (DIEA), University of Las Palmas de Gran Canaria, 35017 Las Palmas de Gran Canaria, Spain

References (59)

Show source-provided references
1. Gao, Y., Xiong, Y., Gao, X., Jia, K., Pan, J., Bi, Y., Dai, Y., Sun, J., Wang, M., and Wang, H. (2024). Retrieval-Augmented Generation for Large Language Models: A Survey. arXiv.
2. Gabber, H.A., and Hemied, O.S. (2024). Domain-Specific Large Language Model for Renewable Energy and Hydrogen Deployment Strategies. Energies, 17.10.3390/en17236063 ↗
3. Chebbi, A., and Kolade, B. (2025). Towards EnergyGPT: A Large Language Model Specialized for the Energy Sector. arXiv.
4. Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W., and Rocktäschel, T. (2021). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. arXiv.
5. Pingua, B., Sahoo, A., Kandpal, M., Murmu, D., Rautaray, J., Barik, R.K., and Saikia, M.J. (2025). Medical LLMs: Fine-Tuning vs. Retrieval-Augmented Generation. Bioengineering, 12.10.3390/bioengineering12070687 ↗
6. Fine-Tuning Large Language Models for Specialized Use Cases10.1016/j.mcpdig.2024.11.005 ↗
7. Balaguer, A., Benara, V., de Freitas Cunha, R.L., Filho, R.d.M.E., Hendry, T., Holstein, D., Marsman, J., Mecklenburg, N., Malvar, S., and Nunes, L.O. (2024). RAG vs Fine-Tuning: Pipelines, Tradeoffs, and a Case Study on Agriculture. arXiv.
8. Sanin-Villa, D. (2022). Recent Developments in Thermoelectric Generation: A Review. Sustainability, 14.10.3390/su142416821 ↗
9. Characterization of Commercial Thermoelectric Modules for Application in Energy Harvesting Wireless Sensor Nodes10.1016/j.applthermaleng.2017.04.037 ↗
10. Niu, W., and Cao, X. (2023). Thermoelectric Field Analysis of Trapezoidal Thermoelectric Generator Based on the Explicit Analytical Solution of Annular Thermoelectric Generator. Energies, 16.10.3390/en16083463 ↗
11. Marjanović, M., Prijić, A., Randjelović, B., and Prijić, Z. (2020). A Transient Modeling of the Thermoelectric Generators for Application in Wireless Sensor Network Nodes. Electronics, 9.10.3390/electronics9061015 ↗
12. Jan-v1-4B Team (2025, November 03). Jan-v1-4B. Hugging Face, 2024. Available online: https://huggingface.co/janhq/Jan-v1-4B.
13. Houlsby, S.N., Giurgiu, A., Jastrzebski, S., Morrone, B., De Laroussilhe, Q., Gesmundo, A., Attariyan, M., and Gelly, S. (2019, January 9–15). Parameter-Efficient Transfer Learning for NLP. Proceedings of the 36th International Conference on Machine Learning (ICML), Long Beach, CA, USA. Available online: http://proceedings.mlr.press/v97/houlsby19a.html.
14. Lialin, V., Deshpande, V., Yao, X., and Rumshisky, A. (2024). Scaling Down to Scale Up: A Guide to Parameter-Efficient Fine-Tuning. arXiv.
15. Dettmers, T., Pagnoni, A., Holtzman, A., and Zettlemoyer, L. (2023). QLoRA: Efficient Finetuning of Quantized LLMs. arXiv.
16. Hu, E.J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., and Chen, W. (2021). LoRA: Low-Rank Adaptation of Large Language Models. arXiv.
17. Overcoming Catastrophic Forgetting in Neural Networks10.1073/pnas.1611835114 ↗
18. Zhou, C., Liu, P., Xu, P., Iyer, S., Sun, J., Mao, Y., Ma, X., Efrat, A., Yu, P., and Yu, L. (2023). LIMA: Less Is More for Alignment. arXiv.
19. Zhang, D., Song, L., Wang, L., Li, X., Chang, X., and Wu, P. (2022). A Systematic Review and Analysis of MPPT Techniques for TEG Systems Under Nonuniform Temperature Distribution. Front. Energy Res., 10.10.3389/fenrg.2022.942347 ↗
20. Feng, Y., Chen, L., Meng, F., and Sun, F. (2018). Influences of the Thomson Effect on the Performance of a Thermoelectric Generator-Driven Thermoelectric Heat Pump Combined Device. Entropy, 20.10.3390/e20010029 ↗
21. Sanin-Villa, D., Monsalve-Cifuentes, O.D., and Henao-Bravo, E.E. (2021). Evaluation of Thermoelectric Generators under Mismatching Conditions. Energies, 14.10.3390/en14238016 ↗
22. Characterization of Thermoelectric Modules for Powering Autonomous Sensors10.1109/TIM.2008.928405 ↗
23. Cataldo, R.L., and Bennett, G.L. (2025, November 03). U.S. Space Radioisotope Power Systems and Applications: Past, Present and Future. Available online: https://www.intechopen.com/chapters/21663.
24. (2025, November 03). Fundamental Algorithms for Scientific Computing in Python-2025. Available online: https://scipy.org/es/.
25. Han, M., and Han, D. (2025, November 03). Unsloth: 2x Faster & Less Memory LLM Finetuning, Available online: https://github.com/unslothai/unsloth.
26. Yang, A., Yang, B., Hui, B., Zheng, B., Yu, B., Zhou, C., Li, C., Li, C., Liu, D., and Huang, F. (2024). Qwen2 Technical Report. arXiv.
27. Monzón-Verona, J.M., García-Alonso, S., and Santana-Martín, F.J. (2025). Software and Dataset for Fine-Tuning a Local LLM for Thermo-Electric Generators with QLoRA: From Generalist to Specialist, Zenodo.10.20944/preprints202511.1348.v1 ↗
28. Gerganov, G. (2025, November 03). Llama.Cpp: Inference of LLaMA Model in Pure C/C++ [Software]. GitHub. Available online: https://github.com/ggerganov/llama.cpp.
29. Hugging Face Team (2025, November 03). Hugging Face Is Way More Fun with Friends and Colleagues. Available online: https://huggingface.co/.
30. Ollama Team (2025, November 03). Ollama: Run Large Language Models Locally. Available online: https://ollama.com.
31. OpenAI Team (2025, November 03). OpenAI, Hello GPT-4o. Available online: https://openai.com/index/hello-gpt-4o/.
32. Google Team (2025, November 03). Google, Gemini 1.5: Unlocking Multimodal Understanding across Long Contexts. Available online: https://arxiv.org/abs/2403.05530.
33. Lin, C.-Y. (2004). ROUGE: A Package for Automatic Evaluation of Summaries. Text Summarization Branches Out, Proceedings of the ACL-04 Workshop, Barcelona, Spain, 21–26 July 2004, Association for Computational Linguistics. Available online: https://aclanthology.org/W04-1013/.
34. Zoui, M.A., Bentouba, S., Stocholm, J.G., and Bourouis, M. (2020). A Review on Thermoelectric Generators: Progress and Applications. Energies, 13.10.3390/en13143606 ↗
35. A Comprehensive Review of Thermoelectric Technology: Materials, Applications, Modelling and Performance Improvement10.1016/j.rser.2016.07.034 ↗
36. Giant Seebeck Effect in Ge-Doped SnSe10.1038/srep26774 ↗
37. Chen, T., Shao, Y., Feng, R., Zhang, J., Wang, Q., Dong, Y., Ma, H., Sun, B., and Ao, D. (2025). Enhancing the Thermoelectric Performance of N-Type PbTe via Mn Doping. Materials, 18.10.3390/ma18051029 ↗
38. Cho, J.-Y., Siyar, M., Jin, W.C., Hwang, E., Bae, S.-H., Hong, S.-H., Kim, M., and Park, C. (2019). Electrical Transport and Thermoelectric Properties of SnSe–SnTe Solid Solution. Materials, 12.10.3390/ma12233854 ↗
39. Zhao, C., Wang, M., and Liu, Z. (2022). Research Progress on Preparation Methods of Skutterudites. Inorganics, 10.10.3390/inorganics10080106 ↗
40. Finite-Temperature Violation of the Anomalous Transverse Wiedemann-Franz Law10.1126/sciadv.aaz3522 ↗
41. Holland, J.H. (1992). Adaptation in Natural and Artificial Systems: An Introductory Analysis with Applications to Biology, Control, and Artificial Intelligence, MIT Press.10.7551/mitpress/1090.001.0001 ↗
42. Goldberg, D.E., and Richardson, J. (1987, January 28–31). Genetic Algorithms with Sharing for Multimodal Function Optimization. Proceedings of the Second International Conference on Genetic Algorithms, Cambridge, MA, USA.
43. Differential Evolution—A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces10.1023/A:1008202821328 ↗
44. A Simplicial Homology Algorithm for Lipschitz Optimisation10.1007/s10898-018-0645-y ↗
45. Sanin-Villa, D., Montoya, O.D., Gil-González, W., Grisales-Noreña, L.F., and Perea-Moreno, A.-J. (2023). Parameter Estimation of a Thermoelectric Generator by Using Salps Search Algorithm. Energies, 16.10.3390/en16114304 ↗
46. An Effective Parameter Estimation on Thermoelectric Devices for Power Generation Based on Multiverse Optimization Algorithm10.1016/j.rineng.2025.104408 ↗
47. Mistral Team (2025, November 03). Mistral: LLM in Hugging Face. Available online: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3.
48. Hugging Face Team (2025, November 03). Llama-3.1-8B-Instruct: LLM in Hugging Face. Available online: https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct.
49. Qwen Team (2025, November 03). Qwen3-4B-Thinking-2507: LLM. Available online: https://huggingface.co/Qwen/Qwen3-4B-Thinking-2507.
50. Qwen Team (2025, December 01). Qwen2.5-VL. Available online: https://qwenlm.github.io/blog/qwen2.5-vl/.
51. Rein, D., Hou, B.L., Stickland, A.C., Petty, J., Pang, R.Y., Dirani, J., Michael, J., and Bowman, S.R. (2023). GPQA: A Graduate-Level Google-Proof Q&A Benchmark. arXiv.
52. Anthropic Team (2025, November 03). The Claude 3 Model Family: Opus, Sonnet, Haiku. Available online: https://www.anthropic.com/claude-3-model-card.
53. Jain, N.I.S., Han, K., Gu, A., Li, W.-D., Yan, F., Zhang, T., Wang, S., Solar-Lezama, A., and Sen, K. (2024). LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code. arXiv.
54. Li, T., Chiang, W.-L., Frick, E., Dunlap, L., Wu, T., Zhu, B., Gonzalez, J.E., and Stoica, I. (2024). From Crowdsourced Data to High-Quality Benchmarks: Arena-Hard and BenchBuilder Pipeline. arXiv.
55. Patil, S.G., Mao, H., Cheng-Jie Ji, C., Yan, F., Suresh, V., Stoica, I., and Gonzalez, J.E. (2025, January 13–19). The Berkeley Function Calling Leaderboard (BFCL): From Tool Use to Agentic Evaluation of Large Language Models. Proceedings of the Forty-Second International Conference on Machine Learning, Vancouver, BC, Canada.
56. Banerjee, S., Agarwal, A., and Singla, S. (2024). LLMs Will Always Hallucinate, and We Need to Live with This. arXiv.10.1007/978-3-031-99965-9_39 ↗
57. Paech, S.J. (2024). EQ-Bench: An Emotional Intelligence Benchmark for Large Language Models. arXiv.
58. Wu, Y., Mei, J., Yan, M., Li, C., Lai, S., Ren, Y., Wang, Z., Zhang, J., Wu, M., and Jin, Q. (2025). WritingBench: A Comprehensive Benchmark for Generative Writing. arXiv.
59. Pyatkin, V., Malik, S., Graf, V., Ivison, H., Huang, S., Dasigi, P., Lambert, N., and Hajishirzi, H. (2025). Generalizing Verifiable Instruction Following. arXiv.