Reinforcement Learning-Based Code Reasoning Optimization for Small Language Models

Authors

  • Gaurika Rau Department of Computer Science, University of Central Florida, Orlando, FL, USA. Author
  • Rian Boreland Department of Electrical Engineering and Computer Science, University of Kansas, Lawrence, KS, USA. Author
  • Chantelle R. Ternan Department of Computer Science, George Mason University, Fairfax, VA, USA. Author
  • Lisanne van Ginneke Department of Computer Science, Binghamton University, Binghamton, NY, USA. Author

Keywords:

small language models; reinforcement learning; code reasoning; alignment; software engineering; deployment governance; fairness; sustainability; model optimization

Abstract

Small language models are becoming a practical alternative to very large models for code reasoning, especially in settings where latency, privacy, cost, and local deployment matter. However, their limited parameter budgets make multi-step code reasoning fragile, because errors in intermediate reasoning paths can cascade into incorrect programs. This paper examines reinforcement learning-based optimization as a system-level strategy for improving code reasoning in small language models. It argues that the central challenge is not merely reward maximization but the design of a socio-technical infrastructure that filters reasoning trajectories, aligns model behavior with software engineering constraints, and remains stable across deployment conditions. The paper analyzes architectural trade-offs between policy optimization, reward modeling, retrieval, and verification. It discusses data governance, environmental sustainability, robustness, fairness, and policy implications. It also compares small-model optimization with repository-level code assistance, program-aided reasoning, and tool-augmented workflows. The analysis suggests that reinforcement learning can improve small-model code reasoning only when paired with careful trajectory filtering, transparent evaluation, and operational safeguards. Without such safeguards, optimization may reward superficial correctness, increase hidden technical debt, or disadvantage users in under-resourced environments. The paper concludes that sustainable code reasoning optimization requires an integrated view of model architecture, reward design, deployment infrastructure, and governance.

References

1. Sutton, R. S., & Barto, A. G. (2018). Reinforcement learning: An introduction (2nd ed.). MIT Press.

2. Mnih, V., Kavukcuoglu, K., Silver, D., Rusu, A. A., Veness, J., Bellemare, M. G., Graves, A., Riedmiller, M., Fidjeland, A. K., Ostrovski, G., Petersen, S., Beattie, C., Sadik, A., Antonoglou, I., King, H., Kumaran, D., Wierstra, D., Legg, S., & Hassabis, D. (2015). Human-level control through deep reinforcement learning. Nature, 518(7540), 529-533. https://doi.org/10.1038/nature14236

3. Schulman, J., Wolski, F., Dhariwal, P., Radford, A., & Klimov, O. (2017). Proximal policy optimization algorithms. arXiv. https://arxiv.org/abs/1707.06347

4. Ouyang, L., Wu, J., Jiang, X., Almeida, D., Wainwright, C., Mishkin, P., Zhang, C., Agarwal, S., Slama, K., Ray, A., Schulman, J., Hilton, J., Kelton, F., Miller, L., Simens, M., Askell, A., Welinder, P., Christiano, P., Leike, J., & Lowe, R. (2022). Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35, 27730-27744.

5. Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q., & Zhou, D. (2022). Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35, 24824-24837.

6. Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., Ray, A., Puri, R., Krueger, G., Petrov, M., Khlaaf, H., Sastry, G., Mishkin, P., Chan, B., Gray, S., ... Zaremba, W. (2021). Evaluating large language models trained on code. arXiv. https://arxiv.org/abs/2107.03374

7. Austin, J., Odena, A., Nye, M., Bosma, M., Michalewski, H., Dohan, D., Jiang, E., Cai, C., Terry, M., Le, Q., & Sutton, C. (2021). Program synthesis with large language models. arXiv. https://arxiv.org/abs/2108.07732

