From Walter Brueggemann’s Theology of the Old Testament:
Thus in Gen 18:16–19:29, Yahweh the judge is ready to act massively and decisively against Sodom and Gomorrah in response to their grave affront:
How great is the outcry against Sodom and Gomorrah and how very grave their sin! I must go down and see whether they have done altogether according to the outcry that has come to me; and if not, I will know. (18:20–21)
Abraham’s role in the narrative is to exercise restraint on Yahweh, to hold Yahweh to a higher standard of justice than Yahweh originally intended (v. 25). The narrative intends that the bargaining between Abraham and Yahweh (18:25–33) asserts a sovereign reasonableness in Yahweh’s attitude toward Sodom. That is, the massive judgment of 19:24–25 is appropriate to the massive affront of Sodom. And yet, the two large questions of 18:23–25 hint that Israel wondered about Yahweh’s potential for unmitigated rage. The exchange with Abraham leaves a residue of unsettlement and disquiet, a hint that at the edge of Yahweh’s judicial work, more than justice is possible.5 Wonderment about Yahweh’s lack of restraint is near the surface, even though it is not finally allowed in the narrative.