We provide a theoretical framework for Reinforcement Learning with HumanFeedback (RLHF). Our analysis shows that when the true reward function islinear, the widely used maximum likelihood estimator (MLE) converges under boththe Bradley-Terry-Luce (BTL) model and the Plackett-Luce (PL) model. However,we show that when training a policy based on the learned reward model, MLEfails while a pessimistic MLE provides policies with improved performance undercertain coverage assumptions. Additionally, we demonstrate that under the PLmodel, the true MLE and an alternative MLE that splits the $K$-wise comparisoninto pairwise comparisons both converge. Moreover, the true MLE isasymptotically more efficient. Our results validate the empirical success ofexisting RLHF algorithms in InstructGPT and provide new insights for algorithmdesign. Furthermore, our results unify the problem of RLHF and max-entropyInverse Reinforcement Learning (IRL), and provide the first sample complexitybound for max-entropy IRL.