8. Nijkamp, E., Pang, B., Hayashi, H., Tu, L., Wang, H., Zhou, Y., Savarese, S., & Xiong, C. (2023). CodeGen: An open large language model for code with multi-turn program synthesis. International Conference on Learning Representations.

9. Fried, D., Aghajanyan, A., Lin, J., Wang, S., Wallace, E., Shi, F., Zhong, R., Yih, W., Zettlemoyer, L., & Lewis, M. (2023). InCoder: A generative model for code infilling and synthesis. International Conference on Learning Representations.

10. Roziere, B., Gehring, J., Gloeckle, F., Sootla, S., Gat, I., Tan, X. E., Adi, Y., Liu, J., Remez, T., Rapin, J., Kozlov, A., Evtimov, I., Bitton, J., Bhatt, M., Canton-Ferrer, C., Grangier, D., Schwab, D., Esposito, D., Singh, S., ... Synnaeve, G. (2023). Code Llama: Open foundation models for code. arXiv. https://arxiv.org/abs/2308.12950

11. Le, H., Wang, Y., Gotmare, A. D., Savarese, S., & Hoi, S. C. H. (2022). CodeRL: Mastering code generation through pretrained models and deep reinforcement learning. Advances in Neural Information Processing Systems, 35, 21314-21328.

12. Li, Q. (2026, May). TrajLite PPO: Scalable Reasoning Path Filtering and Alignment for Small Parameter Large Language Models. In 2026 2nd International Conference on Artificial Intelligence and Digital Ethics (ICAIDE) (pp. 29-32). IEEE.

13. Yao, S., Yu, D., Zhao, J., Shafran, I., Griffiths, T. L., Cao, Y., & Narasimhan, K. (2023). Tree of thoughts: Deliberate problem solving with large language models. Advances in Neural Information Processing Systems, 36, 11809-11822.

14. Gao, L., Madaan, A., Zhou, S., Alon, U., Liu, P., Yang, Y., Callan, J., & Neubig, G. (2023). PAL: Program-aided language models. International Conference on Machine Learning, 202, 10764-10799.

15. Zhang, F., Chen, B., Zhang, Y., Keung, J., Liu, J., Zan, D., Mao, Y., Lou, J.-G., & Chen, W. (2023). RepoCoder: Repository-level code completion through iterative retrieval and generation. Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, 2471-2484.

16. Bender, E. M., Gebru, T., McMillan-Major, A., & Shmitchell, S. (2021). On the dangers of stochastic parrots: Can language models be too big? Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, 610-623.

17. Bommasani, R., Hudson, D. A., Adeli, E., Altman, R., Arora, S., von Arx, S., Bernstein, M. S., Bohg, J., Bosselut, A., Brunskill, E., Brynjolfsson, E., Buch, S., Card, D., Castellon, R., Chatterji, N., Chen, A., Creel, K., Davis, J. Q., Demszky, D., ... Liang, P. (2021). On the opportunities and risks of foundation models. arXiv. https://arxiv.org/abs/2108.07258

18. Mitchell, M., Wu, S., Zaldivar, A., Barnes, P., Vasserman, L., Hutchinson, B., Spitzer, E., Raji, I. D., & Gebru, T. (2019). Model cards for model reporting. Proceedings of the Conference on Fairness, Accountability, and Transparency, 220-229.

19. Sculley, D., Holt, G., Golovin, D., Davydov, E., Phillips, T., Ebner, D., Chaudhary, V., Young, M., Crespo, J.-F., & Dennison, D. (2015). Hidden technical debt in machine learning systems. Advances in Neural Information Processing Systems, 28, 2503-2511.

20. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., & Polosukhin, I. (2017). Attention is all you need. Advances in Neural Information Processing Systems, 30, 5998-6008.

Downloads

Published

2026-08-28

How to Cite

Reinforcement Learning-Based Code Reasoning Optimization for Small Language Models. (2026). International Journal of Artificial Intelligence Engineering and Systems, 1(2). https://ijaies.org/index.php/home/article/view/197