OPENIA, a new white-box (open-box) framework, checks LLM code for correctness as it's written, using the model's own thinking.
OPENIA assesses code correctness during generation by analyzing LLMs' internal representations, improving efficiency over post-hoc methods.
https://arxiv.org/abs/2501.12934
Original Problem π€:
β Ensuring correctness of LLM-generated code is crucial but challenging.
β Existing methods mainly rely on resource-intensive post-hoc analyses.
Solution in this Paper π‘:
β OPENIA leverages LLMs' internal representations during code generation to assess correctness.
β It analyzes intermediate states of open-source code LLMs (DeepSeek-Coder, CodeLlama, MagicCoder).
β OPENIA extracts internal states and feeds them to a probing classifier predicting code correctness.
Key Insights from this Paper π€―:
β Internal LLM representations encode latent information correlating with code correctness.
β Middle layers of LLMs offer the most informative representations for correctness assessment.
β OPENIA's performance varies with code length and task difficulty.
Results π:
β OPENIA outperforms baselines by up to 2x in accuracy for standalone code generation.
β Achieves up to 46% improvement in F1-score for repository-level code generation.
β OPENIA's inference takes only 0.6ms per code unit.










